예제 #1
0
 public LumberMill()
 {
     m_population = 180;
     m_efficiency = 0.8f;
     m_production.Add(resource.wood, (int)Mathf.Floor(m_population * m_efficiency));
     m_maintenance = new ResourceList();
     m_maintenance.Add(resource.wheat, (int)Mathf.Floor(m_population * 1.2f));
     m_maintenance.Add(resource.iron, (int)Mathf.Floor(m_population * 0.2f));
     m_name = "LumberMill";
 }
예제 #2
0
 public Farm()
 {
     m_population = 200;
     m_efficiency = 2.4f;
     m_production = new ResourceList();
     m_production.Add(resource.wheat, (int)Mathf.Floor(m_population * m_efficiency));
     m_maintenance = new ResourceList();
     m_maintenance.Add(resource.wheat, (int)Mathf.Floor(m_population * 1.2f));
     m_maintenance.Add(resource.wood, (int)Mathf.Floor(m_population * 0.4f));
     m_name = "Farm";
 }
예제 #3
0
        public void ParseCase()
        {
            Properties.Clear();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(XML);

            XmlNodeList cases = doc.GetElementsByTagName("case");

            CaseParseAssert(cases.Count > 0, "No cases found");

            XmlNode thisCase = cases[0];

            LoadObjectProperties(thisCase);

            XmlNodeList resources = doc.GetElementsByTagName("resource");

            foreach (XmlNode n in resources)
            {
                DBCaseResource cr = new DBCaseResource();
                cr.Load(n);
                ResourceList.Add(cr);
            }

            XmlNodeList landuses = doc.GetElementsByTagName("landuse");

            foreach (XmlNode n in landuses)
            {
                DBLanduse l = new DBLanduse();
                l.Load(n);
                LanduseList.Add(l);
            }
        }
예제 #4
0
        /// <summary>
        /// Registers one or more <see cref="IPermissionDescriptor"/> instances.
        /// </summary>
        /// <param name="permissionDescriptors">The permission descriptors.</param>
        public void RegisterPermissionDescriptor(params IPermissionDescriptor[] permissionDescriptors)
        {
            foreach (var permissionDescriptor in permissionDescriptors)
            {
                Logger.Debug(string.Format("Registering Permission Descriptor: {0}", permissionDescriptor.GetType().FullName));
                foreach (var resource in permissionDescriptor.Resources)
                {
                    Logger.Debug(string.Format("Registering Resource: {0}", resource));
                    var resourceName = resource.Name;

                    var resourceAdded = _resourceList.FirstOrDefault(r => r.Name == resourceName);
                    if (resourceAdded != null)
                    {
                        throw new ArgumentException(
                                  string.Format(
                                      "Cannot add Resource ({0}) for Permission ({1}) because Resource ({0}) has already been added for Permission ({2}).",
                                      resource.Name,
                                      resource.Permission.Name,
                                      resourceAdded.Permission.Name));
                    }

                    _resourceList.Add(resource);
                }
            }
        }
예제 #5
0
    public ResourceForBlueprint AddResource()
    {
        ResourceForBlueprint tRes = new ResourceForBlueprint();

        ResourceList.Add(tRes);
        return(tRes);
    }
        /// <summary>
        /// Goes through the form and returns a list of all control on a form
        /// that are marked as [Localizable]
        ///
        /// This internal method does all the work and drills into child containers
        /// recursively.
        /// </summary>
        /// <param name="control">The control at which to start parsing usually Page</param>
        /// <param name="ResourceList">An instance of the resource list. Pass null to create</param>
        /// <returns></returns>
        protected List <LocalizableProperty> GetAllLocalizableControls(Control control, List <LocalizableProperty> ResourceList, bool noControlRecursion)
        {
            if (control == null)
            {
                control = this.Page;
            }

            // On the first hit create the list - recursive calls pass in the list
            if (ResourceList == null)
            {
                ResourceList = new List <LocalizableProperty>();
            }

            // 'generated' controls don't have an ID and don't need to be localized
            if (control.ID != null)
            {
                // Read all public properties and search for Localizable Attribute
                PropertyInfo[] pi = control.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
                foreach (PropertyInfo property in pi)
                {
                    object[] Attributes = property.GetCustomAttributes(typeof(LocalizableAttribute), true);
                    if (Attributes.Length < 1)
                    {
                        continue;
                    }

                    LocalizableProperty lp = new LocalizableProperty();

                    lp.ControlId = control.ID;

                    if (lp.ControlId.StartsWith("__"))
                    {
                        lp.ControlId = lp.ControlId.Substring(2);
                    }

                    lp.Property = property.Name;
                    lp.Value    = property.GetValue(control, null) as string;

                    ResourceList.Add(lp);
                }

                /// Check for special properties that not marked as [Localizable]
                GetNonLocalizableControlProperties(control, ResourceList);
            }

            if (!noControlRecursion)
            {
                // Now drill into the any contained controls
                foreach (Control ctl in control.Controls)
                {
                    // Recurse into child controls
                    if (ctl != null)
                    {
                        this.GetAllLocalizableControls(ctl, ResourceList);
                    }
                }
            }

            return(ResourceList);
        }
