예제 #1
0
        private StepConfigurationBase GetStepConfiguration(Guid designerItemId, ModuleDescription itemModuleDescription, Package package)
        {
            StepConfigurationBase configuration = package.Configurations.Where(t => t.ConfigurationId == designerItemId).FirstOrDefault() as StepConfigurationBase;

            if (configuration == null)
            {
                configuration = Activator.CreateInstance(itemModuleDescription.Attributes.ConfigurationType) as StepConfigurationBase;
                configuration.ConfigurationId = designerItemId;
                package.Configurations.Add(configuration);
            }

            return(configuration);
        }
 private void ddConnectionTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.newConfiguration)
     {
         ModuleDescription moduleDescription = ((ComboBox)sender).SelectedItem as ModuleDescription;
         if (moduleDescription != null)
         {
             this.ConnectionConfiguration = Activator.CreateInstance(moduleDescription.Attributes.ConfigurationType) as ConnectionConfigurationBase;
             this.ConnectionConfiguration.ModuleDescription = this.modules.Where(t => t.Attributes.ConfigurationType == this.ConnectionConfiguration.GetType()).First();
             SetModule();
         }
     }
 }
예제 #3
0
 void RegisterAssemblyResolvePaths(RuntimeAddin addin, ModuleDescription description)
 {
     lock (LocalLock) {
         foreach (var asm in description.AssemblyNames)
         {
             // TODO: This assertion seems to break add-in registration
             // Commenting it out allows add-in registration to work again,
             // but it likely indicates a deeper problem. Investigate.
             // Debug.Assert(assemblyResolvePaths[asm] == addin);
             assemblyResolvePaths[asm] = addin;
         }
     }
 }
        public void ModuleFiles()
        {
            ModuleDescription mod = desc.OptionalModules [0];

            Assert.AreEqual(2, mod.AllFiles.Count);
            Assert.IsTrue(mod.AllFiles.Contains("UnitTestsModule.dll"));
            Assert.IsTrue(mod.AllFiles.Contains("FileModule"));

            Assert.AreEqual(1, mod.DataFiles.Count);
            Assert.IsTrue(mod.DataFiles.Contains("FileModule"));

            Assert.AreEqual(1, mod.Assemblies.Count);
            Assert.IsTrue(mod.Assemblies.Contains("UnitTestsModule.dll"));
        }
