kiwidog

Rime Settings Example

Dec 7th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.32 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel;
  3. using Microsoft.Win32;
  4.  
  5. using Rime.Properties;
  6.  
  7. using DefaultSettings = Rime.Properties.Settings;
  8. namespace Rime.Core.Settings
  9. {
  10.     public class RimeSettings
  11.     {
  12.         // Rime Specific
  13.         private string m_CurrentDir = AppDomain.CurrentDomain.BaseDirectory;
  14.  
  15.         private static string CheckForBF3()
  16.         {
  17.             var s_Key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "");
  18.  
  19.             var s_SubKey = s_Key.OpenSubKey("Software\\EA Games\\Battlefield 3");
  20.  
  21.             return s_SubKey == null ? "" : s_SubKey.GetValue("Install Dir", "").ToString();
  22.         }
  23.  
  24.         public RimeSettings()
  25.         {
  26.            
  27.         }
  28.  
  29.         public void Save()
  30.         {
  31.             DefaultSettings.Default.Save();
  32.         }
  33.  
  34.         #region Rime Application Settings
  35.         [CategoryAttribute("Rime"),
  36.         DefaultValueAttribute(true)]
  37.         public bool SaveOnClose
  38.         {
  39.             get { return Properties.Settings.Default.SaveOnClose; }
  40.             set { Properties.Settings.Default.SaveOnClose = value; }
  41.         }
  42.  
  43.         [CategoryAttribute("Rime")]
  44.         public string GreetingText
  45.         {
  46.             get { return Properties.Settings.Default.GreetingText; }
  47.             set { Properties.Settings.Default.GreetingText = value; }
  48.         }
  49.  
  50.         [CategoryAttribute("Rime"),
  51.         DescriptionAttribute("Location of the dictionary database file.")]
  52.         public string DictionaryDb
  53.         {
  54.             get { return DefaultSettings.Default.DictionaryDb; }
  55.             set { DefaultSettings.Default.DictionaryDb = value; }
  56.         }
  57.  
  58.         [CategoryAttribute("Rime"),
  59.         DescriptionAttribute("Should the dictionary be auto-loaded on Rime startup.")]
  60.         public bool DictionaryAutoLoad
  61.         {
  62.             get { return DefaultSettings.Default.DictionaryAutoLoad; }
  63.             set { DefaultSettings.Default.DictionaryAutoLoad = value; }
  64.         }
  65.  
  66.         [CategoryAttribute("Rime"),
  67.         DescriptionAttribute("Should a check for a newer version be done on startup.")]
  68.         public bool CheckForUpdates
  69.         {
  70.             get { return DefaultSettings.Default.CheckForUpdates; }
  71.             set { DefaultSettings.Default.CheckForUpdates = value; }
  72.         }
  73.  
  74.         [CategoryAttribute("Rime"),
  75.         DescriptionAttribute("Should Rime connect to the site on startup.")]
  76.         public bool AutoLogin
  77.         {
  78.             get { return DefaultSettings.Default.AutoLogin; }
  79.             set { DefaultSettings.Default.AutoLogin = value; }
  80.         }
  81.         #endregion
  82.  
  83.         #region Reflection Settings
  84.         [CategoryAttribute("Reflection")]
  85.         public string ChunkDirectory
  86.         {
  87.             get { return Properties.Settings.Default.ChunkDirectory; }
  88.             set { Properties.Settings.Default.ChunkDirectory = value; }
  89.         }
  90.  
  91.         [CategoryAttribute("Reflection"),
  92.         DescriptionAttribute("Directory where exported data from this application will go.")]
  93.         public string ExportDirectory
  94.         {
  95.             get { return Properties.Settings.Default.ExportDirectory; }
  96.             set { Properties.Settings.Default.ExportDirectory = value; }
  97.         }
  98.         #endregion
  99.  
  100.         #region Game Client Settings
  101.         [CategoryAttribute("Game"),
  102.         DescriptionAttribute("The install directory of Battlefield 3\x99.")]
  103.         public string BattlefieldDirectory
  104.         {
  105.             get { return Properties.Settings.Default.BattlefieldRoot; }
  106.             set { Properties.Settings.Default.BattlefieldRoot = value; }
  107.         }
  108.         #endregion
  109.  
  110.         #region Map Signing Settings
  111.         [CategoryAttribute("Signing"),
  112.         DescriptionAttribute("Location of current crypto message.")]
  113.         public string CryptMessageLocation
  114.         {
  115.             get { return DefaultSettings.Default.CryptMessageLocation; }
  116.             set { DefaultSettings.Default.CryptMessageLocation = value; }
  117.         }
  118.  
  119.         [CategoryAttribute("Signing"),
  120.         DescriptionAttribute("Location of crypto public key.")]
  121.         public string CryptPublicKeyLocation
  122.         {
  123.             get { return DefaultSettings.Default.CryptPubKeyLocation; }
  124.             set { DefaultSettings.Default.CryptPubKeyLocation = value; }
  125.         }
  126.         #endregion
  127.     }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment