Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
full implementation of isd conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
taubenangriff committed Nov 17, 2019
1 parent e096a23 commit 9c4f225
Showing 1 changed file with 65 additions and 4 deletions.
69 changes: 65 additions & 4 deletions AnnoFCConverter/FCConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ static void Main(string[] args)
string version = "1.1.0";
Console.WriteLine("{0}: Version {1} How to use:", appName, version);


//final variables
string ReadCDATA = "-r";
string WriteCDATA = "-w";
string ReadCDATA2070Mode = "-rz";
string WriteCDATA2070Mode = "-wz";
string SpecificOutputFile = "-o";
string Overwrite = "-y";
string IsdToHtml = "-i";
string HtmlToIsd = "-wi";

Console.WriteLine(ReadCDATA + " <InputFilename> for 1800 and " + ReadCDATA2070Mode + " <InputFilename> for 2070 to make <InputFilename> editable");
Console.WriteLine(WriteCDATA + " <InputFilename> for 1800 and " + WriteCDATA2070Mode + " <InputFilename> for 2070 to bring <InputFilename> back into .fc");
Expand Down Expand Up @@ -66,12 +70,18 @@ static void Main(string[] args)
modeSet = true;
LastArg = "mode";
}
else if (s.Equals("-i") && !modeSet)
else if (s.Equals(IsdToHtml) && !modeSet)
{
mode = "IslandFile";
modeSet = true;
LastArg = "mode";
}
else if (s.Equals(HtmlToIsd) && !modeSet)
{
mode = "HTMLToIslandFile";
modeSet = true;
LastArg = "mode";
}
else if (s.Equals(SpecificOutputFile))
{
hasSpecificOutputFile = true;
Expand Down Expand Up @@ -157,11 +167,62 @@ static void Main(string[] args)
}
}


break;

case "IslandFile":
p.ConvertISDToHTML(InputFileName, OutputFileName);
if (!hasSpecificOutputFile)
{
OutputFileName = InputFileName.Replace(".isd", ".html");
}
if (!InputFileName.EndsWith(".isd") || !OutputFileName.EndsWith(".html"))
{
Console.WriteLine("Error: Wrong File Types, Input must be .isd and Output must be .html ");
}
else
{
if (File.Exists(OutputFileName) && !OverwriteFile)
{
Console.WriteLine("OutputFile Already Exists. Use " + Overwrite + " as argument to overwrite the file");
}
else if (!File.Exists(InputFileName))
{
Console.WriteLine("Input File does not exist");
}
else
{
p.ConvertISDToHTML(InputFileName, OutputFileName);
Console.WriteLine("Converted " + InputFileName + " to " + OutputFileName);
}
}
break;
case "HTMLToIslandFile":
if (!hasSpecificOutputFile)
{
OutputFileName = InputFileName.Replace(".html", ".isd");
}
if (!InputFileName.EndsWith(".html") || !OutputFileName.EndsWith(".isd"))
{
Console.WriteLine("Error: Wrong File Types, Input must be .html and Output must be .isd ");
}
else
{
if (File.Exists(OutputFileName) && !OverwriteFile)
{
Console.WriteLine("OutputFile Already Exists. Use " + Overwrite + " as argument to overwrite the file");
}
else if (!File.Exists(InputFileName))
{
Console.WriteLine("Input File does not exist");
}
else
{
p.ConvertToISDFile(InputFileName, OutputFileName);
Console.WriteLine("Converted " + InputFileName + " to " + OutputFileName);
}
}
break;


case "readCDATA2070Mode":
if (!hasSpecificOutputFile)
{
Expand Down Expand Up @@ -1276,7 +1337,7 @@ private void ConvertToISDFile(String InputPath, String OutputPath) {
}

//conversion with 16 bit int (short)
if (token.Equals("<Height_Map_v2>"))
if (token.Equals("<m_HeightMap_v2>"))
{
//for implementation
//add the next six characters (CDATA[) get the content of the brackets, split it on " " into an array, convert each one into 4 bytes and write them with the binary writer
Expand Down

0 comments on commit 9c4f225

Please sign in to comment.