public void setActiveFilename(string file, navigation.ModFileMode mode) { this.FileMode = mode; this.ActiveFile = file; this.ou.setActiveFilename(file); this.splitContainer1.Panel1Collapsed = this.FileMode == navigation.ModFileMode.SINGLE; }
private void export(string filename) { GameData gameDatum = new GameData(); this.Cursor = Cursors.WaitCursor; navigation.ModFileMode fileMode = this.nav.FileMode; this.nav.FileMode = navigation.ModFileMode.SINGLE; gameDatum.load(this.fileA.Text, GameData.ModMode.ACTIVE, false); gameDatum.load(this.fileB.Text, GameData.ModMode.ACTIVE, false); foreach (object item in this.listView.Items) { TranslationFix.LineData tag = ((ListViewItem)item).Tag as TranslationFix.LineData; if (tag.@value == null) { continue; } GameData.Item item1 = gameDatum.getItem(tag.item.stringID); if (tag.key != null) { item1[tag.key] = tag.@value; } else { item1.Name = tag.@value; } } gameDatum.save(filename); this.nav.FileMode = fileMode; this.Cursor = Cursors.Default; }
public static string mergeLevelData(string srcPath, string destPath) { string str = ""; navigation.ModFileMode fileMode = MergeDialog.nav.FileMode; MergeDialog.nav.FileMode = navigation.ModFileMode.SINGLE; Directory.CreateDirectory(destPath); string str1 = string.Concat(srcPath, "/leveldata.level"); string str2 = string.Concat(destPath, "/leveldata.level"); if (!File.Exists(str2)) { File.Copy(str1, str2, false); str = string.Concat(str, "Copied leveldata\n"); } else { GameData gameDatum = new GameData(); gameDatum.load(str2, GameData.ModMode.ACTIVE, false); gameDatum.load(str1, GameData.ModMode.ACTIVE, false); gameDatum.save(str2); str = string.Concat(str, "Merged leveldata\n"); } int num = 0; int num1 = 0; FileInfo[] files = (new DirectoryInfo(srcPath)).GetFiles("*.zone"); for (int i = 0; i < (int)files.Length; i++) { FileInfo fileInfo = files[i]; string str3 = string.Concat(destPath, "/", fileInfo.Name); if (!File.Exists(str3)) { fileInfo.CopyTo(str3); num1++; } else { GameData gameDatum1 = new GameData(); gameDatum1.load(str3, GameData.ModMode.ACTIVE, false); gameDatum1.load(fileInfo.FullName, GameData.ModMode.ACTIVE, false); gameDatum1.save(str3); num++; } } str = string.Concat(new object[] { str, "Merged ", num, " Zone files\n" }); str = string.Concat(new object[] { str, "Copied ", num1, " Zone files\n" }); string str4 = string.Concat(srcPath, "/interiors.level"); if (File.Exists(str4)) { string str5 = string.Concat(destPath, "/interiors.level"); if (!File.Exists(str5)) { File.Copy(str4, str5, false); str = string.Concat(str, "Copied interiors\n"); } else { GameData gameDatum2 = new GameData(); gameDatum2.load(str5, GameData.ModMode.ACTIVE, false); gameDatum2.load(str4, GameData.ModMode.ACTIVE, false); gameDatum2.save(str5); str = string.Concat(str, "Merged interiors\n"); } } MergeDialog.nav.FileMode = fileMode; return(str); }