private static void DoCsvToSourceSync(string fn, bool isSync, Parser parser) { //read in CSV and write to MXE if we found a change Console.Out.WriteLine("Reading in CSV data..."); if (parser.ReadCsvs() && isSync) { Console.Out.WriteLine("Backup Source file and then Writing out Source data to [" + fn + "]..."); // back up the mxe file with a .bak file int fileCount = -1; string backup = fn + ".bak"; do { fileCount++; } while (File.Exists(backup + (fileCount > 0 ? fileCount.ToString() : String.Empty))); File.Copy(fn, backup + (fileCount > 0 ? fileCount.ToString() : String.Empty)); // write out the changed data parser.Write(); } }
private static void DoSourceToCsv(bool writeHex, bool writeIndex, Parser parser) { if (writeIndex) { Console.Out.WriteLine("Writing out Index data..."); parser.WriteIndexes(); } Console.Out.WriteLine("Writing out CSV data..."); parser.WriteCsv(); if (writeHex) { Console.Out.WriteLine("Writing out Hex data..."); MxeWord.Hex = true; parser.WriteCsv(); MxeWord.Hex = false; } }