//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// public static void removeENB() { foreach (string line in new string[] { @"data\enb vision.bsa", @"data\enb vision.esp", "eed_verasansmono.bmp", "elep additional shaders", "enbinjector.exe", "enbpalettes", "enhancedenbdiagnostics.fxh", "fxaa_tool.exe", "fixforbrightobjects.txt", "smaa.fx", "smaa.h", "smaa_dx11.fx", "shader functions", "sweetfx", "sweetfx_d3d9.dll", "sweetfx_preset.txt", "sweetfx_settings.txt", "_locationweather.ini", "_mist_anchors.xml", "_sample_enbraindrops", "_weatherlist.ini", "common.fxh", "d3d9.dll", "d3d9.fx", "d3d9sffiles.dll", "d3d9_fxaa.dll", "d3d9_sffiles.dll", "d3d9_sfx.dll", "d3d9_sfx_fxaa.dll", "d3d9_sfx_smaa.dll", "d3d9_sharpen.dll", "d3d9_sweetffiles.dll", "d3d9_smaa.dll", "d3d9injffiles.dll", "d3d9orig.dll", "d3d9swe.dll", "defaultlut.png", "dxgi.dll", "dxgi.fx", "effect.txt", "effect.txt.ini", "enbbloom.fx", "enbbloom.fx.ini", "enbbloom.fx.rar", "enbdefs.fx", "enbdirt.bmp", "enbdirt.tga", "enbeffect.ffiles.ini", "enbeffect.fx", "enbeffect.fx.ini", "enbeffectprepass.fx", "enbeffectprepass.fx.ini", "enbeffectxx.fx.ini", "enbfontunicode.png", "enbfrost.bmp", "enbhelper.dll", "enbhost.exe", "enbinjector.ini", "enblens.fx", "enblens.fx.ini", "enblens1.fx", "enblensmask.bmp", "enblensmask.png", "enblensmask.tga", "enblocal.ini", "enblocalization.xml", "enbpalette.bmp", "enbpalette.png", "enbraindrops.tga", "enbseries", "enbseries.ini", "enbspectrum.bmp", "enbsunsprite.fx", "enbsunsprite.fx.ini", "enbsunsprite.tga", "enbweather.bmp", "injfx_settings.h", "injfx_shaders", "injector.ini", "shader.fx", "shift.dll", "sweetfx_d3d9.dll", "technique.fxh", "volumetric_mist_anchors.xml" }) { FuncFiles.deleteAny(FormMain.pathGameFolder + line); } }
private bool checkUpdateFile(bool fromDL) { if (File.Exists(pathUpdateFolder + "file" + numberSelectFile + ".rar") && File.Exists(pathUpdateFolder + nameUpdateInfo) && File.Exists(FormMain.pathLauncherFolder + "UnRAR.exe")) { if (new FileInfo(pathUpdateFolder + "file" + numberSelectFile + ".rar").Length == FuncParser.intRead(pathUpdateFolder + nameUpdateInfo, "Update_" + numberSelectFile, "update_file_filesize")) { return(true); } else { if (fromDL) { MessageBox.Show(textNoSyncWithUI); } FuncFiles.deleteAny(pathUpdateFolder + "file" + numberSelectFile + ".rar"); } } else { if (fromDL) { MessageBox.Show(textNoTools); } } return(false); }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void button_Uninstall_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { if (FuncMisc.dialogResult(textDeleteMod)) { if (File.Exists(FormMain.pathModsFolder + listBox1.SelectedItem.ToString().Replace(".rar", ".txt"))) { foreach (string line in File.ReadLines(FormMain.pathModsFolder + listBox1.SelectedItem.ToString().Replace(".rar", ".txt"))) { FuncFiles.deleteAny(FormMain.pathGameFolder + line); } if (listBox1.SelectedItem.ToString().ToUpper().Contains("OSA") && File.Exists(FormMain.pathFNISRAR)) { FuncMisc.unpackRAR(FormMain.pathFNISRAR); } } else { MessageBox.Show(textNoUninstalFile); } } } else { MessageBox.Show(textNoFileSelect); } }
static void clearFolder(string path) { if (Directory.Exists(path)) { foreach (string line in Directory.EnumerateFiles(path)) { if (!ignoreList.Exists(s => s.Equals(line.Remove(0, FormMain.gameDirLength), StringComparison.OrdinalIgnoreCase))) { FuncFiles.deleteAny(line); } } foreach (string line in Directory.EnumerateDirectories(path)) { string dirName = line.Remove(0, FormMain.gameDirLength); if (!ignoreList.Exists(s => s.Equals(dirName, StringComparison.OrdinalIgnoreCase))) { FuncFiles.deleteAny(line); } else if (!ingoredFoldersList.Exists(s => s.Equals(dirName, StringComparison.OrdinalIgnoreCase))) { if (Directory.GetFiles(line).Length == 0 && Directory.GetDirectories(line).Length == 0) { FuncFiles.deleteAny(line); } else { clearFolder(line); } } } } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// private void button_ModUnInstall_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { DialogResult dialogResult = MessageBox.Show(confirmDelete, confirmTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (File.Exists(pathCPFiles + listBox1.SelectedItem.ToString().Replace(".rar", ".txt"))) { foreach (string line in File.ReadLines(pathCPFiles + listBox1.SelectedItem.ToString().Replace(".rar", ".txt"))) { FuncFiles.deleteAny(FormMain.pathGameFolder + line); } if (listBox1.SelectedItem.ToString().ToUpper().Contains("OSA") && File.Exists(FormMain.pathFNISRAR)) { FuncMisc.unpackRAR(FormMain.pathFNISRAR); } } else { MessageBox.Show(noUninstalFile); } } } else { MessageBox.Show(noFileSelect); } }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // public static void removeENB() { foreach (string line in new string[] { "enbseries", "d3d9.dll", "enbhost.exe", "enblocal.ini", "enbseries.ini", "enbinjector.exe", "enbinjector.ini", @"data\enb vision.esp" }) { FuncFiles.deleteAny(FormMain.pathGameFolder + line); } }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void refreshAllValue() { setupENB = FuncSettings.checkENB(); FuncSettings.physicsFPS(); FuncSettings.restoreENBAdapter(); FuncSettings.restoreENBBorderless(); FuncSettings.restoreENBVSync(); if (!setupENB || FuncSettings.checkENBoost()) { FuncMisc.refreshButton(button_AO, "", "", "", null, false); FuncMisc.refreshButton(button_DOF, "", "", "", null, false); FuncMisc.refreshButton(button_EAA, "", "", "", null, false); FuncMisc.refreshButton(button_SAA, "", "", "", null, false); FuncMisc.refreshButton(button_TAA, "", "", "", null, false); if (!File.Exists(FormMain.pathDataFolder + "GameText9.bsa")) { FuncMisc.unpackArhive(FormMain.pathSystemFolder + "GameText9", true); } } else { refreshAO(); refreshDOF(); refreshEAA(); refreshSAA(); refreshTAA(); FuncFiles.deleteAny(FormMain.pathDataFolder + "GameText9.bsa"); } refreshAF(); refreshAutoDetect(); refreshCompressMemory(); refreshFPS(); refreshMemory(); refreshExpandMemory(); }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// private void button_ClearDirectory_Click(object sender, EventArgs e) { label1.Focus(); DialogResult dialogResult = MessageBox.Show(clearDirectory, confirmTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { FuncFiles.deleteAny(pathMyDoc + "Logs"); FuncFiles.deleteAny(pathMyDoc + "SKSE"); if (FuncParser.stringRead(pathSkyrimINI, "Papyrus", "bEnableLogging") == "1") { FuncFiles.creatDirectory(pathMyDoc + "Logs"); } if (Directory.Exists(pathMyDoc + "Saves")) { foreach (string line in Directory.GetFiles(pathMyDoc + "Saves", "*.bak")) { FuncFiles.deleteAny(line); } } FuncFiles.deleteAny(pathGameFolder + @"..\Skyrim Mods"); FuncClear.clearGameFolder(); FuncClear.emptyFolder(pathGameFolder); } }
static void clearFolder(string clearpath) { if (Directory.Exists(clearpath)) { foreach (string line in Directory.EnumerateFiles(clearpath)) { string fileName = line.Remove(0, FormMain.pathGameFolder.Length); if (!IgnoreFilesList.Contains(fileName, StringComparer.OrdinalIgnoreCase) && !CustomIgnoreList.Contains(fileName, StringComparer.OrdinalIgnoreCase)) { FuncFiles.deleteAny(line); } } foreach (string line in Directory.EnumerateDirectories(clearpath)) { string dirName = line.Remove(0, FormMain.pathGameFolder.Length); if (!IgnoreFoldersList.Contains(dirName, StringComparer.OrdinalIgnoreCase) && !CustomIgnoreList.Contains(dirName, StringComparer.OrdinalIgnoreCase)) { FuncFiles.deleteAny(line); } else if (!IngoredSearchFoldersList.Contains(dirName, StringComparer.OrdinalIgnoreCase) && !CustomIgnoreList.Contains(dirName, StringComparer.OrdinalIgnoreCase)) { if (Directory.GetFiles(line).Length == 0 && Directory.GetDirectories(line).Length == 0) { FuncFiles.deleteAny(line); } else { clearFolder(line); } } } } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// private void button_unpackENB_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { FuncClear.removeENB(); enbUnpack(listBox1.SelectedItem.ToString()); FuncParser.iniWrite(FormMain.pathLauncherINI, "ENB", "LastPreset", listBox1.SelectedItem.ToString()); if (listBox1.SelectedItem.ToString().ToLower().Contains("boost")) { FuncMisc.refreshButton(button_DOF, "", "", "", null, false); FuncMisc.refreshButton(button_EAA, "", "", "", null, false); FuncMisc.refreshButton(button_SAA, "", "", "", null, false); FuncMisc.refreshButton(button_TAA, "", "", "", null, false); FuncMisc.unpackRAR(FormMain.pathLauncherFolder + @"CPFiles\System\GameText9.rar"); } else { FuncFiles.deleteAny(FormMain.pathGameFolder + @"Data\GameText9.bsa"); } } else { MessageBox.Show(noFileSelect); } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// private void button_Restore_Click(object sender, EventArgs e) { FuncFiles.deleteAny(FormMain.pathAppData + @"Plugins.txt"); FuncFiles.deleteAny(FormMain.pathAppData + @"LoadOrder.txt"); FuncFiles.copyAny(FormMain.pathLauncherFolder + @"MasterList\Plugins.txt", FormMain.pathAppData + @"Plugins.txt"); FuncFiles.copyAny(FormMain.pathLauncherFolder + @"MasterList\Plugins.txt", FormMain.pathAppData + @"LoadOrder.txt"); refreshModsList(); }
private void button_Close_Click(object sender, EventArgs e) { client.DownloadProgressChanged -= new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.DownloadFileCompleted -= new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.CancelAsync(); FuncFiles.deleteAny(pathUpdateFolder + nameControlPanel); FuncFiles.deleteAny(pathUpdateFolder + nameUpdateInfo); Dispose(); }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void button_UpdateCP_Click(object sender, EventArgs e) { stopDownload = true; enableDisableButtons(); FuncFiles.deleteAny(pathUpdateFolder + nameControlPanel); downloadFileName = nameControlPanel; downloadFileType = "UpdateCP"; client_DownloadProgressStart(); }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void button_ClearDirectory_Click(object sender, EventArgs e) { label1.Focus(); if (FuncMisc.dialogResult(textClearDirectory)) { FuncFiles.deleteAny(pathMyDoc + "SKSE"); FuncFiles.deleteAllInFolder(pathMyDoc + "Logs", "*"); FuncFiles.deleteAllInFolder(pathMyDoc + "Saves", "*.bak"); FuncFiles.deleteAny(Path.GetFullPath(pathGameFolder + @"..\Skyrim Mods")); FuncClear.clearGameFolder(); } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// public static void writeToFile(string path, List <string> list) { try { FuncFiles.deleteAny(path); File.WriteAllLines(path, list, new UTF8Encoding(false)); } catch { MessageBox.Show(FormMain.couldWriteFile + path); } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// private void button_ClearDirectory_Click(object sender, EventArgs e) { label1.Focus(); DialogResult dialogResult = MessageBox.Show(clearDirectory, confirmTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { FuncFiles.deleteAny(pathMyDoc + "SKSE"); FuncFiles.deleteAllInFolder(pathMyDoc + "Logs", "*"); FuncFiles.deleteAllInFolder(pathMyDoc + "Saves", "*.bak"); FuncFiles.deleteAny(pathGameFolder + @"..\Skyrim Mods"); FuncClear.clearGameFolder(); } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// public static void emptyFolder(string path) { if (Directory.Exists(path)) { foreach (string line in Directory.GetDirectories(path)) { emptyFolder(line); if (Directory.GetFiles(line).Length == 0 && Directory.GetDirectories(line).Length == 0) { FuncFiles.deleteAny(line); } } } }
public void resetSettings() { if (File.Exists(pathLauncherFolder + "Skyrim.ini") && File.Exists(pathLauncherFolder + "SkyrimPrefs.ini") && File.Exists(pathLauncherFolder + @"MasterList\Plugins.txt")) { try { RegistryKey key; key = Registry.LocalMachine.CreateSubKey(registryPath); key.SetValue(registryKey, pathGameFolder); key.Close(); } catch { MessageBox.Show(failWriteToRegistry + registryPath + " " + registryKey + "=" + pathGameFolder); } FuncFiles.deleteAny(pathSkyrimINI); FuncFiles.deleteAny(pathSkyrimPrefsINI); FuncFiles.deleteAny(pathMyDoc + "Logs"); FuncFiles.deleteAny(pathMyDoc + "SKSE"); FuncFiles.deleteAny(pathMyDoc + "SkyProc"); FuncFiles.deleteAny(pathMyDoc + "BashSettings.dat"); FuncFiles.deleteAny(pathMyDoc + "BashSettings.dat.bak"); FuncFiles.deleteAny(pathMyDoc + "RendererInfo.txt"); FuncFiles.deleteAny(pathMyDoc + @"Saves\Bash"); FuncFiles.creatDirectory(pathMyDoc); FuncFiles.copyAny(pathLauncherFolder + "Skyrim.ini", pathSkyrimINI); FuncFiles.copyAny(pathLauncherFolder + "SkyrimPrefs.ini", pathSkyrimPrefsINI); FuncFiles.copyAny(pathLauncherFolder + @"MasterList\BashSettings.dat", pathMyDoc + "BashSettings.dat"); FuncFiles.deleteAny(pathAppData + @"Plugins.txt"); FuncFiles.deleteAny(pathAppData + @"LoadOrder.txt"); FuncFiles.deleteAny(pathAppData + @"Plugins.tes5viewsettings"); FuncFiles.creatDirectory(pathAppData); FuncFiles.copyAny(pathLauncherFolder + @"MasterList\Plugins.txt", pathAppData + @"Plugins.txt"); FuncFiles.copyAny(pathLauncherFolder + @"MasterList\Plugins.txt", pathAppData + @"LoadOrder.txt"); FuncFiles.copyAny(pathLauncherFolder + @"MasterList\Plugins.tes5viewsettings", pathAppData + @"Plugins.tes5viewsettings"); FuncSettings.setSettingsPreset(settingsPreset); FuncParser.iniWrite(pathSkyrimPrefsINI, "Display", "iSize W", Screen.PrimaryScreen.Bounds.Width.ToString()); FuncParser.iniWrite(pathSkyrimPrefsINI, "Display", "iSize H", Screen.PrimaryScreen.Bounds.Height.ToString()); FuncSettings.physicsFPS(); MessageBox.Show(typeSettings[settingsPreset] + setSettings); } else { MessageBox.Show(notFoundTemplates); } }
private void button_unpackENB_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { if (listBox1.SelectedItem.ToString().ToUpper().Contains("ENB")) { FuncClear.removeENB(); } else if (listBox1.SelectedItem.ToString().ToUpper().Contains("DOF")) { FuncFiles.deleteAny(FormMain.pathGameFolder + @"ENBSeries\enbdepthoffield.fx.ini"); } enbUnpack(listBox1.SelectedItem.ToString()); } else { MessageBox.Show(noFileSelect); } }
private void unpackUpdates(bool readyDL) { for (int i = 1; i <= 200; i++) { if (FuncParser.keyExists(pathUpdateFolder + nameUpdateInfo, "Update_" + numberSelectFile, "update_delete_file_" + i.ToString())) { FuncFiles.deleteAny(FormMain.pathGameFolder + FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + numberSelectFile, "update_delete_file_" + i.ToString())); } else { break; } } FuncMisc.unpackRAR(pathUpdateFolder + "file" + numberSelectFile + ".rar"); FuncParser.iniWrite(FormMain.pathLauncherINI, "Updates", "Update_" + numberSelectFile + "_Version", FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + numberSelectFile, "update_file_version")); comboBox_Updates_SelectedIndexChanged(this, new EventArgs()); if (readyDL) { stopDownload = false; enableDisableButtons(); } }
static void clearCurrentFolder(string clearpath) { if (Directory.Exists(FormMain.pathGameFolder + clearpath)) { foreach (string line in Directory.EnumerateFiles(FormMain.pathGameFolder + clearpath)) { string fileName = line.Remove(0, FormMain.pathGameFolder.Length); if (!IgnoreFilesList.Contains(fileName, StringComparer.OrdinalIgnoreCase) && !CustomIgnoreList.Contains(fileName, StringComparer.OrdinalIgnoreCase)) { FuncFiles.deleteAny(line); } } foreach (string line in Directory.EnumerateDirectories(FormMain.pathGameFolder + clearpath)) { string dirName = line.Remove(0, FormMain.pathGameFolder.Length); if (!IgnoreFoldersList.Contains(dirName, StringComparer.OrdinalIgnoreCase) && !CustomIgnoreList.Contains(dirName, StringComparer.OrdinalIgnoreCase)) { FuncFiles.deleteAny(line); } } } }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // public static void wideScreenMods() { if (FuncParser.intRead(FormMain.pathLauncherINI, "General", "AspectRatio") == 4) { if (File.Exists(FormMain.pathDataFolder + "Frostfall.esp") && (!File.Exists(FormMain.pathDataFolder + "Frostfall-WS.esp") || !File.Exists(FormMain.pathDataFolder + "Frostfall-WS.bsa"))) { unpackArhive(FormMain.pathSystemFolder + "AR(4)FF", true); } if (File.Exists(FormMain.pathDataFolder + "DisableFastTravel.bsa") && new FileInfo(FormMain.pathDataFolder + "DisableFastTravel.bsa").Length != 45717) { unpackArhive(FormMain.pathSystemFolder + "AR(4)DFT", true); } } else { FuncFiles.deleteAny(FormMain.pathDataFolder + "Frostfall-WS.esp"); FuncFiles.deleteAny(FormMain.pathDataFolder + "Frostfall-WS.bsa"); if (File.Exists(FormMain.pathDataFolder + "DisableFastTravel.bsa") && new FileInfo(FormMain.pathDataFolder + "DisableFastTravel.bsa").Length != 45701) { unpackArhive(FormMain.pathModsFolder + "DisableFastTravel", true); } } }
//////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ////////////////////////////////////////////////////////////// public static void wideScreenMods() { if (FuncParser.intRead(FormMain.pathLauncherINI, "General", "AspectRatio") == 4) { if (File.Exists(FormMain.pathGameFolder + @"Data\Frostfall.esp") && (!File.Exists(FormMain.pathGameFolder + @"Data\Frostfall-WS.esp") || !File.Exists(FormMain.pathGameFolder + @"Data\Frostfall-WS.bsa"))) { unpackRAR(FormMain.pathLauncherFolder + @"CPFiles\System\AR(4)FF.rar"); } if (File.Exists(FormMain.pathGameFolder + @"Data\DisableFastTravel.bsa") && new FileInfo(FormMain.pathGameFolder + @"Data\DisableFastTravel.bsa").Length != 45717) { unpackRAR(FormMain.pathLauncherFolder + @"CPFiles\System\AR(4)DFT.rar"); } } else { FuncFiles.deleteAny(FormMain.pathGameFolder + @"Data\Frostfall-WS.esp"); FuncFiles.deleteAny(FormMain.pathGameFolder + @"Data\Frostfall-WS.bsa"); if (File.Exists(FormMain.pathGameFolder + @"Data\DisableFastTravel.bsa") && new FileInfo(FormMain.pathGameFolder + @"Data\DisableFastTravel.bsa").Length != 45701) { unpackRAR(FormMain.pathLauncherFolder + @"CPFiles\DisableFastTravel.rar"); } } }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void button_Uninstall_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { if (FuncMisc.dialogResult(textDeleteMod)) { string file = FormMain.pathModsFolder + listBox1.SelectedItem.ToString().Replace(".rar", ".txt"); if (File.Exists(file)) { foreach (string line in File.ReadLines(file)) { if (line.StartsWith("[")) { break; } else if (line.Length > 0) { FuncFiles.deleteAny(FormMain.pathGameFolder + line); } } if (FuncParser.keyExists(file, "UNINSTALL", "UNPACK")) { FuncMisc.unpackRAR(FormMain.pathGameFolder + FuncParser.stringRead(file, "UNINSTALL", "UNPACK")); } } else { MessageBox.Show(textNoUninstalFile); } } } else { MessageBox.Show(textNoFileSelect); } }
public void resetSettings() { try { RegistryKey key; key = Registry.LocalMachine.CreateSubKey(registryPath); key.SetValue(registryKey, pathGameFolder); key.Close(); } catch { MessageBox.Show(textRegistryFail + registryPath + " " + registryKey + "=" + pathGameFolder); } FuncFiles.deleteAny(pathMyDoc + "Logs"); FuncFiles.deleteAny(pathMyDoc + "SKSE"); FuncFiles.deleteAny(pathMyDoc + "SkyProc"); FuncFiles.deleteAny(pathMyDoc + "BethINI Cache"); FuncFiles.deleteAny(pathMyDoc + "BashSettings.dat"); FuncFiles.deleteAny(pathMyDoc + "BashSettings.dat.bak"); FuncFiles.deleteAny(pathMyDoc + "BashLoadOrders.dat"); FuncFiles.deleteAny(pathMyDoc + "BashLoadOrders.dat.bak"); FuncFiles.deleteAny(pathMyDoc + "ModChecker.html"); FuncFiles.deleteAny(pathMyDoc + "RendererInfo.txt"); FuncFiles.deleteAny(pathMyDoc + @"Saves\Bash"); FuncFiles.deleteAny(pathSkyrimINI); FuncFiles.deleteAny(pathMyDoc + "Skyrim.ini.BethINIbackup"); FuncFiles.deleteAny(pathSkyrimPrefsINI); FuncFiles.deleteAny(pathMyDoc + "SkyrimPrefs.ini.BethINIbackup"); FuncFiles.creatDirectory(pathMyDoc); if (File.Exists(pathLauncherFolder + "Skyrim.ini")) { FuncFiles.copyAny(pathLauncherFolder + "Skyrim.ini", pathSkyrimINI); } else { MessageBox.Show(textUseStandart + pathLauncherFolder + "Skyrim.ini"); FuncMisc.writeToFile(pathSkyrimINI, FuncSettings.skyrimINI()); } if (File.Exists(pathLauncherFolder + "SkyrimPrefs.ini")) { FuncFiles.copyAny(pathLauncherFolder + "SkyrimPrefs.ini", pathSkyrimPrefsINI); } else { MessageBox.Show(textUseStandart + pathLauncherFolder + "SkyrimPrefs.ini"); FuncMisc.writeToFile(pathSkyrimPrefsINI, FuncSettings.skyrimPrefsINI()); } if (File.Exists(pathProgramFilesFolder + "BashSettings.dat")) { FuncFiles.copyAny(pathProgramFilesFolder + "BashSettings.dat", pathMyDoc + "BashSettings.dat"); } FuncFiles.deleteAny(pathAppData + "DLCList.txt"); FuncFiles.deleteAny(pathAppData + "Plugins.txt"); FuncFiles.deleteAny(pathAppData + "LoadOrder.txt"); FuncFiles.deleteAny(pathAppData + "Plugins.tes5viewsettings"); FuncFiles.creatDirectory(pathAppData); if (File.Exists(pathLauncherFolder + "Plugins.txt")) { FuncFiles.copyAny(pathLauncherFolder + "Plugins.txt", pathAppData + "Plugins.txt"); FuncFiles.copyAny(pathLauncherFolder + "Plugins.txt", pathAppData + "LoadOrder.txt"); } else { MessageBox.Show(textUseStandart + pathLauncherFolder + "Plugins.txt"); FuncMisc.writeToFile(pathAppData + "Plugins.txt", FuncSettings.pluginsTXT()); FuncMisc.writeToFile(pathAppData + "LoadOrder.txt", FuncSettings.pluginsTXT()); } if (File.Exists(pathProgramFilesFolder + "Plugins.tes5viewsettings")) { FuncFiles.copyAny(pathProgramFilesFolder + "Plugins.tes5viewsettings", pathAppData + "Plugins.tes5viewsettings"); } if (File.Exists(pathSkyrimINI) && File.Exists(pathSkyrimPrefsINI)) { FuncSettings.setSettingsPreset(settingsPreset); FuncParser.iniWrite(pathSkyrimPrefsINI, "Display", "iSize W", Screen.PrimaryScreen.Bounds.Width.ToString()); FuncParser.iniWrite(pathSkyrimPrefsINI, "Display", "iSize H", Screen.PrimaryScreen.Bounds.Height.ToString()); FuncSettings.physicsFPS(); FuncSettings.restoreENBAdapter(); FuncSettings.restoreENBBorderless(); FuncSettings.restoreENBVSync(); MessageBox.Show(typeSettings[settingsPreset] + textSetSettings); } else { MessageBox.Show(textSetSettingsFail); } }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void button_CheckUpdate_Click(object sender, EventArgs e) { if (stopDownload) { client.CancelAsync(); stopDownload = false; enableDisableButtons(); } else { stopDownload = true; enableDisableButtons(); if (updatesFound) { string line1 = FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + numberSelectFile, "update_file_warning"); bool confirm = false; bool request = false; if (line1 != null) { if (FuncMisc.dialogResult(textPleaseRead + line1 + Environment.NewLine + Environment.NewLine + textContinue)) { confirm = true; } line1 = null; } else { confirm = true; } if (confirm) { string line2 = FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + numberSelectFile, "update_request_update"); if (line2 != null) { if (FuncParser.doubleRead(pathUpdateFolder + nameUpdateInfo, "Update_" + line2, "update_file_version") <= FuncParser.doubleRead(FormMain.pathLauncherINI, "Updates", "Update_" + line2 + "_Version")) { request = true; } else { MessageBox.Show(textRequiredVersion + FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + line2, "update_file")); } line2 = null; } else { request = true; } } if (confirm && request) { if (checkUpdateFile(false)) { unpackUpdates(true); } else { FuncFiles.deleteAny(pathUpdateFolder + "file" + numberSelectFile + ".rar"); downloadFileName = "file" + numberSelectFile + ".rar"; downloadFileType = "UpdateG"; client_DownloadProgressStart(); } } else { stopDownload = false; enableDisableButtons(); } } else { FuncFiles.deleteAny(pathUpdateFolder + nameUpdateInfo); downloadFileName = nameUpdateInfo; downloadFileType = "CheckU"; realIndexI.Clear(); realIndex.Clear(); installPreLoad.Clear(); client_DownloadProgressStart(); } } }
// ------------------------------------------------ BORDER OF FUNCTION ---------------------------------------------------------- // private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { if (stopDownload) { if (File.Exists(pathUpdateFolder + nameUpdateInfo)) { if (downloadFileType == "CheckU") { int CountComboBox = FuncParser.intRead(pathUpdateFolder + nameUpdateInfo, "General", "numbers_files_update"); if (CountComboBox > 0) { for (int i = 1; i <= CountComboBox; i++) { comboBox_Updates.SelectedIndexChanged -= comboBox_Updates_SelectedIndexChanged; if (checkUpdateVersion(i)) { realIndexI.Add(i); installPreLoad.Add(textInstalled + " / " + FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + i, "update_file")); } else { realIndex.Add(i); comboBox_Updates.Items.Add(textAvailable + " / " + FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "Update_" + i, "update_file")); } comboBox_Updates.SelectedIndexChanged += comboBox_Updates_SelectedIndexChanged; } for (int i = 0; i < realIndexI.Count; i++) { realIndex.Add(realIndexI[i]); comboBox_Updates.Items.Add(installPreLoad[i]); } if (comboBox_Updates.Items.Count > 0) { comboBox_Updates.SelectedIndex = 0; } updatesFound = true; label4.Text = CountComboBox.ToString(); } else { updatesFound = false; label4.Text = textNoUpdate; } string line = FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "General", "version_control_panel"); if (line != null) { var result = new Version(FormMain.panelFileVersion).CompareTo(new Version(line)); updatesCPFound = result < 0; } } if (downloadFileType == "UpdateG") { if (checkUpdateFile(true)) { unpackUpdates(false); } } if (downloadFileType == "UpdateCP") { string version1 = FileVersionInfo.GetVersionInfo(pathUpdateFolder + nameControlPanel).ProductVersion; if (version1 == FuncParser.stringRead(pathUpdateFolder + nameUpdateInfo, "General", "version_control_panel")) { FuncMisc.writeToFile(FormMain.pathLauncherFolder + "Update.bat", new List <string>() { "@Echo off", "mode con:cols=50 lines=10", "color 0E", "cd %~dp0", "SET CP_S=" + FormMain.pathLauncherExecuting, "SET CP_U=" + pathUpdateFolder + nameControlPanel, "Echo Please Wait 5 second before start update.", "TIMEOUT /T 2 /NOBREAK >nul 2>nul", "IF EXIST \"%CP_U%\" (", "Echo -Update file found.", "TIMEOUT /T 1 /NOBREAK >nul 2>nul", "Echo -Delete old file control panel.", "del \"%CP_S%\" /Q >nul 2>nul", "TIMEOUT /T 1 /NOBREAK >nul 2>nul", "Echo -Move new file control panel.", "move /Y \"%CP_U%\" \"%CP_S%\" >nul 2>nul", "TIMEOUT /T 1 /NOBREAK >nul 2>nul", "Echo -Expectation launching new control panel.", "start \"Run new file\" \"%CP_S%\" >nul 2>nul", ") else (", "Echo -Update file not found...", "TIMEOUT /T 5 /NOBREAK >nul 2>nul", ")", "Echo -Closing.", "TIMEOUT /T 2 /NOBREAK >nul 2>nul", "del \"" + FormMain.pathLauncherFolder + "Update.bat\" /Q >nul 2>nul" }); FuncMisc.runProcess(FormMain.pathLauncherFolder + "Update.bat", null, null, this, true, false); Application.Exit(); } else { MessageBox.Show(textNoSyncWithUI); FuncFiles.deleteAny(pathUpdateFolder + nameControlPanel); } } } else { updatesFound = false; updatesCPFound = false; } } stopDownload = false; progressBar1.Value = 0; enableDisableButtons(); }