public static void SaveConfig() { using (FileStream fs = new FileStream(FILE_NAME, FileMode.Create, FileAccess.Write)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, data); LogPanel.Log(FILE_NAME + " Saved"); } }
private void OnThreadStop() { if (Config.data.shutdown) { System.Diagnostics.Process.Start("shutdown.exe", "-s -t 0"); LogPanel.Log("시스템 종료"); } SetButtonActive(); }
public static void LoadConfig() { try { using (FileStream fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read)) { BinaryFormatter bf = new BinaryFormatter(); data = bf.Deserialize(fs) as ConfigData; LogPanel.Log(FILE_NAME + " Loaded"); } } catch (Exception e) { Reset(); SaveConfig(); } }
private static Bitmap LoadImage(string path) { bool exists = File.Exists(path); #if SINGLE_COLOR_LOG LogPanel.LogNonReturn("Load[", Color.Black); LogPanel.LogNonReturn(exists, exists == false ? Color.Red : Color.Green); LogPanel.Log($"]: {path}\r\n"); #else LogPanel.Log($"Load[{exists}]: {path}\r\n", exists == false ? Color.Red : Color.Green); #endif if (!exists) { return(null); } else { return(new Bitmap(path)); } }
private void Form_Shown(object sender, EventArgs e) { string[] enum_names = Enum.GetNames(typeof(StudyState)); foreach (string name in enum_names) { comboBox_startState.Items.Add(name); } comboBox_startState.SelectedIndex = 0; m_logPanel = new LogPanel(textbox_logpanel); bool CMComplete; m_captureMachine = new CaptureMachine(out CMComplete); m_stateMachine = new StateMachine(m_captureMachine, threadStopEvent); Config.LoadConfig(); if (Config.data.start_IE) { Process.Start("iexplore.exe", "http://www.hakjum.com/"); } }
public static void Reset() { data = new ConfigData(); LogPanel.Log(FILE_NAME + " Initalized"); }
public LogPanel(RichTextBox textBox) { g_instance = this; this.m_textBox = textBox; fLog("log panel initalized\r\n", Color.Green); }