예제 #7
0
        /**
         * Gets a list of all skin resources in the library that match the
         * search criteria in the provided query.
         *
         * @param query
         *      Search criteria for skin resources
         * @return
         *      List of resources that match the query
         */
        public ResourceList getSkins(SkinResourceQuery query)
        {
            lock (sincronizeFlag)
            {
                ResourceList result = new ResourceList();

                foreach (SkinResource skin in skins)
                {
                    if (query.hasTextureHeight() && (query.getTextureHeight() < skin.getMinTextureHeightMeters() ||
                                                     query.getTextureHeight() >= skin.getMaxTextureHeightMeters()))
                    {
                        continue;
                    }
                    if (query.hasMinTextureHeight() && query.getMinTextureHeight() > skin.getMinTextureHeightMeters())
                    {
                        continue;
                    }
                    if (query.hasMaxTextureHeight() && query.getMaxTextureHeight() <= skin.getMinTextureHeightMeters())
                    {
                        continue;
                    }
                    if (query.hasRepeatsVertically() && query.getRepeatsVertically() != skin.getRepeatsVertically())
                    {
                        continue;
                    }
                    if (query.getTags().Count > 0 && skin.containsTags(query.getTags()))
                    {
                        continue;
                    }
                    result.Add(skin);
                }
                return(result);
            }
        }
예제 #8
0
    // Use this for initialization
    public new void Start()
    {
        base.Start();

        ResourceList.Add(new Resource("Madeira"));
        ResourceList.Add(new Resource("Documentação"));
        ResourceList.Add(new Resource("Açucar"));
        ResourceList.Add(new Resource("Ouro"));
        ResourceList.Add(new Resource("Armas"));
        ResourceList.Add(new Resource("Tecnologia"));

        if (landType == LandType.Colonia)
        {
            Resource res1 = ResourceList.Find(p => p.name == "Madeira");
            res1.registerOnUpdateCb(changeResource1);

            Resource res2 = ResourceList.Find(p => p.name == "Documentação");
            res2.registerOnUpdateCb(changeResource2);

            Resource res3 = ResourceList.Find(p => p.name == "Açucar");
            res3.registerOnUpdateCb(changeResource3);
        }
        else
        {
            Resource res1 = ResourceList.Find(p => p.name == "Ouro");
            res1.registerOnUpdateCb(changeResource1);

            Resource res2 = ResourceList.Find(p => p.name == "Armas");
            res2.registerOnUpdateCb(changeResource2);

            Resource res3 = ResourceList.Find(p => p.name == "Tecnologia");
            res3.registerOnUpdateCb(changeResource3);
        }
    }
 public void AddPlantResource(Sunflower plant)
 {
     if (_plowedFieldFlowerList.Count < _capacity)
     {
         _plowedFieldFlowerList.Add(plant);
         ResourceList.Add(plant);
     }
 }
예제 #10
0
 public void AddPlantResource(Sunflower sunflower)
 {
     if (_naturalFieldFlowerList.Count < _capacity)
     {
         _naturalFieldFlowerList.Add(sunflower);
         ResourceList.Add(sunflower);
     }
 }
예제 #11
0
 public void FromFileInfoList(List <IFileInfo> fileInfos)
 {
     fileInfos.ForEach(x =>
     {
         ResourceList.Add(new SelectListItem()
         {
             Text  = x.Name,
             Value = x.PhysicalPath
         });
     });
 }
예제 #12
0
 /**
  * Gets a list of all skin resources in the library.
  *
  * @return List of resources
  */
 public ResourceList getSkins()
 {
     lock (sincronizeFlag)
     {
         ResourceList result = new ResourceList();
         foreach (SkinResource skin in skins)
         {
             result.Add(skin);
         }
         return(result);
     }
 }
예제 #13
0
 public void GetNetworkResource()
 {
     //for each kingdom
     networkResource = new ResourceList();
     //int i = 0;
     // foreach (KeyValuePair<string, Kingdom> currKingdom in KingdomDictionary.GetDictionary())
     for (int i = 0; i < m_kingdom.Length; i++)
     {
         networkResource.Add(m_kingdom[i].SetImportsExports());
         Debug.Log(m_kingdom[i].GetName() + " exports:" + m_kingdom[i].GetExports().ToString() + "imports: " + m_kingdom[i].GetImports().ToString());
     }
     Debug.Log(networkResource);
 }
예제 #14
0
    // Use this for initialization
    public new void Start()
    {
        base.Start();
        ResourceList.Add(new Resource(Type.ToString()));

        if (timeBarResources != null)
        {
            timeBarResources.MaxTime = this.collectRate;
        }

        HideReadyIcon();
        timeBarResources.gameObject.SetActive(false);
    }
예제 #15
0
        public static void Initialize(BackgroundWorker worker, DoWorkEventArgs e, IList dictList)
        {
            if (IsInitialized)
            {
                Debug.WriteLine("Assets already initialized!");
            }
            else
            {
                Debug.WriteLine("Initializing assets...");

                //Set up font, generate list of valid chars
                ValidCharacters = new bool[0x10000];
                Characters      = new FontCharacter[0x10000];
                for (var i = 0; i < Resources.chars.Length / 0x10; i++)
                {
                    var fc = new FontCharacter(Resources.chars, i * 0x10);
                    ValidCharacters[fc.Data.Value] = true;
                    fc.SetGlyph(Images[fc.Data.ImageIndex]);
                    Characters[fc.Data.Value] = fc;
                }

                worker.ReportProgress(25);

                //Grab face data and assign to dictionary
                faceData = new Dictionary <string, byte[]>();
                var fids = Resources.FID.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                for (var i = 0; i < fids.Length; i++)
                {
                    var dat = new byte[0x48];
                    Array.Copy(Resources.faces, i * 0x48, dat, 0, 0x48);
                    faceData[fids[i]] = dat;
                }

                worker.ReportProgress(50);

                dictList.Add(new Uri(@"pack://application:,,,/FEITS Exporter;component/Resources/txt/FE_Dictionary.lex"));
                worker.ReportProgress(75);

                var set = Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentCulture, true, true);
                foreach (DictionaryEntry o in set)
                {
                    ResourceList.Add(o.Key as string);
                }

                worker.ReportProgress(100);
                Resources.ResourceManager.ReleaseAllResources();

                IsInitialized = true;
            }
        }
예제 #16
0
 public void AddAnimalResource(Chicken animal)
 {
     if (_chickenList.Count >= _capacity)
     {
         Console.WriteLine(@"
 **** That facililty is not large enough ****
 ****     Please choose another one      ****");
         Console.ReadLine();
     }
     else if (_chickenList.Count < _capacity)
     {
         _chickenList.Add(animal);
         ResourceList.Add(animal);
     }
 }
예제 #17
0
        /////////////////////////////////////////////////////////////////
        // Static Helper methods
        /////////////////////////////////////////////////////////////////

        #region Read

        public static ResourceList Read(Guid workspaceId, ResourceType resourceType)
        {
            var resources    = new ResourceList();
            var explorerItem = ServerExplorerRepository.Instance.Load(resourceType, workspaceId);

            explorerItem.Descendants().ForEach(item =>
            {
                if (item.ResourceType == resourceType)
                {
                    resources.Add(new Resource {
                        ResourceID = item.ResourceId, ResourceType = resourceType, ResourceName = item.DisplayName, ResourcePath = item.ResourcePath
                    });
                }
            });
            return(resources);
        }
예제 #18
0
        /// <summary>
        /// Adds a new <see cref="Resource"/> to the <see cref="ResourceList"/>.
        /// </summary>
        /// <param name="name">
        /// The resource name.
        /// </param>
        /// <param name="permission">
        /// The permission.
        /// </param>
        /// <param name="buildResourceList">
        /// Defines a new <see cref="ResourceListBuilder"/>
        /// for building sub-resources.
        /// </param>
        /// <returns>
        /// A <see cref="ResourceListBuilder"/> allowing for a fluent API.
        /// </returns>
        public ResourceListBuilder AddResource(
            string name, Permission permission, Func <ResourceListBuilder, ResourceList> buildResourceList = null)
        {
            var resource = new Resource {
                Name = name, Permission = permission
            };

            _resourceList.Add(resource);

            if (buildResourceList != null)
            {
                var          resourceListBuilder = new ResourceListBuilder();
                ResourceList resourceList        = buildResourceList(resourceListBuilder);
                resource.Resources = resourceList;
            }

            return(this);
        }
예제 #19
0
    public ResourceList GetMaintenance()
    {
        ResourceList totalmaintenance = new ResourceList();

        using (Database.DatabaseManager db = new Database.DatabaseManager())
        {
            List <Tile> m_tile = db.Tile.Where(t => t.domain == GetId()).ToList();
            foreach (Tile currTile in m_tile)
            {
                Building[] currentBuilding = currTile.GetBuildings();
                for (int i = 0; i < currentBuilding.Length; i++)
                {
                    totalmaintenance.Add(currentBuilding[i].GetMaintenance());
                }
            }
        }
        return(totalmaintenance);
    }
예제 #20
0
        protected override void ProcessRecord()
        {
            var resourceList = new ResourceList();

            if (this.Resources == null)
            {
                this.WriteObject(resourceList);
                return;
            }

            foreach (var resource in this.Resources)
            {
                resourceList.Add(resource);
                this.WriteVerbose(string.Format("Added {0} to resource list", resource));
            }

            this.WriteObject(resourceList);
        }
예제 #21
0
        protected override void ProcessRecord()
        {
            var resourceList = new ResourceList();

            if (this.Resources == null)
            {
                this.WriteObject(resourceList);
                return;
            }

            foreach (var resource in this.Resources)
            {
                resourceList.Add(resource);
                this.WriteVerbose(string.Format("Added {0} to resource list", resource));
            }

            this.WriteObject(resourceList);
        }
        public static ResourceList ParseAsResourceList(XElement xmlDocument, ResourceFilter filter = null)
        {
            if (filter == null)
            {
                filter = ResourceFilter.NoFilter;
            }

            var resourceList = new ResourceList();

            foreach (var resourceElement in xmlDocument.Elements())
            {
                if (resourceElement.Name.LocalName != "data")
                {
                    continue;
                }

                var key = resourceElement.Attribute("name").Value;

                if (!filter.KeyIsMatch(key))
                {
                    continue;
                }

                var valueElement = resourceElement.Element("value");

                var value = string.Empty;

                if (valueElement != null)
                {
                    value = valueElement.Value;
                }

                if (!filter.ValueIsMatch(value))
                {
                    continue;
                }

                resourceList.Add(new Resource(key, value));
            }

            return resourceList;
        }
예제 #23
0
    public ResourceList GetProduction()
    {
        ResourceList totalproduction = new ResourceList();

        using (Database.DatabaseManager db = new Database.DatabaseManager())
        {
            List <Tile> m_tile = db.Tile.Where(t => t.domain == GetId()).ToList();
            foreach (Tile currTile in m_tile)
            {
                Building[] currentBuilding = currTile.GetBuildings();
                for (int i = 0; i < currentBuilding.Length; i++)
                {
                    if (currentBuilding[i] is Industrial)
                    {
                        totalproduction.Add(((Industrial)currentBuilding[i]).ProduceResource());
                    }
                }
            }
        }
        return(totalproduction);
    }
예제 #24
0
    // Use this for initialization
    public new void Start()
    {
        base.Start();

        ResourceList.Add(new Resource("Madeira"));
        ResourceList.Add(new Resource("Documentação"));
        ResourceList.Add(new Resource("Açucar"));
        ResourceList.Add(new Resource("Ouro"));
        ResourceList.Add(new Resource("Armas"));
        ResourceList.Add(new Resource("Tecnologia"));

        if (landType == LandType.Metropole)
        {
            Resource res1 = ResourceList.Find(p => p.name == "Madeira");
            res1.registerOnUpdateCb(changeResource1);

            Resource res2 = ResourceList.Find(p => p.name == "Documentação");
            res2.registerOnUpdateCb(changeResource2);

            Resource res3 = ResourceList.Find(p => p.name == "Açucar");
            res3.registerOnUpdateCb(changeResource3);
        }
        else
        {
            Resource res1 = ResourceList.Find(p => p.name == "Ouro");
            res1.registerOnUpdateCb(changeResource1);

            Resource res2 = ResourceList.Find(p => p.name == "Armas");
            res2.registerOnUpdateCb(changeResource2);

            Resource res3 = ResourceList.Find(p => p.name == "Tecnologia");
            res3.registerOnUpdateCb(changeResource3);
        }

        //print("adding resources");
        //foreach (Resource myRes in ResourceList)
        //{
        //    myRes.modifyResource(5);
        //}
    }
예제 #25
0
 private void PrepareControl(MpeControl c)
 {
     if (c != null && c.Embedded == false)
     {
         MpeLog.Debug("Preparing " + c.ToString());
         ResourceList.Add(c);
         c.MpeScreen             = screen;
         c.Click                += new EventHandler(OnControlClick);
         c.MouseDown            += new MouseEventHandler(OnControlMouseDown);
         c.StatusChanged        += new MpeControl.StatusChangedHandler(OnControlStatusChanged);
         c.KeyUp                += new KeyEventHandler(OnKeyUp);
         c.IdentityChanged      += new MpeControl.IdentityChangedHandler(OnControlIdentityChanged);
         c.PropertyValueChanged += new MpeControl.PropertyValueChangedHandler(OnControlPropertyValueChanged);
         if (c is MpeContainer)
         {
             c.ControlAdded   += new ControlEventHandler(OnControlAdded);
             c.ControlRemoved += new ControlEventHandler(OnControlRemoved);
             if (AllowAdditions)
             {
                 c.DragDrop  += new DragEventHandler(OnDragDrop);
                 c.DragEnter += new DragEventHandler(OnDragEnter);
                 MpeLog.Debug("DragDrop enabled");
             }
             for (int i = 0; i < c.Controls.Count; i++)
             {
                 if (c.Controls[i] is MpeControl)
                 {
                     PrepareControl((MpeControl)c.Controls[i]);
                 }
             }
         }
     }
     else if (c != null && c.Embedded == true)
     {
         MpeLog.Debug("Preparing Embedded " + c.ToString());
         c.MpeScreen = screen;
     }
     MpeLog.Debug("Prepared " + c.ToString());
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Sets the new version in the DB for the named resource.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void SetNewResourceVersion(string name, Guid newVersion)
        {
            ICmResource resource = GetResource(name);

            if (resource == null)
            {
                // Resource does not exist yet. Add it to the collection.
                ICmResource newResource = Cache.ServiceLocator.GetInstance <ICmResourceFactory>().Create();
                ResourceList.Add(newResource);
                newResource.Name    = name;
                newResource.Version = newVersion;
#if DEBUG
                m_fVersionUpdated = true;
#endif
                return;
            }

            resource.Version = newVersion;
#if DEBUG
            m_fVersionUpdated = true;
#endif
        }
예제 #27
0
        private void Find_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            toolStripProgressBar1.Value = 0;
            toolStripProgressBar1.Style = ProgressBarStyle.Continuous;
            ResourceList.Clear();
            ResourceList.RaiseListChangedEvents = true;
            if (e.Result == null)
            {
                SetMessage("could not find any instruments, check connections and try again.");
                return;
            }
            foreach (string s in (e.Result as List <string>))
            {
                ResourceList.Add(s);
            }


            if (ResourceList.Count == 1)
            {
                listBox1.SelectedIndex = 0;
                textBox1.Text          = (string)ResourceList[0];
                SetMessage("One Instrument Found.");
                Connect((string)ResourceList[0]);

                UpdateScreen(pictureBox1);
            }
            else if (ResourceList.Count != 0)
            {
                listBox1.SelectedIndex = 0;
                textBox1.Text          = (string)ResourceList[0];
                SetMessage("Multiple Instruments Found, Please Select one and click connect.");
                //listBox1.SelectedIndex = 0;
            }
            else
            {
                SetMessage("No Instruments Found.");
            }
        }
예제 #28
0
 public void GiveResource(resource givenResource, int givenAmount)
 {
     m_resource.Add(givenResource, givenAmount);
 }
예제 #29
0
        /////////////////////////////////////////////////////////////////
        // Static Helper methods
        /////////////////////////////////////////////////////////////////

        #region Read

        public static ResourceList Read(Guid workspaceID, ResourceType resourceType)
        {
            var resources = new ResourceList();
            var resourceTypeStr = resourceType.ToString();

            ResourceIterator.Instance.Iterate(new[] { RootFolders[resourceType] }, workspaceID, iteratorResult =>
            {
                var isResourceType = false;
                string value;

                if(iteratorResult.Values.TryGetValue(1, out value))
                {
                    // Check ResourceType attribute
                    isResourceType = value.Equals(resourceTypeStr, StringComparison.InvariantCultureIgnoreCase);
                }
                else if(iteratorResult.Values.TryGetValue(5, out value))
                {
                    // This is here for legacy XML!
                    #region Check Type attribute

                    enSourceType sourceType;
                    if(iteratorResult.Values.TryGetValue(5, out value) && Enum.TryParse(value, out sourceType))
                    {
                        switch(sourceType)
                        {
                            case enSourceType.SqlDatabase:
                            case enSourceType.MySqlDatabase:
                                isResourceType = resourceType == ResourceType.DbSource;
                                break;
                            case enSourceType.WebService:
                                break;
                            case enSourceType.DynamicService:
                                isResourceType = resourceType == ResourceType.DbService;
                                break;
                            case enSourceType.Plugin:
                                isResourceType = resourceType == ResourceType.PluginService || resourceType == ResourceType.PluginSource;
                                break;
                            case enSourceType.Dev2Server:
                                isResourceType = resourceType == ResourceType.Server;
                                break;
                        }
                    }

                    #endregion
                }
                if(isResourceType)
                {
                    // older resources may not have an ID yet!!
                    iteratorResult.Values.TryGetValue(2, out value);
                    Guid resourceID;
                    Guid.TryParse(value, out resourceID);

                    string resourceName;
                    iteratorResult.Values.TryGetValue(3, out resourceName);
                    string resourcePath;
                    iteratorResult.Values.TryGetValue(4, out resourcePath);
                    resources.Add(ReadResource(resourceID, resourceType, resourceName, resourcePath, iteratorResult.Content));
                }
                return true;
            }, new ResourceDelimiter
            {
                ID = 1,
                Start = " ResourceType=\"",
                End = "\" "
            }, new ResourceDelimiter
            {
                ID = 2,
                Start = " ID=\"",
                End = "\" "
            }, new ResourceDelimiter
            {
                ID = 3,
                Start = " Name=\"",
                End = "\" "
            }, new ResourceDelimiter
            {
                ID = 4,
                Start = "<Category>",
                End = "</Category>"
            }, new ResourceDelimiter
            {
                ID = 5,
                Start = " Type=\"",
                End = "\" "
            });
            return resources;
        }
예제 #30
0
 public ResourceList GetDevcardResources()
 {
     ResourceList tmp = _Resources.Copy();
     ResourceList result = new ResourceList();
     for (int i = 1; i < 4; i++)
     {
         if (tmp.Contains(EResource.Discovery))
         {
             result.Add(EResource.Discovery);
             tmp.Discoveries--;
             continue;
         }
         if (!result.Contains(EResource.Wheat) && tmp.Wheat > 0)
         {
             result.Add(EResource.Wheat);
             tmp.Wheat--;
             continue;
         }
         if (!result.Contains(EResource.Ore) && tmp.Ore > 0)
         {
             result.Add(EResource.Ore);
             tmp.Ore--;
             continue;
         }
         if (!result.Contains(EResource.Sheep) && tmp.Sheep > 0)
         {
             result.Add(EResource.Sheep);
             tmp.Sheep--;
         }
     }
     return result;
 }
예제 #31
0
 static HTMLRendererResources()
 {
     m_resourceList = new ResourceList();
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.TogglePlus.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ToggleMinus.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.sortAsc.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.sortDesc.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.unsorted.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Blank.gif", "image/gif");
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Common.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.FitProportional.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.FixedHeader.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.CanGrowFalse.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ImageConsolidation.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html40Viewer.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Toolbar.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices40.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServicesHybrid.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServices.css", "text/css", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5Renderer.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.Html5RenderingExtensionJs.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jquery.min.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.jqueryui.min.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.knockoutjs.js", "application/javascript", hasDebugMode: true);
     m_resourceList.Add("Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.ReportingServicesHybrid.js", "application/javascript", hasDebugMode: true);
 }
