public void start() { Config = new Config420(this); Config.SaveConfig(); LogManage = new LoggerManager(this); ThreadManager.StartServerThread(this); Reader = new ReaderManage(this); Debug.Elapsed += cleanup; Debug.Start(); AppDomain.CurrentDomain.ProcessExit += OnProcessExit;// Si on ferme le serveur on appel la fonction Console.CancelKeyPress += OnProcessExit; while (!Stopped) { Log("Enter file_name.sql or Exit:"); string read = Console.ReadLine(); switch (read) { case "Exit": Log("Process kill"); ThreadManager.Stopped = true; ThreadManager.WaitForEnd(); LogManage.Stop = true; Stopped = true; break; default: Log("Start Reading Folder"); Reader.ProcesseFile(@".\" + read); Mem.EmptyWorkingSetFunction(); Mem.ClearFileSystemCache(false); break; } } }
public Form1() { AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); Config = new Config420(this); CheckUpdate(); AppDomain.CurrentDomain.ProcessExit += OnProcessExit;// Si on ferme le serveur on appel la fonction ThreadManager.StartServerThread(this); Reader.Init(this); Downloader = new DownloaderMain(this); Debug.Elapsed += (o, b) => { Mem.EmptyWorkingSetFunction(); Mem.ClearFileSystemCache(false); GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); }; Debug.Start(); InitializeComponent(); List <Object> ListObject = new List <object>(); foreach (GameMetaInfo info in Downloader.AllGameMeta.GameList.Values) { ListObject.Add(info.Label); } StepBarGUI = StepBar; DownloadBarGUI = DownloadBar; TextBoxGUI = TextBox; DownloadButtonUI = DownloadButton; ListGame.Items.AddRange(ListObject.ToArray()); }
internal void run(string[] args) { if (args.Length == 1) { Config420 config = new Config420(this); string link = config.Config().Api + "/launcher/"; string proccessename = args[0]; /* * Process.Start("taskkill", "/F /IM " + proccessename); * while (Process.GetProcessesByName(proccessename.Replace(".exe", "")).Length > 0) * Thread.Sleep(1); */ foreach (Process process in Process.GetProcessesByName(proccessename.Replace(".exe", ""))) { process.Kill(); process.WaitForExit(); } WebRequest request = WebRequest.Create(link); WebResponse response = request.GetResponse(); List <Task> Dl = new List <Task>(); using (var reader = new StreamReader(response.GetResponseStream())) { string result = reader.ReadToEnd(); foreach (string str in result.Split("<a href=\"")) { if (str.Split("\">")[0].Contains("Client")) { Dl.Add(DlFile(link, str.Split("\">")[0])); } } Task.WhenAll(Dl).Wait(); if (proccessename != "Client.exe") { if (File.Exists(Environment.CurrentDirectory + "\\" + proccessename)) { File.Delete(Environment.CurrentDirectory + "\\" + proccessename); } if (File.Exists(Environment.CurrentDirectory + "\\Client.exe")) { File.Move(Environment.CurrentDirectory + "\\Client.exe", Environment.CurrentDirectory + "\\" + proccessename); } } Process.Start(Environment.CurrentDirectory + "\\" + proccessename); /*if (matches.Count == 0) * { * Console.WriteLine("parse failed."); * return; * } * * foreach (Match match in matches) * { * if (!match.Success) { continue; } * * }*/ } } }