예제 #5
0
 private bool IsPolarized(ModuleDescription md)
 {
     foreach (LAYER Layer in md.m_Effects.Keys)
     {
         foreach (EFFECT Effect in md.m_Effects[Layer].Keys)
         {
             if (Effect == EFFECT.POLARIZED)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #6
0
 bool CheckOptionalAddinDependencies(AddinDescription conf, ModuleDescription module)
 {
     foreach (Dependency dep in module.Dependencies)
     {
         AddinDependency pdep = dep as AddinDependency;
         if (pdep != null)
         {
             Addin pinfo = AddinManager.Registry.GetAddin(Addin.GetFullId(conf.Namespace, pdep.AddinId, pdep.Version));
             if (pinfo == null || !pinfo.Enabled)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #7
0
        internal RuntimeAddin GetModule(ModuleDescription module)
        {
            // If requesting the root module, return this
            if (module == module.ParentAddinDescription.MainModule)
            {
                return(this);
            }

            if (module.RuntimeAddin != null)
            {
                return(module.RuntimeAddin);
            }

            RuntimeAddin addin = new RuntimeAddin(addinEngine, this, module);

            return(addin);
        }
예제 #8
0
        void GetAddinExtensions(ModuleDescription module, string addinId, ExtensionPoint ep, ref ExtensionLoadData data)
        {
            string basePath = ep.Path + "/";

            foreach (Extension extension in module.Extensions)
            {
                if (extension.Path == ep.Path || extension.Path.StartsWith(basePath))
                {
                    if (data == null)
                    {
                        data            = new ExtensionLoadData();
                        data.AddinId    = addinId;
                        data.Extensions = new ArrayList();
                    }
                    data.Extensions.Add(extension);
                }
            }
        }
예제 #9
0
        void LoadModule(ModuleDescription module, string ns, ArrayList plugList, ArrayList asmList)
        {
            // Load the assemblies
            foreach (string s in module.Assemblies)
            {
                asmList.Add(Assembly.LoadFrom(Path.Combine(baseDirectory, s)));
            }

            // Collect dependent ids
            foreach (Dependency dep in module.Dependencies)
            {
                AddinDependency pdep = dep as AddinDependency;
                if (pdep != null)
                {
                    plugList.Add(AddinManager.SessionService.GetAddin(Addin.GetFullId(ns, pdep.AddinId, pdep.Version)));
                }
            }
        }
예제 #10
0
        // ==============================================================================================================

        private void DoAddMoreModules(IReadOnlyCollection <int> ModuleTypeIDs)
        {
            Dictionary <int,uint> NewModules = new Dictionary <int,uint>();

            foreach (int ModuleTypeID in ModuleTypeIDs)
            {
                if (NewModules.ContainsKey(ModuleTypeID))
                {
                    NewModules[ModuleTypeID]++;
                }
                else
                {
                    NewModules[ModuleTypeID] = 1;
                }
            }
            foreach (KeyValuePair <int,uint> kvp in NewModules)
            {
                int  ModuleTypeID = kvp.Key;
                uint ModuleCount  = kvp.Value;
                int  Index        = -1;
                bool Ok           = ModuleTypeIDToIndex.TryGetValue(ModuleTypeID,out Index);
                Debug.Assert(Ok && Index >= 0);
                ModuleDescription MD = ModuleDescriptions[Index];
                if (m_Fit[MD.m_Slot].ContainsKey(ModuleTypeID))
                {
                    m_Fit[MD.m_Slot][ModuleTypeID] = Math.Max(m_Fit[MD.m_Slot][ModuleTypeID],ModuleCount);
                }
                else
                {
                    m_Fit[MD.m_Slot][ModuleTypeID] = ModuleCount;
                }
            }

            if (m_ShipTypeID > 0)
            {
                int Index = -1;
                if (ShipTypeIDToIndex.TryGetValue(ShipTypeID,out Index))
                {
                    ShipDescription SD = ShipDescriptions[Index];
                    // recalc slot layout for t3 cruisers
                    RecalcStategicCruiserSlotLayout(SD);
                }
            }
        }
예제 #11
0
        void LoadModule(ModuleDescription module)
        {
            // Load the assemblies
            for (int i = 0; i < module.Assemblies.Count; ++i)
            {
                if (loadedAssemblies.TryGetValue(module.AssemblyNames[i], out var asm))
                {
                    continue;
                }

                // Backwards compat: Load all the addins on demand if an assembly name
                // is not supplied for the type.

                // don't load the assembly if it's already loaded
                string asmPath = GetFilePath(module.Assemblies[i]);
                foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    // Sorry, you can't load addins from
                    // dynamic assemblies as get_Location
                    // throws a NotSupportedException
                    if (a is System.Reflection.Emit.AssemblyBuilder || a.IsDynamic)
                    {
                        continue;
                    }

                    try {
                        if (a.Location == asmPath)
                        {
                            asm = a;
                            break;
                        }
                    } catch (NotSupportedException) {
                        // Some assemblies don't have a location
                    }
                }

                if (asm == null)
                {
                    asm = Assembly.LoadFrom(asmPath);
                }

                RegisterAssemblyLoad(module.AssemblyNames[i], asm);
            }
        }
예제 #12
0
        void LoadModule(ModuleDescription module, ArrayList asmList)
        {
            // Load the assemblies
            foreach (string s in module.Assemblies)
            {
                Assembly asm = null;

                // don't load the assembly if it's already loaded
                string asmPath = Path.Combine(baseDirectory, s);
                foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    // Sorry, you can't load addins from
                    // dynamic assemblies as get_Location
                    // throws a NotSupportedException
#if NUNIT
                    if (a is System.Reflection.Emit.AssemblyBuilder)
#else
                    if (a is System.Reflection.Emit.AssemblyBuilder || a.IsDynamic)
                    {
#endif
                    {
                        continue;
                    }

                    try {
                        if (a.Location == asmPath)
                        {
                            asm = a;
                            break;
                        }
                    } catch (NotSupportedException) {
                        // Some assemblies don't have a location
                    }
                }

                if (asm == null)
                {
                    asm = Assembly.LoadFrom(asmPath);
                }

                asmList.Add(asm);
            }
        }
예제 #13
0
        internal AddinDescription Load(Addin iad)
        {
            ainfo = iad;

            AddinDescription description = iad.Description;

            id                  = description.AddinId;
            baseDirectory       = description.BasePath;
            module              = description.MainModule;
            module.RuntimeAddin = this;

            // Load the assemblies
            if (description.Localizer != null)
            {
                string cls = description.Localizer.GetAttribute("type");

                // First try getting one of the stock localizers. If none of found try getting the type.
                // They are not encoded as an assembly qualified name
                object fob = null;
                if (cls.IndexOf(',') == -1)
                {
                    Type t = GetType().Assembly.GetType("Hyena.Addins.Localization." + cls + "Localizer", false);
                    if (t != null)
                    {
                        fob = Activator.CreateInstance(t);
                    }
                }

                if (fob == null)
                {
                    fob = CreateInstance(cls, true);
                }

                IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory;
                if (factory == null)
                {
                    throw new InvalidOperationException("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory");
                }
                localizer = new AddinLocalizer(factory.CreateLocalizer(this, description.Localizer));
            }

            return(description);
        }
예제 #14
0
 bool CheckAddinDependencies(ModuleDescription module, bool forceLoadAssemblies)
 {
     foreach (Dependency dep in module.Dependencies)
     {
         AddinDependency pdep = dep as AddinDependency;
         if (pdep == null)
         {
             continue;
         }
         if (!addinEngine.IsAddinLoaded(pdep.FullAddinId))
         {
             return(false);
         }
         if (forceLoadAssemblies)
         {
             addinEngine.GetAddin(pdep.FullAddinId).EnsureAssembliesLoaded();
         }
     }
     return(true);
 }
예제 #15
0
 public void RegisterExtension(AddinDescription description, ModuleDescription module, Extension extension)
 {
     if (extension.Path.StartsWith("$"))
     {
         UnresolvedObjectTypeExtension extData = new UnresolvedObjectTypeExtension();
         extData.Description       = description;
         extData.ModuleDescription = module;
         extData.Extension         = extension;
         string[] objectTypes = extension.Path.Substring(1).Split(',');
         foreach (string s in objectTypes)
         {
             ArrayList list = (ArrayList)objectTypeExtensions [s];
             if (list == null)
             {
                 list = new ArrayList();
                 objectTypeExtensions [s] = list;
             }
             list.Add(extData);
         }
     }
 }
예제 #16
0
    public void ShowSelectPrefabs(RadialMenuAction type, Action <Module> modulePrefabSelected)
    {
        GetComponent <Image> ().enabled = true;
        ModuleDescription[] moduleDescriptions = modules [type];

        for (int i = 0; i < moduleDescriptions.GetLength(0); i++)
        {
            ModuleDescription descPrefab = moduleDescriptions [i];

            ModuleDescription description = Instantiate(descPrefab);
            description.transform.SetParent(transform, false);
            description.transform.Translate(Vector3.right * i * 100f);
            description.GetComponent <Button>().onClick.AddListener(() => {
                foreach (Transform child in transform)
                {
                    DestroyImmediate(child.gameObject);
                }
                GetComponent <Image> ().enabled = false;
                modulePrefabSelected(description.modulePrefab);
            });
        }
    }
예제 #17
0
        public void LoadModules(string pathToLoadModuleFrom)
        {
            if (Directory.Exists(pathToLoadModuleFrom) == false)
            {
                return;
            }

            string [] filesInModulePath = Directory.GetFiles(pathToLoadModuleFrom);
            foreach (string file in filesInModulePath.Where(t => t.EndsWith(".dll") && t.ToLower().Contains("microsoft") == false))
            {
                Assembly    assembly          = Assembly.LoadFrom(new FileInfo(file).FullName);
                List <Type> modulesInAssembly = GetTypesByInterface <IModule>(assembly);
                foreach (Type type in modulesInAssembly)
                {
                    ModuleDescription moduleDescription = new ModuleDescription();
                    moduleDescription.Attributes = (ModuleAttributeBase)type.GetCustomAttribute(typeof(ModuleAttributeBase));
                    moduleDescription.ModuleType = type;

                    this.Modules.Add(moduleDescription);
                }
            }
        }
예제 #18
0
        internal AddinDescription Load(Addin iad)
        {
            ainfo = iad;

            AddinDescription description = iad.Description;

            id                  = description.AddinId;
            baseDirectory       = description.BasePath;
            module              = description.MainModule;
            module.RuntimeAddin = this;

            if (description.Localizer != null)
            {
                string cls = description.Localizer.GetAttribute("type");

                // First try getting one of the stock localizers. If none of found try getting the type.
                object fob = null;
                Type   t   = Type.GetType("Mono.Addins.Localization." + cls + "Localizer, " + GetType().Assembly.FullName, false);
                if (t != null)
                {
                    fob = Activator.CreateInstance(t);
                }

                if (fob == null)
                {
                    fob = CreateInstance(cls, true);
                }

                IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory;
                if (factory == null)
                {
                    throw new InvalidOperationException("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory");
                }
                localizer = new AddinLocalizer(factory.CreateLocalizer(this, description.Localizer));
            }

            return(description);
        }
예제 #19
0
        public void RegisterExtension(AddinDescription description, ModuleDescription module, string path)
        {
            List <RootExtensionPoint> extensions;

            if (!pathHash.TryGetValue(path, out extensions))
            {
                // Root add-in extension points are registered before any other kind of extension,
                // so we should find it now.
                extensions = GetParentExtensionInfo(path);
            }
            if (extensions == null)
            {
                monitor.ReportWarning("The add-in '" + description.AddinId + "' is trying to extend '" + path + "', but there isn't any add-in defining this extension point");
                return;
            }

            bool found = false;

            foreach (RootExtensionPoint einfo in extensions)
            {
                if (IsAddinCompatible(einfo.Description, description, module))
                {
                    if (!einfo.ExtensionPoint.Addins.Contains(description.AddinId))
                    {
                        einfo.ExtensionPoint.Addins.Add(description.AddinId);
                    }
                    found = true;
                    if (monitor.LogLevel > 2)
                    {
                        monitor.Log("  * " + einfo.Description.AddinId + "(" + einfo.Description.Domain + ") <- " + path);
                    }
                }
            }
            if (!found)
            {
                monitor.ReportWarning("The add-in '" + description.AddinId + "' is trying to extend '" + path + "', but there isn't any compatible add-in defining this extension point");
            }
        }
예제 #20
0
        public override void Initialize(XElement elem)
        {
            if (elem.Name.Name == "Addin")
            {
                module = this.AddinDescription.MainModule;
            }
            XElement pe = elem.Parent as XElement;

            if (pe != null)
            {
                int   n  = 0;
                XNode ob = pe.FirstChild;
                while (ob != null)
                {
                    if (ob == elem)
                    {
                        module = this.AddinDescription.OptionalModules [n];
                        break;
                    }
                    ob = ob.NextSibling;
                }
            }
        }
예제 #21
0
        private static ModuleDescription CreateAbyssalModule(string ModuleName, string[] MarketGroups, MODULE_ATTRIBUTES_DB dbAttribute, float bonus, MODULE_ATTRIBUTES attribute, MODULE_SLOT slot, NpgsqlConnection conn)
        {
            int   typeID = GetTypeIDByName(ModuleName, conn);
            float value  = GetMaxAttributeValueForMarketGroup(MarketGroups, dbAttribute, conn);
            Dictionary <MODULE_ATTRIBUTES, Dictionary <MODULE_ACTIVE, Tuple <float, int> > > attributes = new Dictionary <MODULE_ATTRIBUTES, Dictionary <MODULE_ACTIVE, Tuple <float, int> > >();

            attributes.Add(
                attribute,
                new Dictionary <MODULE_ACTIVE, Tuple <float, int> > {
                { MODULE_ACTIVE.PASSIVE, new Tuple <float, int>(value * bonus, 1) }
            }
                );
            ModuleDescription result = new ModuleDescription(
                ModuleName,
                typeID,
                slot,
                attributes,
                0.0f,
                -1
                );

            return(result);
        }
        public override void DeleteMultipleItems()
        {
            string msg = GettextCatalog.GetString("The following extensions and all the nodes they contain will be deleted:") + "\n\n";

            foreach (var nav in CurrentNodes)
            {
                msg += Util.GetDisplayName((Extension)nav.DataItem) + "\n";
            }
            if (MessageService.Confirm(GettextCatalog.GetString("Are you sure you want to delete the selected extensions?"), msg, AlertButton.Delete))
            {
                foreach (var nav in CurrentNodes)
                {
                    Extension         ex     = (Extension)nav.DataItem;
                    ModuleDescription module = (ModuleDescription)ex.Parent;
                    module.Extensions.Remove(ex);
                }
            }
            DotNetProject p     = (DotNetProject)CurrentNode.GetParentDataItem(typeof(Project), false);
            AddinData     adata = p.GetAddinData();

            adata.SaveAddinManifest();
            adata.NotifyChanged(false);
        }
예제 #23
0
        private void logMenu_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (logMenu.SelectedItem != null)
            {
                TreeViewItem menuItem = logMenu.SelectedItem as TreeViewItem;
                ItemLog      itemLog  = menuItem.Tag as ItemLog;

                this.LogLeader.Visibility = System.Windows.Visibility.Visible;
                this.LogLeader.SetItemLog(itemLog);
                this.LogLeader.SetDetailedLogVisibility(Visibility.Hidden);

                if (itemLog.ExecutionSuccessful)
                {
                    ModuleDescription moduleDescription = moduleDescriptions.Where(t => t.ModuleType.Name == itemLog.ModuleDescriptionName).FirstOrDefault();
                    ILogRendering     module            = Activator.CreateInstance(moduleDescription.ModuleType) as ILogRendering;
                    if (module != null)
                    {
                        string        databaseName  = itemLog.DesignerItemId.ToString() + "_" + itemLog.DesignerItemDisplayName.ToString().Replace(" ", "_") + ".db";
                        SqliteWrapper sqliteWrapper = new SqliteWrapper(runLog.RunLogPath, databaseName);

                        this.LogLeader.SetDetailedLogVisibility(Visibility.Visible);
                        logContent.Content = module.RenderLogWindow(sqliteWrapper);
                    }
                    else
                    {
                        logContent.Content = null;
                    }
                }
                else
                {
                    MessageControl messageControl = new MessageControl("Unexpected error occurred", itemLog.ExecutionError); // TODO Show execution error in logcontent
                    messageControl.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                    messageControl.SetMessageHeight(800);
                    logContent.Content = messageControl;
                }
            }
        }
예제 #24
0
	protected void Page_Load(object sender, EventArgs e)
	{
		Title = GetMessage("TableTitleModules");
		MasterTitle = GetMessage("TableTitleModules");
		List<ModuleDescription> modules = new List<ModuleDescription>();

		foreach (BXModuleConfig module in BXModuleManager.AllModules)
		{
			ModuleDescription desc = new ModuleDescription();
			desc.Id = module.ModuleId;
			desc.IsValid = Bitrix.Activation.LicenseManager.IsViolating(desc.Id);
			desc.IsInstalled = module.Installed;
			desc.NameHtml = Encode(BXLoc.GetModuleMessage(module.ModuleId, "Module.Name", true) ?? string.Format(GetMessageRaw("Module"), module.ModuleId));
			if (desc.IsValid && desc.IsInstalled)
				desc.NameHtml = string.Concat(@"<span style=""color:red"">", desc.NameHtml, @"</span>");
			desc.Description = BXLoc.GetModuleMessage(module.ModuleId, "Module.Description", true) ?? "---";
			desc.Version = module.Version;
			if (desc.IsInstalled)
				desc.Description = BXModuleManager.GetModule(module.ModuleId).Description;
			
			modules.Add(desc);
		}

		modules.Sort(delegate(ModuleDescription a, ModuleDescription b)
		{
			int aRank = string.Equals(a.Id, "main", StringComparison.OrdinalIgnoreCase) ? 0 : 1;
			int bRank = string.Equals(b.Id, "main", StringComparison.OrdinalIgnoreCase) ? 0 : 1;
			int result = aRank.CompareTo(bRank);
			if (result == 0)
				result = string.Compare(a.Id, b.Id, true);
			return result;
		});

		GridView.DataSource = modules;
		GridView.DataBind();
	}
예제 #25
0
 internal void SetData(AddinEngine addinEngine, string plugid, ExtensionNodeType nodeType, ModuleDescription module)
 {
     this.addinEngine = addinEngine;
     this.addinId     = plugid;
     this.nodeType    = nodeType;
     this.module      = module;
 }
        private static object GetContentItem(Style itemStyle, Style itemControlTemplateStyle, ModuleDescription module)
        {
            System.Windows.Shapes.Path path = new System.Windows.Shapes.Path {
                ToolTip = module.Attributes.DisplayName
            };
            path.Style = itemStyle;
            var processElement = new FrameworkElementFactory(typeof(System.Windows.Shapes.Path));

            processElement.SetValue(StyleProperty, itemControlTemplateStyle);
            ControlTemplate controlTemplate = new ControlTemplate();

            controlTemplate.VisualTree = processElement;
            path.SetValue(DesignerItem.DragThumbTemplateProperty, controlTemplate);
            path.Tag = module;

            return(path);
        }
예제 #27
0
        public System.Windows.Shapes.Path GetContent(string itemStyle, string itemControlTemplateStyle, ModuleDescription module)
        {
            System.Windows.Shapes.Path path = new System.Windows.Shapes.Path {
                ToolTip = module.Attributes.DisplayName
            };
            path.Style = (Style)FindResource(itemStyle);
            var processElement = new FrameworkElementFactory(typeof(System.Windows.Shapes.Path));

            processElement.SetValue(StyleProperty, (Style)FindResource(itemControlTemplateStyle));
            ControlTemplate controlTemplate = new ControlTemplate();

            controlTemplate.VisualTree = processElement;
            path.SetValue(DesignerItem.DragThumbTemplateProperty, controlTemplate);
            path.Tag = module;
            return(path);
        }
예제 #28
0
        /// <summary>
        /// Save the server to the database.  The server is assumed to be
        /// locked.
        /// </summary>
        /// <returns>True if the save was successful.</returns>
        public bool Save()
        {
            if (MasterServer.ConnectionString == null)
            {
                return(false);
            }

            try
            {
                if (ModuleName == null)
                {
                    ModuleName = "";
                }

                if (ServerName == null)
                {
                    ServerName = "";
                }

                if (ModuleDescription == null)
                {
                    ModuleDescription = "";
                }

                if (ModuleUrl == null)
                {
                    ModuleUrl = "";
                }

                if (PWCUrl == null)
                {
                    PWCUrl = "";
                }

                if (ServerDescription == null)
                {
                    ServerDescription = "";
                }

                string Query = String.Format(
                    @"INSERT INTO `game_servers` (
    `game_server_id`,
    `product_id`,
    `expansions_mask`,
    `build_number`,
    `module_name`,
    `server_name`,
    `active_player_count`,
    `maximum_player_count`,
    `local_vault`,
    `last_heartbeat`,
    `server_address`,
    `online`,
    `private_server`,
    `module_description`,
    `module_url`,
    `game_type`,
    `minimum_level`,
    `maximum_level`,
    `pvp_level`,
    `player_pause`,
    `one_party_only`,
    `elc_enforced`,
    `ilr_enforced`,
    `pwc_url`,
    `server_description`)
VALUES (
    {0},
    {1},
    {2},
    {3},
    '{4}',
    '{5}',
    {6},
    {7},
    {8},
    '{9}',
    '{10}',
    {11},
    {12},
    '{13}',
    '{14}',
    {15},
    {16},
    {17},
    {18},
    {19},
    {20},
    {21},
    {22},
    '{23}',
    '{24}')
ON DUPLICATE KEY UPDATE 
    `expansions_mask` = {2},
    `build_number` = {3},
    `module_name` = '{4}',
    `server_name` = '{5}',
    `active_player_count` = {6},
    `maximum_player_count` = {7},
    `local_vault` = {8},
    `last_heartbeat` = '{9}',
    `server_address` = '{10}',
    `online` = {11},
    `private_server` = {12},
    `module_description` = '{13}',
    `module_url` = '{14}',
    `game_type` = {15},
    `minimum_level` = {16},
    `maximum_level` = {17},
    `pvp_level` = {18},
    `player_pause` = {19},
    `one_party_only` = {20},
    `elc_enforced` = {21},
    `ilr_enforced` = {22},
    `pwc_url` = '{23}',
    `server_description` = '{24}'",
                    DatabaseId,
                    MasterServer.ProductID,
                    ExpansionsMask,
                    BuildNumber,
                    MySqlHelper.EscapeString(ModuleName.Length > 32 ? ModuleName.Substring(0, 32) : ModuleName),
                    MySqlHelper.EscapeString(ServerName.Length > 256 ? ServerName.Substring(0, 256) : ServerName),
                    ActivePlayerCount,
                    MaximumPlayerCount,
                    LocalVault,
                    MasterServer.DateToSQLDate(LastHeartbeat),
                    MySqlHelper.EscapeString(ServerAddress.ToString()),
                    Online,
                    PrivateServer,
                    MySqlHelper.EscapeString(ModuleDescription.Length > 256 ? ModuleDescription.Substring(0, 256) : ModuleDescription),
                    MySqlHelper.EscapeString(ModuleUrl.Length > 256 ? ModuleUrl.Substring(0, 256) : ModuleUrl),
                    GameType,
                    MinimumLevel,
                    MaximumLevel,
                    PVPLevel,
                    PlayerPause,
                    OnePartyOnly,
                    ELCEnforced,
                    ILREnforced,
                    MySqlHelper.EscapeString(PWCUrl.Length > 256 ? PWCUrl.Substring(0, 256) : PWCUrl),
                    MySqlHelper.EscapeString(ServerDescription.Length > 256 ? ServerDescription.Substring(0, 256) : ServerDescription)
                    );

                MasterServer.ExecuteQueryNoReaderCombine(Query);

                LastSaveTick = (uint)Environment.TickCount;
            }
            catch (Exception e)
            {
                Logger.Log(LogLevel.Error, "NWGameServer.Save(): Failed to save server {0}: Exception: {1}",
                           ServerAddress,
                           e);
                return(false);
            }

            return(true);
        }
예제 #29
0
        IEnumerable GetExtensionInfo(Hashtable hash, string path, AddinDescription description, ModuleDescription module, bool lookInParents)
        {
            ArrayList list = new ArrayList();

            object data = hash [path];

            if (data == null && lookInParents)
            {
                // Root add-in extension points are registered before any other kind of extension,
                // so we should find it now.
                data = GetParentExtensionInfo(path);
            }

            if (data is ArrayList)
            {
                // Extension point which belongs to a root assembly.
                list.AddRange(GetRootExtensionInfo(hash, path, description, module, (ArrayList)data));
            }
            else
            {
                ExtensionPoint info = (ExtensionPoint)data;
                if (info == null)
                {
                    info        = new ExtensionPoint();
                    info.Path   = path;
                    hash [path] = info;
                }
                list.Add(info);
            }
            return(list);
        }
예제 #30
0
        ArrayList GetRootExtensionInfo(Hashtable hash, string path, AddinDescription description, ModuleDescription module, ArrayList rootExtensionPoints)
        {
            ArrayList list = new ArrayList();

            foreach (RootExtensionPoint rep in rootExtensionPoints)
            {
                // Find an extension point defined in a root add-in which is compatible with the version of the extender dependency
                if (IsAddinCompatible(rep.Description, description, module))
                {
                    list.Add(rep.ExtensionPoint);
                }
            }
            return(list);
        }
예제 #31
0
파일: Vlc.cs 프로젝트: 19871010/xZune.Vlc
 /// <summary>
 /// 释放 <see cref="ModuleDescription"/> 的资源,实际上我们更推荐使用 <see cref="ModuleDescription.Dispose"/> 方法释放
 /// </summary>
 public static void ReleaseModuleDescription(ModuleDescription moduleDescription)
 {
     _releaseLibVlcModuleDescriptionFunction.Delegate(moduleDescription.Pointer);
 }
예제 #32
0
        bool IsAddinCompatible(AddinDescription installedDescription, AddinDescription description, ModuleDescription module)
        {
            string addinId         = Addin.GetFullId(installedDescription.Namespace, installedDescription.LocalId, null);
            string requiredVersion = null;

            for (int n = module.Dependencies.Count - 1; n >= 0; n--)
            {
                AddinDependency adep = module.Dependencies [n] as AddinDependency;
                if (adep != null && Addin.GetFullId(description.Namespace, adep.AddinId, null) == addinId)
                {
                    requiredVersion = adep.Version;
                    break;
                }
            }
            if (requiredVersion == null)
            {
                return(false);
            }

            // Check if the required version is between rep.Description.CompatVersion and rep.Description.Version
            if (Addin.CompareVersions(installedDescription.Version, requiredVersion) > 0)
            {
                return(false);
            }
            if (installedDescription.CompatVersion.Length > 0 && Addin.CompareVersions(installedDescription.CompatVersion, requiredVersion) < 0)
            {
                return(false);
            }

            return(true);
        }