예제 #32
0
 protected void Start()
 {
     ResourceCount = resourceCount;
     ResourceList.Add(this);
     OnResourceChange(resourceCount);
 }
예제 #33
0
        private void GetResources(Module/*!*/ module)
        {
            ManifestResourceRow[] manifestResourceTable = this.tables.ManifestResourceTable;
            int n = manifestResourceTable.Length;
            ResourceList resources = new ResourceList();

            for (int i = 0; i < n; i++)
            {
                ManifestResourceRow mrr = manifestResourceTable[i];
                Resource r = new Resource();
                r.Name = this.tables.GetString(mrr.Name);
                r.IsPublic = (mrr.Flags & 7) == 1;
                int impl = mrr.Implementation;
                if (impl != 0)
                {
                    switch (impl & 0x3)
                    {
                        case 0x0:
                            string modName = this.tables.GetString(this.tables.FileTable[(impl >> 2) - 1].Name);
                            if ((this.tables.FileTable[(impl >> 2) - 1].Flags & (int)FileFlags.ContainsNoMetaData) != 0)
                            {
                                r.DefiningModule = new Module();
                                r.DefiningModule.Directory = module.Directory;
                                r.DefiningModule.Location = Path.Combine(module.Directory, modName);
                                r.DefiningModule.Name = modName;
                                r.DefiningModule.Kind = ModuleKind.ManifestResourceFile;
                                r.DefiningModule.ContainingAssembly = module.ContainingAssembly;
                                r.DefiningModule.HashValue = this.tables.GetBlob(this.tables.FileTable[(impl >> 2) - 1].HashValue);
                            }
                            else
                            {
                                string modLocation = modName;
                                r.DefiningModule = GetNestedModule(module, modName, ref modLocation);
                            }
                            break;
                        case 0x1:
                            r.DefiningModule = this.tables.AssemblyRefTable[(impl >> 2) - 1].AssemblyReference.Assembly;
                            break;
                    }
                }
                else
                {
                    r.DefiningModule = module;
                    r.Data = this.tables.GetResourceData(mrr.Offset);
                }

                resources.Add(r);
            }
            module.Resources = resources;
            module.Win32Resources = this.tables.ReadWin32Resources();
        }
