예제 #1
0
 public AutomationOptionsInfo GetAutomationOptionsInfo()
 {
     if (_automation_options_info == null)
     {
         bool          is_monitoring   = true;
         bool          stop_monitoring = true;
         List <string> categories      = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "automation";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Count > 0)
                 {
                     string is_monitoring_name   = "monitoringEnabled";
                     string stop_monitoring_name = "stopMonitoringOnBattery";
                     if (keys.Contains(is_monitoring_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, is_monitoring_name, "true"), out is_monitoring);
                     }
                     if (keys.Contains(stop_monitoring_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, stop_monitoring_name, "true"), out stop_monitoring);
                     }
                 }
             }
         }
         _automation_options_info = new AutomationOptionsInfo(is_monitoring, stop_monitoring);
     }
     return(_automation_options_info);
 }
예제 #2
0
 public PluginInfo GetLoadablePlugins()
 {
     if (_plugin_info == null)
     {
         PluginInfo    plugin_info = new PluginInfo();
         List <string> categories  = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "plugins";
             if (categories.Contains(category))
             {
                 List <string> keys    = INIManipulator.GetKeys(_config_file, category);
                 int           key_len = keys.Count;
                 for (int i = 0; i < key_len; i++)
                 {
                     string name = keys[i];
                     bool   val  = false;
                     Boolean.TryParse(INIManipulator.GetValue(_config_file, category, name, "false"), out val);
                     plugin_info.Names.Add(name);
                     plugin_info.Enabled.Add(name, val);
                 }
                 keys = null;
             }
         }
         categories   = null;
         _plugin_info = plugin_info;
     }
     return(_plugin_info);
 }
예제 #3
0
        public void LoadSettings()
        {
            LoadDefaultCommands();
            List <PromptCommand> prompt_commands      = new List <PromptCommand>();
            List <string>        prompt_command_names = new List <string>();
            List <string>        categories           = INIManipulator.GetCategories(CommonInfo.ConfigFile);

            if (categories.Count > 0)
            {
                string category = Name;
                if (categories.Contains(category))
                {
                    List <string> keys    = INIManipulator.GetKeys(CommonInfo.ConfigFile, category);
                    int           key_len = keys.Count;
                    if (key_len > 1)
                    {
                        for (int i = 0; i < key_len; i += 3)
                        {
                            string name;
                            string path;
                            string arguments;
                            try
                            {
                                name      = INIManipulator.GetValue(CommonInfo.ConfigFile, category, keys[i], "");
                                path      = INIManipulator.GetValue(CommonInfo.ConfigFile, category, keys[i + 1], "");
                                arguments = INIManipulator.GetValue(CommonInfo.ConfigFile, category, keys[i + 2], "");
                                prompt_command_names.Add(name);
                                prompt_commands.Add(new PromptCommand(name, path, arguments));
                            }
                            catch (Exception)
                            {
                                return;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
            _prompt_command_names = prompt_command_names;
            _pompt_commands       = prompt_commands;
        }
예제 #4
0
 public DirInfo GetDirectories()
 {
     if (_directories == null)
     {
         List <string> directories = new List <string>();
         Dictionary <string, List <string> > extensions          = new Dictionary <string, List <string> >();
         Dictionary <string, bool>           indexSubdirectories = new Dictionary <string, bool>();
         Dictionary <string, bool>           includeDirectories  = new Dictionary <string, bool>();
         Dictionary <string, List <string> > plugins             = new Dictionary <string, List <string> >();
         List <string> categories = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "indexer";
             if (categories.Contains(category))
             {
                 List <string> keys    = INIManipulator.GetKeys(_config_file, category);
                 int           key_len = keys.Count;
                 if (key_len > 0)
                 {
                     for (int i = 0; i < key_len; i += 5)
                     {
                         string   name;
                         string[] exts;
                         bool     incdir = false;
                         bool     subdir = false;
                         string[] plugs;
                         try
                         {
                             name = INIManipulator.GetValue(_config_file, category, keys[i], "");
                             exts = StrToArray(INIManipulator.GetValue(_config_file, category, keys[i + 1], ".lnk"));
                             Boolean.TryParse(INIManipulator.GetValue(_config_file, category, keys[i + 2], "false"), out incdir);
                             Boolean.TryParse(INIManipulator.GetValue(_config_file, category, keys[i + 3], "false"), out subdir);
                             plugs = StrToArray(INIManipulator.GetValue(_config_file, category, keys[i + 4], ""));
                         }
                         catch (Exception)
                         {
                             break;
                         }
                         directories.Add(name);
                         extensions.Add(name, new List <string>(exts));
                         includeDirectories.Add(name, incdir);
                         indexSubdirectories.Add(name, subdir);
                         plugins.Add(name, new List <string>(plugs));
                     }
                 }
             }
         }
         _directories = new DirInfo(directories, extensions, includeDirectories, indexSubdirectories, plugins);
     }
     return(_directories);
 }
예제 #5
0
 public HotKey GetMainHotKey()
 {
     if (_hotkey == null)
     {
         int           key        = 32;
         bool          alt        = true;
         bool          ctrl       = true;
         bool          shift      = false;
         bool          win        = false;
         List <string> categories = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category            = "interaction";
             string hotkeyMainkey       = "hotkeyMainkey";
             string hotkeyModifierAlt   = "hotkeyModifierAlt";
             string hotkeyModifierCtrl  = "hotkeyModifierCtrl";
             string hotkeyModifierShift = "hotkeyModifierShift";
             string hotkeyModifierWin   = "hotkeyModifierWin";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Contains(hotkeyMainkey))
                 {
                     Int32.TryParse(INIManipulator.GetValue(_config_file, category, hotkeyMainkey, "32"), out key);
                 }
                 if (keys.Contains(hotkeyModifierAlt))
                 {
                     Boolean.TryParse(INIManipulator.GetValue(_config_file, category, hotkeyModifierAlt, "true"), out alt);
                 }
                 if (keys.Contains(hotkeyModifierCtrl))
                 {
                     Boolean.TryParse(INIManipulator.GetValue(_config_file, category, hotkeyModifierCtrl, "true"), out ctrl);
                 }
                 if (keys.Contains(hotkeyModifierShift))
                 {
                     Boolean.TryParse(INIManipulator.GetValue(_config_file, category, hotkeyModifierShift, "false"), out shift);
                 }
                 if (keys.Contains(hotkeyModifierWin))
                 {
                     Boolean.TryParse(INIManipulator.GetValue(_config_file, category, hotkeyModifierWin, "false"), out win);
                 }
             }
         }
         _hotkey = new HotKey(alt, ctrl, shift, win, (Keys)key);
     }
     return(_hotkey);
 }
예제 #6
0
 public SystemOptionsInfo GetSystemOptionsInfo()
 {
     if (_system_options_info == null)
     {
         int           update_time      = 20;
         bool          stop_auto_update = true;
         bool          auto_update      = true;
         List <string> categories       = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "system";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Count > 0)
                 {
                     string update_time_name      = "updateTime";
                     string stop_auto_update_name = "stopAutoUpdateOnBattery";
                     string auto_update_name      = "autoUpdate";
                     if (keys.Contains(update_time_name))
                     {
                         Int32.TryParse(INIManipulator.GetValue(_config_file, category, update_time_name, "20"), out update_time);
                     }
                     if (keys.Contains(stop_auto_update_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, stop_auto_update_name, "true"), out stop_auto_update);
                     }
                     if (keys.Contains(auto_update_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, auto_update_name, "true"), out auto_update);
                     }
                 }
             }
         }
         _system_options_info = new SystemOptionsInfo(update_time, stop_auto_update, auto_update);
     }
     return(_system_options_info);
 }
