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");
     }
 }
Beispiel #2
0
        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();
     }
 }
Beispiel #4
0
        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));
            }
        }
 public static void Reset()
 {
     data = new ConfigData();
     LogPanel.Log(FILE_NAME + " Initalized");
 }