예제 #1
0
        private void load()
        {
            Config_.Load();
            RefreshPrinters();

            counter = Properties.Settings.Default.counter;

            port_txt.Text = Properties.Settings.Default.Port.ToString();

            //  port_txt.Text= Properties.Settings.Default.port.ToString();
        }
예제 #2
0
        private void save()
        {
            Config_.Save();
            RefreshPrinters();
            Properties.Settings.Default.Port    = int.Parse(port_txt.Text);
            Properties.Settings.Default.counter = counter;

            //    Properties.Settings.Default.port = int.Parse(port_txt.Text);

            Properties.Settings.Default.Save();
        }
예제 #3
0
 public static void Save()
 {
     if (ReferenceEquals(Instance, null))
     {
         Instance = new Config_();
     }
     try
     {
         BinaryFormatter formatter = new BinaryFormatter();
         using (FileStream stream = File.Create(ConfigPath))
         {
             formatter.Serialize(stream, Instance);
             stream.Flush();
         }
     }
     catch
     {
     }
 }
예제 #4
0
 public static Config_ Load()
 {
     if (File.Exists(ConfigPath))
     {
         try
         {
             BinaryFormatter formatter = new BinaryFormatter();
             using (FileStream stream = new FileStream(ConfigPath, FileMode.Open))
             {
                 Instance = (Config_)formatter.Deserialize(stream);
             }
         }
         catch
         {
             Instance = new Config_();
         }
     }
     else
     {
         Instance = new Config_();
         return(Instance);
     }
     return(Instance);
 }