예제 #7
0
 public HotKey GetAssistantHotKey()
 {
     if (_ahotkey == null)
     {
         int           key        = 20;
         List <string> categories = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category           = "interaction";
             string hotkeyAssistantkey = "hotkeyAssistantkey";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Contains(hotkeyAssistantkey))
                 {
                     Int32.TryParse(INIManipulator.GetValue(_config_file, category, hotkeyAssistantkey, "20"), out key);
                 }
             }
         }
         _ahotkey = new HotKey(false, false, false, false, (Keys)key);
     }
     return(_ahotkey);
 }
예제 #8
0
 public InterfaceInfo GetInterfaceInfo()
 {
     if (_interface_info == null)
     {
         int           number_of_suggestions = 10;
         Point         location   = new Point(-1, -1);
         List <string> categories = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "interface";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Count > 0)
                 {
                     string number_of_suggestions_name = "suggestions";
                     string location_x_name            = "location_x";
                     string location_y_name            = "location_y";
                     if (keys.Contains(number_of_suggestions_name))
                     {
                         Int32.TryParse(INIManipulator.GetValue(_config_file, category, number_of_suggestions_name, "10"), out number_of_suggestions);
                     }
                     if (keys.Contains(location_x_name) && keys.Contains(location_y_name))
                     {
                         int x, y;
                         Int32.TryParse(INIManipulator.GetValue(_config_file, category, location_x_name, "-1"), out x);
                         Int32.TryParse(INIManipulator.GetValue(_config_file, category, location_y_name, "-1"), out y);
                         location.X = x;
                         location.Y = y;
                     }
                 }
             }
         }
         _interface_info = new InterfaceInfo(number_of_suggestions, location);
     }
     return(_interface_info);
 }