예제 #34
0
        /**
         * Gets a list of all skin resources in the library that match the
         * search criteria in the provided query.
         * 
         * @param query
         *      Search criteria for skin resources
         * @return
         *      List of resources that match the query
         */
        public ResourceList getSkins(SkinResourceQuery query)
        {
            lock (sincronizeFlag)
            {
                ResourceList result = new ResourceList();

                foreach (SkinResource skin in skins)
                {
                    if (query.hasTextureHeight() && (query.getTextureHeight() < skin.getMinTextureHeightMeters()
                        || query.getTextureHeight() >= skin.getMaxTextureHeightMeters()))
                    {
                        continue;
                    }
                    if (query.hasMinTextureHeight() && query.getMinTextureHeight() > skin.getMinTextureHeightMeters())
                    {
                        continue;
                    }
                    if (query.hasMaxTextureHeight() && query.getMaxTextureHeight() <= skin.getMinTextureHeightMeters())
                    {
                        continue;
                    }
                    if (query.hasRepeatsVertically() && query.getRepeatsVertically() != skin.getRepeatsVertically())
                    {
                        continue;
                    }
                    if (query.getTags().Count > 0 && skin.containsTags(query.getTags()))
                    {
                        continue;
                    }
                    result.Add(skin);
                }
                return result;
            }
        }
