Esempio n. 1
0
        public ItemDefinition Clone()
        {
            var id = new ItemDefinition(ItemType);

            id.AllowedChildFilters  = AllowedChildFilters.ToList();
            id.AllowedIn            = AllowedIn;
            id.AllowedParentFilters = AllowedParentFilters.ToList();
            id.AllowedZoneNames     = AllowedZoneNames.ToList();
            id.AuthorizedRoles      = AuthorizedRoles != null?AuthorizedRoles.ToList() : AuthorizedRoles;

            id.AvailableZones    = AvailableZones.ToList();
            id.Containers        = Containers.ToList();
            id.Description       = Description;
            id.Discriminator     = Discriminator;
            id.Displayables      = Displayables.ToList();
            id.Editables         = Editables.ToList();
            id.Enabled           = Enabled;
            id.IconUrl           = IconUrl;
            id.Installer         = Installer;
            id.IsDefined         = IsDefined;
            id.EditableModifiers = EditableModifiers.ToList();
            id.ContentModifiers  = ContentModifiers.ToList();
            id.NumberOfItems     = 0;
            id.RelatedTo         = RelatedTo;
            id.SortOrder         = SortOrder;
            id.Template          = Template;
            id.Title             = Title;
            id.ToolTip           = ToolTip;
            //id.ReloadRoot();
            return(id);
        }
        public bool LoadZoneFromFile(string path)
        {
            try
            {
                using (FileStream fileStream = File.OpenRead(path))
                {
                    //Names
                    string assetName        = Path.GetFileName(path);
                    string assetDisplayName = BuildAssetName(assetName, Path.GetDirectoryName(path));

                    //De-serialize
                    Zone zone = Zone.LoadFromStream(assetName, assetDisplayName, fileStream);

                    if (zone != null)
                    {
                        AvailableZones.Add(zone);
                        AvailableZones.Sort();

                        ForgelightExtension.Instance.ZoneManager.ChangeZone(ForgelightExtension.Instance.ForgelightGameFactory.ActiveForgelightGame, zone);

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("An error occurred while importing zone at: " + path + ". " + e.Message + "\n" + e.StackTrace);
            }

            return(false);
        }
Esempio n. 3
0
        public ItemDefinition Clone()
        {
            var id = new ItemDefinition(ItemType);

            id.AllowedChildFilters  = AllowedChildFilters.ToList();
            id.AllowedIn            = AllowedIn;
            id.AllowedParentFilters = AllowedParentFilters.ToList();
            id.Attributes           = Attributes.ToList();
            id.AllowedZoneNames     = AllowedZoneNames.ToList();
            id.AuthorizedRoles      = AuthorizedRoles != null?AuthorizedRoles.ToArray() : AuthorizedRoles;

            id.AvailableZones      = AvailableZones.ToList();
            id.Containers          = new ContentList <IEditableContainer>(Containers.Select(ec => ec.TryClone()));
            id.ContentTransformers = ContentTransformers.ToList();
            id.Description         = Description;
            id.Discriminator       = Discriminator;
            id.Displayables        = new ContentList <IDisplayable>(Displayables.Select(d => d.TryClone()));
            id.Editables           = new ContentList <IEditable>(Editables.Select(e => e.TryClone()));
            id.Enabled             = Enabled;
            id.EditableModifiers   = EditableModifiers.ToList();
            id.IconUrl             = IconUrl;
            id.Installer           = Installer;
            id.IsDefined           = IsDefined;
            id.NumberOfItems       = 0;
            id.Metadata            = Metadata.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            id.AdditionalFlags     = AdditionalFlags.ToList();
            id.RemovedFlags        = RemovedFlags.ToList();
            id.Properties          = Properties.ToDictionary(p => p.Key, p => p.Value.Clone());
            id.RelatedTo           = RelatedTo;
            id.SortOrder           = SortOrder;
            id.TemplateKey         = TemplateKey;
            id.Title   = Title;
            id.ToolTip = ToolTip;
            return(id);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a ProgramSet with one program instance
        /// </summary>
        public ProgramSet CreateSingularProgramSet(string programSetName, ZoneProgram program, ISV isv, Zone zone, dynamic startingParameters = null)
        {
            if (!AvailableZones.Contains(zone))
            {
                throw new Exception("The provided zone is not available.");
            }

            var programSet = new ProgramSet(program, zone, isv, programSetName, startingParameters);

            ProgramSets.Add(programSet);
            return(programSet);
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a ProgramSet
        /// </summary>
        /// <param name="programSetName">Name of program set</param>
        /// <param name="programName">Name of program</param>
        /// <param name="sync">Whether or not to start the programs in sync</param>
        /// <param name="isv">Input starting values - starting values for the inputs</param>
        /// <param name="zones">Zones to run the program set on</param>
        /// <param name="startingParameters">Starting parameters for creating this program set. These will be fed to the constructor(s) of the ZoneProgram(s).</param>
        public ProgramSet CreateProgramSet(string programSetName, string programName, bool sync, ISV isv,
                                           IEnumerable <Zone> zones, dynamic startingParameters = null)
        {
            var zonesList = zones as IList <Zone> ?? zones.ToList();

            if (zonesList.Any(z => !AvailableZones.Contains(z)))
            {
                throw new Exception("Some of the provided zones are not available.");
            }

            var programSet = new ProgramSet(programName, zonesList, sync, isv.Listify(), programSetName, startingParameters);

            ProgramSets.Add(programSet);
            return(programSet);
        }
        public void FillInventoryProductList()
        {
            var products = AllProducts.Where(x => x.InventoryId == SelectedInventory.Id);

            InventoryProductViewModels.Clear();
            foreach (var product in products)
            {
                InventoryProductViewModels.Add(new InventoryProductViewModel
                {
                    Id          = product.Id,
                    ScannedDate = product.ScannedDate,
                    ScannedZone = AvailableZones.First(x => x.Id == product.ZoneId).Description
                });
            }
        }
        public void FillInventoryList()
        {
            InventoryViewModels.Clear();
            AllProducts = new List <InventoryProductDto>();
            var inventorys = _restApiClient.GetInventorysBySearchId(new RestApi.Client.Dto.Request.Inventory.GetInventoryBySearch {
                SearchId = SelectedInventorySearchId
            });

            foreach (var inventory in inventorys)
            {
                InventoryViewModels.Add(new InventoryViewModel
                {
                    Description     = inventory.Description,
                    EndDate         = inventory.EndDate,
                    Id              = inventory.Id,
                    InventoryStatus = inventory.InventorySatus.Description,
                    StartDate       = inventory.StartDate,
                    ZoneName        = AvailableZones.First(x => x.Id == inventory.Id).Description
                });
            }

            AllProducts = inventorys.SelectMany(x => x.Products).ToList();
        }
 public Zone GetZone(string name)
 {
     return((Zone)AvailableZones.Find(zone => zone.Name == name));
 }