Exemplo n.º 1
0
        public HistoryEntry(string fileName)
        {
            this.iniFile = new MemIniFile(FileOperations.StripFileName(fileName));
            iniFile.Load();
            TranslationId = iniFile.ReadString("Settings", "TranslationId", string.Empty);

            if (!string.IsNullOrEmpty(TranslationId))
            {
                caption = SR.Keys.GetString(TranslationId);
            }
            else
            {
                caption = string.Empty;
            }

            if (string.IsNullOrEmpty(caption))
            {
                if (TextHelper.SameText(GlobalConfig.HomeCircleName, fileName))
                {
                    caption = SR.DefaultRingName;
                }
                else
                {
                    caption = Path.GetFileNameWithoutExtension(fileName);
                }
            }

            description = iniFile.ReadString("Settings", "Description", string.Empty);
            logoFile    = iniFile.ReadString("Settings", "Logo", string.Empty);
        }
Exemplo n.º 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
     {
     }
 }
Exemplo n.º 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
     {
     }
 }
Exemplo n.º 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();
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
     }
 }