예제 #1
0
 protected void Dispose(bool disposing)
 {
     if (iniFile != null)
     {
         iniFile.Dispose();
     }
 }
예제 #2
0
 protected virtual void ReadConfiguration()
 {
     try
     {
         Random     rnd     = new Random();
         MemIniFile iniFile = new MemIniFile(settingFileName, true);
         iniFile.Load();
         Left = iniFile.ReadInteger("Settings", "Left", rnd.Next(0, PrimaryScreen.Bounds.Width - 96));
         Top  = iniFile.ReadInteger("Settings", "Top", rnd.Next(0, (int)((PrimaryScreen.Bounds.Height - 96) / 2)));
         OnLoadSettings(new IniFileAccessArgs(iniFile));
         iniFile.Dispose();
     }
     catch
     {
     }
 }
예제 #3
0
 protected virtual void SaveConfiguration()
 {
     try
     {
         MemIniFile iniFile = new MemIniFile(settingFileName);
         iniFile.Load();
         iniFile.WriteInteger("Settings", "Left", Left);
         iniFile.WriteInteger("Settings", "Top", Top);
         iniFile.WriteBool("Toy", "Enabled", ToyEnabled);
         OnSaveSettings(new IniFileAccessArgs(iniFile));
         iniFile.Save();
         iniFile.Dispose();
     }
     catch
     {
     }
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ToyAboutBox"/> class.
        /// </summary>
        public ToyAboutBox(string configFileName)
        {
            MemIniFile iniFile = new MemIniFile(configFileName);

            iniFile.Load();

            window = new AboutWindow();
            window.TopMostWindow = true;
            window.KeyDown      += new System.Windows.Forms.KeyEventHandler(window_KeyDown);
            window.MouseClick   += new System.Windows.Forms.MouseEventHandler(window_MouseClick);
            window.BigIcon       = Path.Combine(Path.GetDirectoryName(configFileName), iniFile.ReadString("Toy", "Icon"));
            window.Copyright     = iniFile.ReadString("Toy", "Copyright");
            window.Author        = "Author: " + iniFile.ReadString("Toy", "Author");
            window.Version       = "Version: " + iniFile.ReadString("Toy", "Version");
            window.Description   = iniFile.ReadString("Toy", "Description");
            window.AboutText     = iniFile.ReadString("Toy", "AboutText");
            iniFile.Dispose();
        }
예제 #5
0
        private void Load()
        {
            try
            {
                iniFile = new MemIniFile(FileName);
                try
                {
                    iniFile.Load();
                    LoadIniFileData();
                }
                finally
                {
                    iniFile.Dispose();
                    iniFile = null;
                }

                LoadLogo(logoFile);
            }
            catch (Exception ex)
            {
                TraceDebug.Trace(ex);
            }
        }
예제 #6
0
 public void Save()
 {
     if (iniFile == null)
     {
         iniFile = new MemIniFile(FileName);
         try
         {
             iniFile.Load();
             iniFile.WriteString("Settings", "Description", Description);
             iniFile.WriteString("Settings", "Logo", logoFile);
             iniFile.Save();
         }
         finally
         {
             iniFile.Dispose();
         }
     }
     else
     {
         iniFile.WriteString("Settings", "Description", Description);
         iniFile.WriteString("Settings", "Logo", logoFile);
         iniFile.Save();
     }
 }