예제 #1
0
        /// <summary>
        /// Delete a location from the tree
        /// </summary>
        protected void DeleteTreeLocation()
        {
            // Get the parent - as we don;t allow selection across levels we can be sure that the parent for all
            // selected items is the same
            UltraTreeNode parentNode = locationsTree.SelectedNodes[0].Parent;

            // first check that the user isn't trying to delete the root location
            if (parentNode == null)
            {
                MessageBox.Show("Unable to delete " + locationsTree.SelectedNodes[0].Text + " - the top-level location cannot be deleted", "AuditWizard", MessageBoxButtons.OK);
                return;
            }

            // Confirm the deletion as this is a pretty serious function
            if (MessageBox.Show("Are you sure that you want to delete the selected location(s)?  All child locations will also be deleted and any child assets moved to the parent location.", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
            {
                return;
            }

            // Delete these locations
            foreach (UltraTreeNode node in locationsTree.SelectedNodes)
            {
                // get the location and delete from the database
                AssetGroup location = node.Tag as AssetGroup;
                location.Delete();

                // ...and remove it from the tree
                parentNode.Nodes.Remove(node);
            }

            // Select the parent node as this will cause the list to be refreshed
            parentNode.BringIntoView();
            parentNode.Selected = true;
        }
예제 #2
0
        /// <summary>
        /// Called to display the properties of the currently selected node
        /// </summary>
        /// <param name="selectedNode"></param>
        protected bool EditLocation(AssetGroup parentLocation, AssetGroup location)
        {
            // ...and display the location editing form
            FormUserLocation form = new FormUserLocation(parentLocation, location);

            return(form.ShowDialog() == DialogResult.OK);
        }
예제 #3
0
        /// <summary>
        /// Display the properties of the currently selected Location when invoked from the ListView
        /// </summary>
        protected void EditListLocation()
        {
            // Sanity check to ensure that only one item is selected in the list
            if (locationsList.SelectedItems.Count != 1)
            {
                return;
            }

            UltraListViewItem selectedItem = locationsList.SelectedItems[0];
            AssetGroup        location     = selectedItem.Tag as AssetGroup;

            // The parent item of the location being edited is the currently selected node in the tree
            UltraTreeNode selectedNode   = locationsTree.SelectedNodes[0];
            AssetGroup    parentLocation = selectedNode.Tag as AssetGroup;

            // Display the properties of this location
            string originalName = location.Name;

            if (EditLocation(parentLocation, location))
            {
                // Update the tree and then re-populate the list
                if (location.Name != originalName)
                {
                    UltraTreeNode childNode = FindChildNode(selectedNode, originalName);
                    if (childNode != null)
                    {
                        childNode.Text = location.Name;
                        childNode.Tag  = location;
                    }
                }
                PopulateListView(selectedNode);
            }
        }
예제 #4
0
        /// <summary>
        /// Called to delete locations from the ListView (and also the tree)
        /// </summary>
        protected void DeleteListLocation()
        {
            // Sanity check to ensure that at least one item is selected in the list
            if (locationsList.SelectedItems.Count == 0)
            {
                return;
            }

            foreach (UltraListViewItem item in locationsList.SelectedItems)
            {
                AssetGroup location = item.Tag as AssetGroup;

                // Now delete the location from the database
                if (location.Delete())
                {
                    // Successfully deleted so remove from the listview
                    locationsList.Items.Remove(item);

                    // ...and from the tree view also
                    UltraTreeNode parentNode = locationsTree.SelectedNodes[0];
                    UltraTreeNode childNode  = FindChildNode(parentNode, location.Name);
                    parentNode.Nodes.Remove(childNode);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Adds a new location as a child of the location currently selected in the TreeView
        /// </summary>
        public void AddLocation()
        {
            if (locationsTree.SelectedNodes.Count == 0)
            {
                return;
            }
            //
            UltraTreeNode selectedNode = locationsTree.SelectedNodes[0];

            AssetGroup parentGroup = selectedNode.Tag as AssetGroup;
            AssetGroup newGroup    = new AssetGroup();

            newGroup.GroupType = AssetGroup.GROUPTYPE.userlocation;
            newGroup.ParentID  = parentGroup.GroupID;
            //
            FormUserLocation form = new FormUserLocation(parentGroup, newGroup);

            if (form.ShowDialog() == DialogResult.OK)
            {
                UltraTreeNode newNode = selectedNode.Nodes.Add(newGroup.FullName, newGroup.Name);

                newNode.Override.NodeAppearance.Image         = Properties.Resources.location_16;
                newNode.Override.ExpandedNodeAppearance.Image = Properties.Resources.location_16;
                newNode.Tag = newGroup;
                newNode.BringIntoView();

                // Add the new location to the list view also
                PopulateListView(selectedNode);
            }
        }
예제 #6
0
        // ValidateDataModel - This sample is hard-wired to a particular version of the Naperville data model.
        // This routine checks to make sure we are using the correct one
        private bool ValidateDataModel(UtilityNetwork utilityNetwork)
        {
            bool dataModelIsValid = false;

            try
            {
                using (UtilityNetworkDefinition utilityNetworkDefinition = utilityNetwork.GetDefinition())

                    using (NetworkSource transformerBankNetworkSource = GetNetworkSource(utilityNetworkDefinition, AssemblyNetworkSourceName))
                        using (AssetGroup transformerBankAssetGroup = transformerBankNetworkSource.GetAssetGroup(TransformerBankAssetGroupName))
                            using (AssetType transformerBankAssetType = transformerBankAssetGroup.GetAssetType(TransformerBankAssetTypeName))

                                // Transformer
                                using (NetworkSource deviceNetworkSource = GetNetworkSource(utilityNetworkDefinition, DeviceNetworkSourceName))
                                    using (AssetGroup transformerAssetGroup = deviceNetworkSource.GetAssetGroup(TransformerAssetGroupName))
                                        using (AssetType transformerAssetType = transformerAssetGroup.GetAssetType(TransformerAssetTypeName))

                                            // Arrester
                                            using (AssetGroup arresterAssetGroup = deviceNetworkSource.GetAssetGroup(ArresterAssetGroupName))
                                                using (AssetType arresterAssetType = arresterAssetGroup.GetAssetType(ArresterAssetTypeName))

                                                    // Fuse
                                                    using (AssetGroup fuseAssetGroup = deviceNetworkSource.GetAssetGroup(FuseAssetGroupName))
                                                        using (AssetType fuseAssetType = fuseAssetGroup.GetAssetType(FuseAssetTypeName))
                                                        {
                                                            // Find the upstream terminal on the transformer
                                                            TerminalConfiguration terminalConfiguration = transformerAssetType.GetTerminalConfiguration();
                                                            Terminal upstreamTerminal = null;
                                                            foreach (Terminal terminal in terminalConfiguration.Terminals)
                                                            {
                                                                if (terminal.IsUpstreamTerminal)
                                                                {
                                                                    upstreamTerminal = terminal;
                                                                    break;
                                                                }
                                                            }

                                                            // Find the terminal on the fuse
                                                            Terminal fuseTerminal = fuseAssetType.GetTerminalConfiguration().Terminals[0];

                                                            // Find the terminal on the arrester
                                                            Terminal arresterTerminal = arresterAssetType.GetTerminalConfiguration().Terminals[0];

                                                            // All of our asset groups and asset types exist.  Now we have to check for rules.

                                                            IReadOnlyList <Rule> rules = utilityNetworkDefinition.GetRules();
                                                            if (ContainmentRuleExists(rules, transformerBankAssetType, transformerAssetType) &&
                                                                ContainmentRuleExists(rules, transformerBankAssetType, fuseAssetType) &&
                                                                ContainmentRuleExists(rules, transformerBankAssetType, arresterAssetType) &&
                                                                ConnectivityRuleExists(rules, transformerAssetType, upstreamTerminal, fuseAssetType, fuseTerminal) &&
                                                                ConnectivityRuleExists(rules, fuseAssetType, fuseTerminal, arresterAssetType, arresterTerminal))
                                                            {
                                                                dataModelIsValid = true;
                                                            }
                                                        }
            }
            catch { }

            return(dataModelIsValid);
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("AssetGroupId,Code,Name,CreateBy,CreateDate,UpdateBy,UpdateDate,IsActive,IsDelete")] AssetGroup assetGroup)
        {
            if (id != assetGroup.AssetGroupId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(assetGroup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssetGroupExists(assetGroup.AssetGroupId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }


            return(View(assetGroup));
        }
    void EmptyGroup(AssetGroup assetGroup)
    {
        if (assetGroup.m_AssetConnections.Count > 0)
        {
            foreach (var edge in assetGroup.m_AssetConnections)
            {
                m_GraphView.RemoveElement(edge);
            }
        }
        assetGroup.m_AssetConnections.Clear();

        foreach (var node in assetGroup.m_AssetNodes)
        {
            m_GraphView.RemoveElement(node);
        }
        assetGroup.m_AssetNodes.Clear();

        assetGroup.m_DependenciesForPlacement.Clear();

        //if (assetGroup.SharedGroup != null) {
        //    EmptyGroup(assetGroup.SharedGroup);
        //}

        m_GraphView.RemoveElement(assetGroup.groupNode);

        assetGroup.groupNode = null;
    }
예제 #9
0
    private void ExploreAsset()
    {
        //ClearGraph();

        Object obj = Selection.activeObject;

        //Prevent readding same object
        if (SelectedObjects.Contains(obj))
        {
            Debug.Log("Object already loaded");
            return;
        }
        SelectedObjects.Add(obj);

        AssetGroup AssetGroup = new AssetGroup();

        AssetGroups.Add(AssetGroup);
        AssetGroup.assetPath = AssetDatabase.GetAssetPath(obj);

        // assetPath will be empty if obj is null or isn't an asset (a scene object)
        if (obj == null || string.IsNullOrEmpty(AssetGroup.assetPath))
        {
            return;
        }

        //Group groupNode = new Group { title = obj.name };
        //AssetGroup.groupName = obj.name;
        AssetGroup.groupNode = new Group {
            title = obj.name
        };

        PopulateGroup(AssetGroup, new Rect(0, 0, 0, 0));
    }
예제 #10
0
        public ValueDataResponse <AssetGroup> InsertAssetGroup(AssetGroup asset)
        {
            ValueDataResponse <AssetGroup> response = new ValueDataResponse <AssetGroup>();

            try
            {
                var result = _appContext.AssetGroups.Add(asset);
                _appContext.SaveChanges();

                if (result != null)
                {
                    response.Result          = asset;
                    response.IsSuccess       = true;
                    response.AffectedRecords = 1;
                    response.EndUserMessage  = "AssetGroup Added Successfully";
                }
                else
                {
                    response.IsSuccess       = true;
                    response.AffectedRecords = 0;
                    response.EndUserMessage  = "AssetGroup Added Failed";
                }
            }
            catch (Exception ex)
            {
                response.IsSuccess       = false;
                response.AffectedRecords = 0;
                response.EndUserMessage  = ex.InnerException == null ? ex.Message : ex.InnerException.Message;
                response.Exception       = ex;
            }

            return(response);
        }
        /// <summary>
        /// This function is called to (re)initialize the network explorer view
        /// this is a tree control defined within NetworkExplorerView
        /// </summary>
        private void InitializeNetworkView()
        {
            // clear the existing view
            explorerView.Clear();

            // Are we displaying the computers grouped into domains or user locations - this is held as a flag
            // in the work item controller
            NetworkWorkItemController wiController = explorerView.WorkItem.Controller as NetworkWorkItemController;
            bool showByDomain = wiController.DomainViewStyle;

            // First of all we need to create the root group (domain or location)
            LocationsDAO lwDataAccess = new LocationsDAO();

            AssetGroup.GROUPTYPE displayType = (showByDomain) ? AssetGroup.GROUPTYPE.domain : AssetGroup.GROUPTYPE.userlocation;
            DataTable            table       = lwDataAccess.GetGroups(new AssetGroup(displayType));

            _rootAssetGroup = new AssetGroup(table.Rows[0], displayType);

            // Add the root node to the tree first
            UltraTreeNode rootNode  = new UltraTreeNode("root|" + _rootAssetGroup.FullName, _rootAssetGroup.Name);
            Bitmap        rootImage = (showByDomain) ? Properties.Resources.domain16 : Properties.Resources.location_16;

            rootNode.Override.NodeAppearance.Image         = rootImage;
            rootNode.Override.ExpandedNodeAppearance.Image = rootImage;
            rootNode.Tag = _rootAssetGroup;

            // Set the root node in the Explorer view - note that this will automatically expand the node which will
            // cause it to be populated
            explorerView.RootNode = rootNode;
        }
        public static void Encode(
            this AssetLibraryManager assetLibraryManager,
            BitWriter writer,
            Platform platform,
            AssetGroup group,
            Items.PackedAssetReference value)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            var config = assetLibraryManager.Configurations[group];

            uint index;

            if (value == Items.PackedAssetReference.None)
            {
                index = config.NoneIndex;
            }
            else
            {
                index  = 0;
                index |= (((uint)value.AssetIndex) & config.AssetMask) << 0;
                index |= (((uint)value.SublibraryIndex) & config.SublibraryMask) << config.AssetBits;

                if (value.UseSetId == true)
                {
                    index |= 1u << config.AssetBits + config.SublibraryBits - 1;
                }
            }

            writer.WriteUInt32(index, config.SublibraryBits + config.AssetBits);
        }
예제 #13
0
        public Task <bool> deleteAssetGroupSync(AssetGroupVM entity)
        {
            return(Task.Run(() =>
            {
                AssetGroup group = new AssetGroup();
                {
                    group.ID = entity.ID;
                    group.Code = entity.Code;
                    group.ARName = entity.ARName;
                    group.LatName = entity.LatName;
                    group.AssetGroupID = entity.AssetGroupID;
                    group.AssetGroupAccountID = entity.AssetGroupAccountID;
                    group.DepreciationAccountID = entity.DepreciationAccountID;
                    group.TotalDepreciationAccountID = entity.TotalDepreciationAccountID;
                    group.ExpensesAccountID = entity.ExpensesAccountID;
                    group.CapitalProfitAccountID = entity.CapitalProfitAccountID;
                    group.CapitalLossAccountID = entity.CapitalLossAccountID;
                    group.AppraisalExcessAccountID = entity.AppraisalExcessAccountID;
                    group.ApprasialDeficitAccountID = entity.ApprasialDeficitAccountID;
                    group.AddedBy = entity.AddedBy;
                    group.AddedOn = entity.AddedOn;
                    group.UpdatedBy = entity.UpdatedBy;
                    group.UpdatedOn = entity.UpdatedOn;
                    group.Notes = entity.Notes;
                    group.Active = entity.Active;
                    group.Position = entity.Position;
                };

                assetGroupRepo.Delete(group, group.ID);
                return true;
            }));
        }
        private static bool GetIndex(this AssetLibraryManager alm,
                                     int setId,
                                     AssetGroup group,
                                     string package,
                                     string asset,
                                     out uint index)
        {
            var config = alm.Configurations[group];

            var set     = alm.GetSet(setId);
            var library = set.Libraries[group];

            var sublibrary =
                library.Sublibraries.FirstOrDefault(sl => sl.Package == package && sl.Assets.Contains(asset));

            if (sublibrary == null)
            {
                index = 0;
                return(false);
            }

            var sublibraryIndex = library.Sublibraries.IndexOf(sublibrary);
            var assetIndex      = sublibrary.Assets.IndexOf(asset);

            index  = 0;
            index |= (((uint)assetIndex) & config.AssetMask) << 0;
            index |= (((uint)sublibraryIndex) & config.SublibraryMask) << config.AssetBits;

            if (setId != 0)
            {
                index |= 1u << config.AssetBits + config.SublibraryBits - 1;
            }

            return(true);
        }
        public override IHttpActionResult Post([FromBody] JObject record)
        {
            try
            {
                if (PostRoles == string.Empty || User.IsInRole(PostRoles))
                {
                    using (AdoDataConnection connection = new AdoDataConnection(Connection))
                    {
                        extendedAssetGroupView newRecord = record.ToObject <extendedAssetGroupView>();
                        AssetGroup             newGroup  = new AssetGroup()
                        {
                            ID = newRecord.ID, DisplayDashboard = newRecord.DisplayDashboard, Name = newRecord.Name
                        };

                        int result = new TableOperations <AssetGroup>(connection).AddNewRecord(newRecord);

                        return(Ok(new TableOperations <AssetGroupView>(connection).QueryRecordWhere("Name = {0}", newRecord.Name)));
                    }
                }
                else
                {
                    return(Unauthorized());
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
예제 #16
0
        private void AddLocation(UltraListViewItem lvi)
        {
            LocationsDAO lwDataAccess = new LocationsDAO();

            // Create the AssetGroup for this location noting that we need to add the root item name to all
            // locations created as this will be missing from the import text
            string     oldLocation = lvi.Text;
            AssetGroup newGroup    = new AssetGroup();

            newGroup.GroupType = AssetGroup.GROUPTYPE.userlocation;
            if (oldLocation == "")
            {
                newGroup.FullName = _rootName;
            }
            else
            {
                newGroup.FullName = _rootName + AssetGroup.LOCATIONDELIMITER + lvi.Text;
            }
            newGroup.StartIP = lvi.SubItems[0].Text;
            newGroup.EndIP   = lvi.SubItems[1].Text;

            // Add this group and get its database index
            newGroup.Add();

            // Now we need to add the asset (if there is one defined)
            string assetName = lvi.SubItems[2].Text;

            if (assetName != "")
            {
                Asset newAsset = new Asset();
                newAsset.LocationID = newGroup.GroupID;
                newAsset.Name       = assetName;
                newAsset.Add();
            }
        }
        private static bool GetIndex(this AssetLibraryManager alm,
                                     int setId,
                                     AssetGroup group,
                                     string package,
                                     string asset,
                                     out uint index)
        {
            var config = alm.Configurations[group];

            var set = alm.GetSet(setId);
            var library = set.Libraries[group];

            var sublibrary =
                library.Sublibraries.FirstOrDefault(sl => sl.Package == package && sl.Assets.Contains(asset));
            if (sublibrary == null)
            {
                index = 0;
                return false;
            }

            var sublibraryIndex = library.Sublibraries.IndexOf(sublibrary);
            var assetIndex = sublibrary.Assets.IndexOf(asset);

            index = 0;
            index |= (((uint)assetIndex) & config.AssetMask) << 0;
            index |= (((uint)sublibraryIndex) & config.SublibraryMask) << config.AssetBits;

            if (setId != 0)
            {
                index |= 1u << config.AssetBits + config.SublibraryBits - 1;
            }

            return true;
        }
예제 #18
0
        public FormUserLocation(AssetGroup parentLocation, AssetGroup theLocation)
        {
            InitializeComponent();

            _parentLocation = parentLocation;
            _location       = theLocation;

            // If this entry is null or the InstanceID is 0 then we are creating a new Location type
            if (_location == null)
            {
                _location           = new AssetGroup();
                _location.GroupType = AssetGroup.GROUPTYPE.userlocation;
            }

            this.Text     = (_location.GroupID == 0) ? "New Location" : "Edit Location";
            tbParent.Text = (_parentLocation == null) ? "" : _parentLocation.FullName;
            tbChild.Text  = (_location.GroupID == 0) ? "New Location" : _location.Name;

            // Add (any) IP address ranges to the list
            string[] startIpAddresses = _location.StartIP.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            string[] endIpAddresses   = _location.EndIP.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            ulvTcpRanges.BeginUpdate();
            for (int isub = 0; isub < startIpAddresses.Length; isub++)
            {
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[1];
                subItemArray[0]       = new UltraListViewSubItem();
                subItemArray[0].Value = endIpAddresses[isub];
                UltraListViewItem item = new UltraListViewItem(startIpAddresses[isub], subItemArray);
                ulvTcpRanges.Items.Add(item);
            }
            ulvTcpRanges.EndUpdate();
        }
        /// <summary>
        /// This function is responsible for the actual generation of the Applications Report
        /// It overrides the abstract definition in the base class and stores it's data in the DataSet
        /// </summary>
        public override void GenerateReport(UltraGrid grid)
        {
            // Delete any cached data as we are re-running the report
            _cachedAssetGroups = null;

            // Begin initialization of the Grid
            grid.BeginUpdate();

            // Save the grid layout to a temporary file
            if (grid.Rows.Count != 0)
            {
                SaveTemporaryLayout(grid);
            }

            // Create a new dataSource
            _reportDataSet  = new DataSet("auditdataDataSet");
            grid.DataSource = _reportDataSet;

            // We will always need the list of assets so we may as well get it now
            LocationsDAO lwDataAccess = new LocationsDAO();

            AssetGroup.GROUPTYPE displayType = AssetGroup.GROUPTYPE.userlocation;
            DataTable            table       = lwDataAccess.GetGroups(new AssetGroup(displayType));

            _cachedAssetGroups = new AssetGroup(table.Rows[0], displayType);
            _cachedAssetGroups.Populate(true, _ignoreChildAssets, true);

            // Now apply the filter to these groups
            _cachedAssetGroups.ApplyFilters(_selectedGroups, _selectedAssets, _ignoreChildAssets);

            // Now that we have a definitive list of the assets (as objects) which we want to include in the
            // report we could really do with expanding this list so that ALL of the assets are in a single list
            // and not distributed among the publishers
            _cachedAssetList = _cachedAssetGroups.GetAllAssets();

            // Create the list of report columns which will maintain the data for this report
            _auditDataReportColumns.Populate(_listSelectedFields
                                             , _dictionaryLabels
                                             , _publisherFilter
                                             , _showIncluded
                                             , _showIgnored);

            // Create the tables, columns and relationships as these may have changed since we loaded the report
            CreateTables();

            // Clear any existing data out of the dataset
            _reportDataSet.Tables["AuditData"].Rows.Clear();

            // Generate the data for the report
            GenerateReportData();

            // reload the temprary layout saved around the report generation
            //LoadTemporaryLayout(grid);

            // ...and perform any required initialization of the grid
            InitializeGrid(grid);

            grid.EndUpdate();
        }
예제 #20
0
 public AllAssets(AssetGroup parentGroup, int assetID, string itemValue)
 {
     _parentGroup = parentGroup;
     _nodeType    = eNodeType.value;
     _branchName  = "";
     _itemValue   = itemValue;
     _tag         = null;
 }
예제 #21
0
 public AllAssets(AssetGroup parentGroup, string branchName)
 {
     _parentGroup = parentGroup;
     _nodeType    = eNodeType.category;
     _branchName  = branchName;
     _itemValue   = "";
     _tag         = null;
 }
예제 #22
0
 public AllAssets(AssetGroup parentGroup, eNodeType nodeType)
 {
     _parentGroup = parentGroup;
     _nodeType    = nodeType;
     _branchName  = "";
     _itemValue   = "";
     _tag         = null;
 }
예제 #23
0
 public AllAssets(AssetGroup parentGroup)
 {
     _parentGroup = parentGroup;
     _nodeType    = eNodeType.root;
     _branchName  = "";
     _itemValue   = "";
     _tag         = null;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            AssetGroup assetGroup = db.AssetGroups.Find(id);

            db.AssetGroups.Remove(assetGroup);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #25
0
        private Dictionary <string, object> CreateDeviceAttributes(AssetGroup assetGroup, AssetType assetType, MapPoint mapPoint, int phase)
        {
            var attributes = CreateAttributes(assetGroup, assetType, mapPoint);

            attributes.Add(DeviceStatusFieldName, DeviceStatusClosed);
            attributes.Add(PhaseFieldName, phase);
            return(attributes);
        }
    private void UpdateGroupDependencyNodePlacement(GeometryChangedEvent e, AssetGroup assetGroup)
    {
        assetGroup.mainNode.UnregisterCallback <GeometryChangedEvent, AssetGroup>(
            UpdateGroupDependencyNodePlacement
            );

        ResetNodes(assetGroup);
    }
예제 #27
0
 protected AssetLoading(AssetLoadingPattern loadingPattern, string bundleName, string assetName, Type objectType)
 {
     LoadingPattern = loadingPattern;
     BundleName     = bundleName;
     Name           = assetName;
     AssetGroup     = AssetGroup.Asset;
     ObjectType     = objectType;
 }
예제 #28
0
        // CreateAttributes - creates a dictionary of attribute-value pairs
        private Dictionary <string, object> CreateAttributes(AssetGroup assetGroup, AssetType assetType, MapPoint mapPoint)
        {
            var attributes = new Dictionary <string, object>();

            attributes.Add("SHAPE", mapPoint);
            attributes.Add("ASSETGROUP", assetGroup.Code);
            attributes.Add("ASSETTYPE", assetType.Code);
            return(attributes);
        }
예제 #29
0
 /// <summary>
 /// Copy Constructor
 /// </summary>
 /// <param name="other"></param>
 public AllAssets(AllAssets other)
 {
     _parentGroup = other.ParentGroup;
     _nodeType    = other.AllAssetType;
     _branchName  = other.BranchName;
     _itemValue   = other.ItemValue;
     _listAssets  = other.ListAssets;
     _tag         = other.Tag;
 }
        private static bool GetIndex(this AssetLibraryManager assetLibraryManager,
                                     Platform platform,
                                     int setId,
                                     AssetGroup group,
                                     string package,
                                     string asset,
                                     out Items.PackedAssetReference packed)
        {
            var set = assetLibraryManager.GetSet(setId);

            if (set == null)
            {
                packed = Items.PackedAssetReference.None;
                return(false);
            }

            var library = set.Libraries[group];

            var sublibrary =
                library.Sublibraries.FirstOrDefault(sl => sl.Package == package && sl.Assets.Contains(asset) == true);

            if (sublibrary == null)
            {
                packed = Items.PackedAssetReference.None;
                return(false);
            }
            var sublibraryIndex = library.Sublibraries.IndexOf(sublibrary);
            var assetIndex      = sublibrary.Assets.IndexOf(asset);

            var platformConfig = InfoManager.PlatformConfigurations.GetOrDefault(platform);

            if (platformConfig != null)
            {
                var platformSet = platformConfig.GetSet(setId);
                if (platformSet != null &&
                    platformSet.Libraries.ContainsKey(group) == true)
                {
                    var platformLibrary = platformSet.Libraries[group];
                    if (platformLibrary.SublibraryRemappingAtoB != null &&
                        platformLibrary.SublibraryRemappingAtoB.Count > 0)
                    {
                        if (platformLibrary.SublibraryRemappingAtoB.ContainsKey(sublibraryIndex) == false)
                        {
                            throw new InvalidOperationException(
                                      string.Format("don't know how to remap sublibrary {0} for set {1}!",
                                                    sublibraryIndex,
                                                    setId));
                        }
                        sublibraryIndex = platformLibrary.SublibraryRemappingAtoB[sublibraryIndex];
                    }
                }
            }

            packed = new Items.PackedAssetReference(assetIndex, sublibraryIndex, setId != 0);
            return(true);
        }
예제 #31
0
        public void NotContains()
        {
            var valid    = new TestAsset(1, Array.Empty <IComponent>());
            var notValid = new Asset(2, Array.Empty <IComponent>());

            var filter = new AssetGroup <TestAsset>(new[] { valid, notValid });

            filter.Should().Contain(asset => asset.Id == valid.Id);
            filter.Should().NotContain(asset => asset.Id == notValid.Id);
        }
예제 #32
0
            private static string[] GetMergedAssets(AssetGroup group, int setId)
            {
                IEnumerable<string> assets;

                assets = InfoManager.AssetLibraryManager.GetSet(0).Libraries[group].GetAssets();
                if (setId != 0)
                {
                    assets = assets.Concat(InfoManager.AssetLibraryManager.GetSet(setId).Libraries[group].GetAssets());
                }

                return assets.Distinct().OrderBy(p => p).ToArray();
            }
        public static void Encode(this AssetLibraryManager alm,
                                  BitWriter writer,
                                  int setId,
                                  AssetGroup group,
                                  string value)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (string.IsNullOrEmpty(value) == true)
            {
                throw new ArgumentNullException("value");
            }

            var config = alm.Configurations[group];

            uint index;
            if (value == "None")
            {
                index = config.NoneIndex;
            }
            else
            {
                var parts = value.Split(new[]
                {
                    '.'
                },
                                        2);
                if (parts.Length != 2)
                {
                    throw new ArgumentException();
                }

                var package = parts[0];
                var asset = parts[1];

                if (alm.GetIndex(setId, group, package, asset, out index) == false)
                {
                    if (alm.GetIndex(0, group, package, asset, out index) == false)
                    {
                        throw new ArgumentException("unsupported asset");
                    }
                }
            }

            writer.WriteUInt32(index, config.SublibraryBits + config.AssetBits);
        }
예제 #34
0
            public string[] this[AssetGroup group]
            {
                get
                {
                    lock (this._AssetLibraryCacheLock)
                    {
                        if (this._Assets.ContainsKey(group) == false)
                        {
                            return this._Assets[group] = GetMergedAssets(group, this._SetId);
                        }

                        return this._Assets[group];
                    }
                }
            }
 protected AssetValidationRule(AssetGroup group)
 {
     this._Group = group;
 }
        public static string Decode(this AssetLibraryManager alm, BitReader reader, int setId, AssetGroup group)
        {
            var config = alm.Configurations[group];

            var index = reader.ReadUInt32(config.SublibraryBits + config.AssetBits);
            if (index == config.NoneIndex)
            {
                return "None";
            }

            var assetIndex = (int)((index >> 0) & config.AssetMask);
            var sublibraryIndex = (int)((index >> config.AssetBits) & config.SublibraryMask);
            var useSetId = ((index >> config.AssetBits) & config.UseSetIdMask) != 0;

            var set = alm.GetSet(useSetId == false ? 0 : setId);
            var library = set.Libraries[group];

            if (sublibraryIndex < 0 || sublibraryIndex >= library.Sublibraries.Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            return library.Sublibraries[sublibraryIndex].GetAsset(assetIndex);
        }