예제 #35
0
파일: Resources.cs 프로젝트: ndubul/Chillas
        /////////////////////////////////////////////////////////////////
        // Static Helper methods
        /////////////////////////////////////////////////////////////////

        #region Read

        public static ResourceList Read(Guid workspaceId, ResourceType resourceType)
        {
            var resources = new ResourceList();
            var explorerItem = ServerExplorerRepository.Instance.Load(resourceType, workspaceId);
            explorerItem.Descendants().ForEach(item =>
            {
                if(item.ResourceType == resourceType)
                {
                    resources.Add(new Resource { ResourceID = item.ResourceId, ResourceType = resourceType, ResourceName = item.DisplayName, ResourcePath = item.ResourcePath });
                }
            });
            return resources;
        }
예제 #36
0
        /////////////////////////////////////////////////////////////////
        // Static Helper methods
        /////////////////////////////////////////////////////////////////

        #region Read

        public static ResourceList Read(Guid workspaceID, ResourceType resourceType)
        {
            var resources       = new ResourceList();
            var resourceTypeStr = resourceType.ToString();

            ResourceIterator.Instance.Iterate(new[] { RootFolders[resourceType] }, workspaceID, iteratorResult =>
            {
                var isResourceType = false;
                string value;

                if (iteratorResult.Values.TryGetValue(1, out value))
                {
                    // Check ResourceType attribute
                    isResourceType = value.Equals(resourceTypeStr, StringComparison.InvariantCultureIgnoreCase);
                }
                else if (iteratorResult.Values.TryGetValue(5, out value))
                {
                    // This is here for legacy XML!
                    #region Check Type attribute

                    enSourceType sourceType;
                    if (iteratorResult.Values.TryGetValue(5, out value) && Enum.TryParse(value, out sourceType))
                    {
                        switch (sourceType)
                        {
                        case enSourceType.SqlDatabase:
                        case enSourceType.MySqlDatabase:
                            isResourceType = resourceType == ResourceType.DbSource;
                            break;

                        case enSourceType.WebService:
                            break;

                        case enSourceType.DynamicService:
                            isResourceType = resourceType == ResourceType.DbService;
                            break;

                        case enSourceType.Plugin:
                            isResourceType = resourceType == ResourceType.PluginService || resourceType == ResourceType.PluginSource;
                            break;

                        case enSourceType.Dev2Server:
                            isResourceType = resourceType == ResourceType.Server;
                            break;
                        }
                    }

                    #endregion
                }
                if (isResourceType)
                {
                    // older resources may not have an ID yet!!
                    iteratorResult.Values.TryGetValue(2, out value);
                    Guid resourceID;
                    Guid.TryParse(value, out resourceID);

                    string resourceName;
                    iteratorResult.Values.TryGetValue(3, out resourceName);
                    string resourcePath;
                    iteratorResult.Values.TryGetValue(4, out resourcePath);
                    resources.Add(ReadResource(resourceID, resourceType, resourceName, resourcePath, iteratorResult.Content));
                }
                return(true);
            }, new ResourceDelimiter
            {
                ID    = 1,
                Start = " ResourceType=\"",
                End   = "\" "
            }, new ResourceDelimiter
            {
                ID    = 2,
                Start = " ID=\"",
                End   = "\" "
            }, new ResourceDelimiter
            {
                ID    = 3,
                Start = " Name=\"",
                End   = "\" "
            }, new ResourceDelimiter
            {
                ID    = 4,
                Start = "<Category>",
                End   = "</Category>"
            }, new ResourceDelimiter
            {
                ID    = 5,
                Start = " Type=\"",
                End   = "\" "
            });
            return(resources);
        }
예제 #37
0
 /**
  * Gets a list of all skin resources in the library.
  * 
  * @return List of resources
  */
 public ResourceList getSkins()
 {
     lock (sincronizeFlag)
     {
         ResourceList result = new ResourceList();
         foreach (SkinResource skin in skins)
         {
             result.Add(skin);
         }
         return result;
     }
 }