예제 #1
0
 private void NamesForm_Load(object sender, EventArgs e)
 {
     settings = Settings.session;
     Text = "User Defined Names (" + settings.key + ")";
     textBox1.Text = "";
     textBox1.AppendText(toTextFormat(settings.serializeNames()));
     buttonApply.Enabled = false;
 }
예제 #2
0
 internal static SessionSettings get(string key, string processExe = null)
 {
     lock (classLock) {
         SessionSettings res;
         if (!cache.TryGetValue(key, out res))
         {
             res = new SessionSettings(key, processExe);
             res.tryLoad();
             cache[key] = res;
         }
         return(res);
     }
 }
예제 #3
0
 public void save()
 {
     lock (this) {
         if (selectedPages != null && selectedPagesDirty)
         {
             Properties.Settings.Default.selectedPages = Utils.getJsonSerializer().Serialize(selectedPages);
             selectedPagesDirty = false;
         }
         if (bannedWords != null && isBannedWordsDirty)
         {
             Properties.Settings.Default.bannedWords     = Utils.getJsonSerializer().Serialize(bannedWords.Keys);
             Properties.Settings.Default.bannedWordsKana = Utils.getJsonSerializer().Serialize(bannedWordsKana.Keys);
             isBannedWordsDirty = false;
         }
         if (selectedReadings != null && isSelectedReadingsDirty)
         {
             Properties.Settings.Default.selectedReadings = Utils.getJsonSerializer().Serialize(selectedReadings);
             isSelectedReadingsDirty = false;
         }
         Properties.Settings.Default.selectedTranslators = Utils.getJsonSerializer().Serialize(selectedTranslators);
         Properties.Settings.Default.Save();
         SessionSettings.saveAll();
     }
 }
예제 #4
0
 internal static void setDefaultSession()
 {
     cachedSessionSettings = SessionSettings.getDefault();
 }
예제 #5
0
 internal static void setCurrentSession(string exeName)
 {
     cachedSessionSettings = SessionSettings.getByExeName(exeName);
 }
예제 #6
0
 internal static SessionSettings get(string key, string processExe = null)
 {
     lock (classLock) {
         SessionSettings res;
         if (!cache.TryGetValue(key, out res)) {
             res = new SessionSettings(key, processExe);
             res.tryLoad();
             cache[key] = res;
         }
         return res;
     }
 }