public ChangeLog() { InitializeComponent(); FileOperator fileOperator = new FileOperator(); txtChangeLog.Content = fileOperator.getChangeLog(); }
public bool DeleteLogs(int nrFS, bool Full) { List <string> pathToLogsFiles = new List <string>(); FileOperator fileoperator = new FileOperator(); if (Full) { pathToLogsFiles = Directory.GetFiles(fileoperator.pathToLogs[nrFS]).ToList(); } else { pathToLogsFiles = Directory.GetFiles(fileoperator.GetAllLocalCompositions()[nrFS], "Log.txt").ToList(); } bool flag = false; foreach (var item in pathToLogsFiles) { try { File.Delete(item); flag = true; } catch (Exception) { //MessageBox.Show("Error in DeleteLogs"); return(false); } } return(flag); }
public void DeleteCompo(int nrFS) // dziala { FileOperator fileoperator = new FileOperator(); List <string> listAllCompoLocal = fileoperator.GetAllLocalCompositions(); if (fileoperator.CheckIfCompositionIsAvailable(listAllCompoLocal, nrFS)) // sprawdzam czy wybrany fs Compo istnieje jezeli tak to usuwam kompozycje { Directory.Delete(listAllCompoLocal[nrFS], true); // usuwam wszystko try { File.Delete(listAllCompoLocal[nrFS] + ".exe"); } catch (Exception) { } } }
public bool getInformation_DB() { List <string> Kolumna = new List <string>(); try { if (SQLConnection != null) { MySqlCommand myCommand = new MySqlCommand("SELECT * FROM information", SQLConnection); MySqlDataReader myReader; myReader = myCommand.ExecuteReader(); myReader.Read(); string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); Kolumna.Add(myReader.GetString(0)); //update 1 = true Kolumna.Add(myReader.GetString(1)); // path update string Kolumna.Add(myReader.GetString(2)); // info 1 = true Kolumna.Add(myReader.GetString(3)); // information string Kolumna.Add(myReader.GetString(4)); // information version update Kolumna.Add(myReader.GetString(5)); // copyRecu Kolumna.Add(myReader.GetString(6)); // pcopySettings Kolumna.Add(myReader.GetString(7)); // copyUpdater Kolumna.Add(myReader.GetString(8)); // copyResources Kolumna.Add(myReader.GetString(9)); // copyImages myReader.Close(); string tmp = Kolumna[4]; //----------------------------------- int[] ver = new int[3]; // wersja z srvera int.TryParse(tmp[0].ToString(), out ver[0]); int.TryParse(tmp[2].ToString(), out ver[1]); int.TryParse(tmp[4].ToString(), out ver[2]); //----------------------------------------- //wersja apki int[] ver_apki = new int[3]; int.TryParse(version[0].ToString(), out ver_apki[0]); int.TryParse(version[2].ToString(), out ver_apki[1]); int.TryParse(version[4].ToString(), out ver_apki[2]); APPversion = version.ToString(); if ((APPversion == "3.1.0.0" || APPversion == "3.1.1.0") && System.IO.File.Exists(@"C:\Program Files\UltimateChanger\tmp.txt")) // w pozniejszej wersji do wywalenia { System.IO.File.Delete(@"C:\Program Files\UltimateChanger\tmp.txt"); try { Process.Start(@"C:\Program Files\UltimateChanger\UpdaterCopy.exe", @"\\10.128.3.1\DFS_data_SSC_FS_Images-SSC\PAZE\change_market\Multi_Changer\v_3.1.1\portable" + " false"); } catch (Exception) { try { Process.Start(@"C:\Program Files\UltimateChanger\UpdaterCopy.exe", @"\\demant.com\data\KBN\RnD\FS_Programs\Support_Tools\Ultimate_changer\v_3.1.1\portable" + " false"); } catch (Exception) { } } } if (APPversion == "3.0.2.0" && FileOperator.getCountUCRun() == "0") // dodać "i pierwszy start aplikacji" { try // usuwan stary { System.IO.File.Delete(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Ultimate Changer.lnk")); } catch (Exception) { } string shortcutLocation = System.IO.Path.Combine(@"C:\Program Files\UltimateChanger\", "shortcut Ultimate Changer" + ".lnk"); IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell(); IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutLocation); shortcut.Description = "Ultimate Changer"; // The description of the shortcut shortcut.IconLocation = @"C:\Program Files\UltimateChanger\icon.ico"; // The icon of the shortcut shortcut.TargetPath = @"C:\Program Files\UltimateChanger\Ultimate Changer.exe"; // The path of the file that will launch when the shortcut is run shortcut.WorkingDirectory = @"C:\Program Files\UltimateChanger"; shortcut.Save(); // Save the shortcut System.IO.File.Move(shortcutLocation, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Ultimate Changer.lnk")); } bool message = false; for (int i = 0; i < 3; i++) { if (ver_apki[i] < ver[i] && message == false) { //System.Windows.Forms.MessageBox.Show($"Update available: {Kolumna[1]}"); Window Update = new UpdateWindow(Kolumna[1], Kolumna[3], Kolumna[5], Kolumna[6], Kolumna[7], Kolumna[8], Kolumna[9]); Update.ShowDialog(); pathsToUpdate = Kolumna[1]; return(true); /// message = true; /*HATORI NARAZIE PODZIEKUJEMY*/ } } if (message) { return(true); } else { return(false); } } else { //SQLConnection.Close(); return(false); } } catch (Exception x) { System.Windows.MessageBox.Show(x.ToString()); //SQLConnection.Close(); return(false); } }