public void Open() { var exe = System.IO.Path.Combine(ProgramModel.MakeExeRelativePath("tools"), Path); Process.Start(new ProcessStartInfo(exe) { WorkingDirectory = System.IO.Path.GetDirectoryName(exe), UseShellExecute = true, }); }
public void Activate() { var tauntPath = ProgramModel.MakeHawkempirePath("taunt"); if (IsBuiltIn) { foreach (var file in Directory.GetFiles(ProgramModel.MakeExeRelativePath(Path))) { File.Copy(file, System.IO.Path.Combine(tauntPath, System.IO.Path.GetFileName(file)), true); } } else { foreach (var file in Files) { File.Copy(file.FullPathName, System.IO.Path.Combine(tauntPath, System.IO.Path.GetFileName(file.Path)), true); } } }
public static void ApplyDrses() { var dic = builtInDrsFiles.ToDictionary(f => f, f => DrsFile.Load(Path.Combine(ProgramModel.MakeExeRelativePath("drs"), f))); foreach (var drs in ProgramModel.ActiveDrses.Reverse()) { foreach (var file in drs.Files) { var extension = Path.GetExtension(file.Path).TrimStart('.').ToLowerInvariant(); var id = int.Parse(Path.GetFileNameWithoutExtension(file.Path)); var drsName = Path.GetFileName(Path.GetDirectoryName(file.Path)).ToLowerInvariant(); dic[drs.MapDrsName(drsName)].GetOrAdd((DrsTableClass)Array.IndexOf(drsTables, extension))[id] = File.ReadAllBytes(file.FullPathName); } } foreach (var pair in dic) { pair.Value.Save(ProgramModel.MakeHawkempirePath(GetDrsPath(pair.Key))); } }
public void CopyExe() { if (IsBuiltIn) { File.Copy(ProgramModel.MakeExeRelativePath(ExePath), ProgramModel.MakeHawkempirePath($@"age2_x1\{Path.GetFileName(ExePath)}"), true); } if (new[] { -1, -3, -4, -5, -6 }.Contains(Id)) { File.Copy(ProgramModel.MakeExeRelativePath(XmlPath), Path.Combine(ProgramModel.MakeHawkempirePath("games"), Path.GetFileName(XmlPath)), true); } if (Id == AGE2_WK && WK_VERSION > ProgramModel.Config.WkVersion) { foreach (var dir in Directory.GetDirectories(ProgramModel.MakeExeRelativePath(@"builtin\WololoKingdoms"), "*", SearchOption.AllDirectories)) { try { Directory.CreateDirectory(dir.Replace(ProgramModel.MakeExeRelativePath("builtin"), ProgramModel.MakeHawkempirePath("games"))); } catch (IOException) { } } foreach (var file in Directory.GetFiles(ProgramModel.MakeExeRelativePath(@"builtin\WololoKingdoms"), "*", SearchOption.AllDirectories)) { try { File.Copy(file, file.Replace(ProgramModel.MakeExeRelativePath("builtin"), ProgramModel.MakeHawkempirePath("games")), true); } catch (IOException) { } } try { Directory.CreateDirectory(ProgramModel.MakeHawkempirePath(@"games\WololoKingdoms\data")); } catch (IOException) { } try { File.Copy(ProgramModel.MakeExeRelativePath(@"dat\original\empires2_x1_p1_wk.dat"), ProgramModel.MakeHawkempirePath(@"games\WololoKingdoms\data\empires2_x1_p1.dat"), true); } catch (IOException) { } try { File.Copy(ProgramModel.MakeExeRelativePath(@"drs\gamedata_x1_wk.drs"), ProgramModel.MakeHawkempirePath(@"games\WololoKingdoms\data\gamedata_x1.drs"), true); } catch (IOException) { } try { File.Copy(ProgramModel.MakeExeRelativePath(@"drs\gamedata_x1_p1_wk.drs"), ProgramModel.MakeHawkempirePath(@"games\WololoKingdoms\data\gamedata_x1_p1.drs"), false); } catch (IOException) { // ignored } File.Copy(ProgramModel.MakeExeRelativePath(@"dll\zh\language_x1_p1_wk.dll"), ProgramModel.MakeHawkempirePath(@"games\WololoKingdoms\data\language_x1_p1.dll"), true); ProgramModel.Config.WkVersion = WK_VERSION; } if (Id == AGE2_WK && ProgramModel.Config.IsSteamHDInstalled == SteamHDInstallStatus.NotInstalled) { try { File.Copy(ProgramModel.MakeExeRelativePath(@"exe\age2_wk_nohd.exe"), ProgramModel.MakeHawkempirePath(@"age2_x1\age2_wk.exe"), true); } catch (IOException) { } } }