public int CompareTo(object obj)
 {
     if (obj is HotstringSimple)
     {
         HotstringSimple oth = (HotstringSimple)obj;
         return(this.Name.CompareTo(oth.Name));
     }
     return(1);
 }
Пример #2
0
        /// <summary>
        /// Populate the Class from an instace of <typeparamref name="root"/>
        /// </summary>
        /// <param name="r">The instance to read value from</param>
        protected void PopulateFromRoot(plugin r)
        {
            this.m_Enabled     = r.enabled;
            this.m_version     = r.version;
            this.m_ProfileName = r.profileName;
            this.m_MinVersion  = r.minVersion;

            if (r.commands != null)
            {
                foreach (var cmd in r.commands)
                {
                    CommandSimple cs = new CommandSimple(cmd);
                    if (string.IsNullOrEmpty(cs.Hotkey))
                    {
                        continue;
                    }
                    if (this.m_Commands.ContainsKey(cs.Hotkey))
                    {
                        continue;
                    }
                    cs.DataStateChanged += this.CommandDataStateEventHandler;
                    this.m_Commands.Add(cs.Hotkey, cs);
                }
            }
            if (r.hotstrings != null)
            {
                foreach (var hs in r.hotstrings)
                {
                    HotstringSimple hss = new HotstringSimple(hs);
                    if (string.IsNullOrEmpty(hs.trigger))
                    {
                        continue;
                    }
                    if (this.m_Hotstrings.ContainsKey(hs.trigger))
                    {
                        continue;
                    }
                    hss.DataStateChanged += this.HotStringDataStateEventHandler;
                    this.m_Hotstrings.Add(hss.Trigger, hss);
                }
            }
            if (r.includes != null)
            {
                foreach (var inc in r.includes)
                {
                    if (inc.commands != null)
                    {
                        foreach (var cmd in inc.commands)
                        {
                            includeCommand hsCmd = new includeCommand(cmd);

                            if (string.IsNullOrEmpty(cmd.hotkey))
                            {
                                continue;
                            }
                            if (this.m_IncCommands.ContainsKey(cmd.hotkey))
                            {
                                continue;
                            }
                            hsCmd.ParentInclude = inc;
                            this.m_IncCommands.Add(hsCmd.hotkey, hsCmd);
                        }
                    }
                    if (inc.hotstrings != null)
                    {
                        foreach (var hs in inc.hotstrings)
                        {
                            includeHotstring h = new includeHotstring(hs, r.File);
                            if (string.IsNullOrEmpty(hs.trigger))
                            {
                                continue;
                            }
                            if (this.m_IncHotstrings.ContainsKey(hs.trigger))
                            {
                                continue;
                            }
                            h.ParentInclude = inc;
                            this.m_IncHotstrings.Add(h.trigger, h);
                        }
                    }
                }
            }
        }