public override int GetHashCode()
        {
            int hash = 1;

            if (Active != false)
            {
                hash ^= Active.GetHashCode();
            }
            if (ChannelName.Length != 0)
            {
                hash ^= ChannelName.GetHashCode();
            }
            if (PluginsPath.Length != 0)
            {
                hash ^= PluginsPath.GetHashCode();
            }
            if (BuildAll != false)
            {
                hash ^= BuildAll.GetHashCode();
            }
            if (BuildMini != false)
            {
                hash ^= BuildMini.GetHashCode();
            }
            if (SelectIp != false)
            {
                hash ^= SelectIp.GetHashCode();
            }
            if (Debug != false)
            {
                hash ^= Debug.GetHashCode();
            }
            return(hash);
        }
예제 #2
0
        /// <summary>
        /// Adds the plugin xml config to the plugin class and sets status flags
        /// </summary>
        public void AddPluginFile(Plugin plugin, IPlugin pluginFile, string filePath)
        {
            //get the path info
            string pluginPath = Path.GetDirectoryName(filePath);
            string filename   = Path.GetFileName(filePath);

            //sort out backslashes as MakeRelativePath is fussy about these
            if (!PluginsPath.Trim().EndsWith(@"\"))
            {
                PluginsPath += @"\";
            }
            if (pluginPath.Trim().EndsWith(@"\"))
            {
                pluginPath.Remove(pluginPath.Length - 1, 1);
            }

            string relativePath = FileUtils.MakeRelativePath(PluginsPath, pluginPath);

            plugin.AddPluginFile(pluginFile, filename, pluginPath, relativePath);

            if (plugin.HasPluginFile)
            {
                //synch the name
                plugin.Name = plugin.PluginFile.Name;

                //remove any dot prefixes on the file extensions for consistency
                //with how file extensions are held
                for (int i = 0; i < plugin.PluginFile.FileExtensions.Length; i++)
                {
                    plugin.PluginFile.FileExtensions[i] = plugin.PluginFile.FileExtensions[i].TrimStart(new[] { '.' });
                }
            }
            else
            {
                if (String.IsNullOrEmpty(plugin.Name))
                {
                    plugin.Name = "Unknown";
                }
            }

            //set the status flags
            SetPluginStatus(plugin);
        }