コード例 #1
0
        private CswDelimitedString _parseRealKey(string InRealKey)
        {
            CswDelimitedString RealKey = new CswDelimitedString('_');

            RealKey.FromString(InRealKey);
            return(RealKey);
        }
コード例 #2
0
ファイル: CswNbtViewId.cs プロジェクト: crfroehlich/legacy
        public CswNbtViewId(string ViewIdString)
        {
            CswDelimitedString delimstr = new CswDelimitedString(_delimiter);

            delimstr.FromString(ViewIdString);
            _ViewId = CswConvert.ToInt32(delimstr[1]);
        }
コード例 #3
0
        } // ToJSON()

        public override void ReadDataRow(DataRow PropRow, Dictionary <string, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            CswDelimitedString NewValue = new CswDelimitedString(Delimiter);

            NewValue.FromString(CswTools.XmlRealAttributeName(PropRow[_ValueSubField.ToXmlNodeName()].ToString()));
            Value = NewValue;
        }
コード例 #4
0
        public CswNbtSessionDataId(string SessionDataIdString)
        {
            CswDelimitedString delimstr = new CswDelimitedString(_delimiter);

            delimstr.FromString(SessionDataIdString);
            _SessionDataId = CswConvert.ToInt32(delimstr[1]);
        }
コード例 #5
0
        /// <summary>
        /// Use this constructor to convert the key from the string representation of a key
        /// </summary>
        public CswNbtNodeKey(string StringKey)
        {
            if (StringKey == string.Empty)
            {
                throw new CswDniException(CswEnumErrorType.Error, "Misconfigured Tree", "CswNbtNodeKey.constructor(string) encountered a null StringKey");
            }

            _DelimitedString.FromString(StringKey);
        }//CswNbtNodeKey()
コード例 #6
0
ファイル: CswNbtViewId.cs プロジェクト: crfroehlich/legacy
        public static bool isViewIdString(string TestString)
        {
            CswDelimitedString delimstr = new CswDelimitedString(_delimiter);

            delimstr.FromString(TestString);

            return(delimstr.Count == 2 &&
                   delimstr[0].ToLower() == _StringPrefix.ToLower() &&
                   CswTools.IsInteger(delimstr[1]));
        }
コード例 #7
0
        public static bool isSessionDataIdString(string TestString)
        {
            CswDelimitedString delimstr = new CswDelimitedString(_delimiter);

            delimstr.FromString(TestString);

            return(delimstr.Count == 2 &&
                   delimstr[0] == _StringPrefix &&
                   CswTools.IsInteger(delimstr[1]));
        }
コード例 #8
0
 protected override void afterPopulateProps()
 {
     if (Type.RelatedNodeId != null)
     {
         CswNbtNode TypeNode = _CswNbtResources.Nodes[Type.RelatedNodeId];
         if (TypeNode != null)
         {
             CswNbtObjClassEquipmentType TypeNodeAsType = (CswNbtObjClassEquipmentType)TypeNode;
             CswDelimitedString          PartsString    = new CswDelimitedString('\n');
             PartsString.FromString(TypeNodeAsType.Parts.Text.Replace("\r", ""));
             AssemblyParts.YValues = PartsString;
         }
     }
 }//afterPopulateProps()
コード例 #9
0
        } // _runTreeNodesRecursive()

        public JObject getNode(string NodeId)
        {
            CswDelimitedString NodeStr = new CswDelimitedString('_');

            NodeStr.FromString(NodeId);
            if (NodeStr[0] == "nodeid")
            {
                NodeStr.RemoveAt(0);
            }
            string  NodePk = NodeStr.ToString();
            JObject Ret    = new JObject();

            Ret.Add(_getNode(NodePk, true));
            return(Ret);
        }
コード例 #10
0
        public override void ReadJSON(JObject JObject, Dictionary <Int32, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            if (null != JObject[_ValueSubField.ToXmlNodeName(true)])
            {
                CswDelimitedString NewValue = new CswDelimitedString(Delimiter);
                NewValue.FromString(JObject[_ValueSubField.ToXmlNodeName(true)].ToString());

                if (false == AllowMultiple)
                {
                    string SingleValue = NewValue[0];
                    NewValue.Clear();
                    NewValue.Add(SingleValue);
                }
                Value = NewValue;
            }
        }
コード例 #11
0
        protected override void afterPopulateProps()
        {
            // CertDef Specs do not have levels...?
            //// CIS-52299: "Limits" are required if certdef's level's labuseonly is false, hidden otherwise
            //CswNbtObjClassCertDefSpec CertDefSpecNode = _CswNbtResources.Nodes[CertDefSpec.RelatedNodeId];
            //if( null != CertDefSpecNode )
            //{
            //    CswNbtObjClassLevel LevelNode = _CswNbtResources.Nodes[CertDefSpec.Level.RelatedNodeId];
            //    if( null != LevelNode )
            //    {
            //        if( LevelNode.LabUseOnly.Checked == CswEnumTristate.True )
            //        {
            //            Limits.TemporarilyRequired = true;
            //        }
            //        else
            //        {
            //            Limits.setHidden( true, true );
            //        }
            //    }
            //}

            CswNbtObjClassMethodCharacteristic MethodCharNode = _CswNbtResources.Nodes[MethodCharacteristic.RelatedNodeId];

            if (null != MethodCharNode)
            {
                // CIS-52299: "Pass Options" list options come from Method Characteristic's "Result Options" Memo property
                PassOptions.InitOptions = delegate
                {
                    Dictionary <string, string> ret  = new Dictionary <string, string>();
                    CswDelimitedString          opts = new CswDelimitedString('\n');
                    opts.FromString(MethodCharNode.ResultOptions.Text.Replace(',', '\n'), true, true);
                    foreach (string opt in opts)
                    {
                        ret.Add(opt, opt);
                    }
                    return(ret);
                };

                // CIS-52299: Round limits to precision defined on method characteristic
                Limits.Precision = CswConvert.ToInt32(MethodCharNode.Precision.Value);
            }
            base.afterPopulateProps();
        } // afterPopulateProps()
コード例 #12
0
        public void onBeforeWriteDesignNode(CswNbtObjClassDesignNodeTypeProp DesignNTPNode)
        {
            CswNbtNodePropText OptionsProp = DesignNTPNode.AttributeProperty[AttributeName.Options].AsText;
            CswDelimitedString ListOptions = new CswDelimitedString(',');

            ListOptions.FromString(OptionsProp.Text.Trim());
            List <string> ValidOptions = new List <string>();

            for (int i = 0; i < ListOptions.Count; i++)
            {
                if (ValidOptions.Contains(ListOptions[i]))
                {
                    throw new CswDniException(CswEnumErrorType.Warning, "All options must be unique", "Duplicate option: " + ListOptions[i]);
                }
                else
                {
                    ValidOptions.Add(ListOptions[i]);
                }
            }
        }
コード例 #13
0
        public void onBeforeWriteDesignNode(CswNbtObjClassDesignNodeTypeProp DesignNTPNode)
        {
            CswNbtNodePropMemo NameOptionsProp = DesignNTPNode.AttributeProperty[AttributeName.ImageNames].AsMemo;
            CswNbtNodePropMemo UrlOptionsProp  = DesignNTPNode.AttributeProperty[AttributeName.ImageUrls].AsMemo;
            CswDelimitedString ListOptions     = new CswDelimitedString('\n');

            ListOptions.FromString(NameOptionsProp.Text.Trim());
            CswDelimitedString ValueOptions = new CswDelimitedString('\n');

            ValueOptions.FromString(UrlOptionsProp.Text.Trim());
            Dictionary <string, string> ValidOptions = new Dictionary <string, string>();

            for (int i = 0; i < ValueOptions.Count; i++)
            {
                if (ValidOptions.Keys.Contains(ListOptions[i]) || ValidOptions.Values.Contains(ValueOptions[i]))
                {
                    throw new CswDniException(CswEnumErrorType.Warning, "Image Names and URLs must be unique", "");
                }
                else
                {
                    ValidOptions.Add(ListOptions[i], ValueOptions[i]);
                }
            }
        }
コード例 #14
0
        private void _makeNbtTreeNode(CswNbtTreeNode ParentNode,
                                      string ElemName,
                                      CswPrimaryKey NodeId,
                                      string NodeName,
                                      Int32 NodeTypeId,
                                      Int32 ObjectClassId,
                                      string Icon,
                                      bool Selectable,
                                      CswNbtViewNode ViewNode,
                                      CswEnumNbtNodeSpecies Species,
                                      bool ShowInTree,
                                      bool Locked,
                                      bool Included,
                                      bool Favorited,
                                      CswPrimaryKey RelationalId,
                                      out CswNbtTreeNode NewNode,
                                      out CswNbtNodeKey NewNodeKey)
        {
            // Make the object
            NewNode = new CswNbtTreeNode(NodeId, NodeName, NodeTypeId, ObjectClassId, RelationalId)
            {
                ElementName  = ElemName,
                IconFileName = Icon,
                Selectable   = Selectable,
                ShowInTree   = ShowInTree,
                Locked       = Locked,
                Included     = Included,
                Favorited    = Favorited,
                ChildNodes   = new Collection <CswNbtTreeNode>(),
                ChildProps   = new Collection <CswNbtTreeNodeProp>()
            };

            CswNbtNodeKey      ParentNodeKey = null;
            CswDelimitedString NodeCountPath = new CswDelimitedString(CswNbtNodeKey.NodeCountDelimiter);

            if (ParentNode != null)
            {
                ParentNodeKey = _getKey(ParentNode);
                string ParentNodeCountPath = ParentNodeKey.NodeCountPath.ToString();
                NodeCountPath.FromString(ParentNodeCountPath);
                NodeCountPath.Add(((ParentNode.ChildNodes.Count()) + 1).ToString());
                ParentNode.ChildNodes.Add(NewNode);
                NewNode.ParentNode = ParentNode;
            }

            // Make the key
            NewNodeKey               = new CswNbtNodeKey();
            NewNodeKey.TreeKey       = _CswNbtTreeKey;
            NewNodeKey.NodeSpecies   = Species;
            NewNodeKey.NodeCountPath = NodeCountPath;
            if (NewNode.ElementName == Elements.Node)
            {
                NewNodeKey.NodeId        = NodeId;
                NewNodeKey.NodeTypeId    = NodeTypeId;
                NewNodeKey.ObjectClassId = ObjectClassId;
                if (ViewNode != null)
                {
                    NewNodeKey.ViewNodeUniqueId = ViewNode.UniqueId;
                }
            }
            else if (NewNode.ElementName == Elements.Tree || NewNode.ElementName == Elements.Group)
            {
                // Nothing
            }
            else if (NewNode.ElementName == Elements.Prop)
            {
                throw (new CswDniException("_makeNbtTreeNode called on an NbtNodeProp element"));
            }
            else
            {
                throw (new CswDniException("Unknown element: " + NewNode.ElementName));
            }

            // Dictionaries
            if (NodeId != null)
            {
                if (false == NodesById.ContainsKey(NodeId))
                {
                    NodesById.Add(NodeId, new Collection <CswNbtNodeKey>());
                }
                NodesById[NodeId].Add(NewNodeKey);
            }
            if (ParentNodeKey != null && !NodesAndParents.ContainsKey(NewNodeKey))
            {
                NodesAndParents.Add(NewNodeKey, ParentNodeKey);
            }

            NewNode.NodeKey = NewNodeKey;
        }
コード例 #15
0
 public CswPropIdAttr(string PropIdAttr)
 {
     _DelimitedString = new CswDelimitedString(PropIdDelim);
     _DelimitedString.FromString(PropIdAttr);
 }
コード例 #16
0
        public void assignPropsToLocations( string LocationNodeKeys, bool UpdateInventoryGroup, string SelectedInventoryGroupNodeId, bool UpdateAllowInventory, string AllowInventory, bool UpdateControlZone, string SelectedControlZoneNodeId, bool UpdateStorageCompatability, string SelectedImages )
        {

            if( false == string.IsNullOrEmpty( LocationNodeKeys ) )
            {


                ///we don't pre-load he allowinventory value because there's no extra expense
                ///to doing so repeatedly in the loop

                CswNbtNode InventoryGroupNode = null;
                if( ( true == UpdateInventoryGroup ) && ( false == string.IsNullOrEmpty( SelectedInventoryGroupNodeId ) ) )
                {
                    CswPrimaryKey IGKey = new CswPrimaryKey();
                    IGKey.FromString( SelectedInventoryGroupNodeId );
                    InventoryGroupNode = _CswNbtResources.Nodes[IGKey];
                }

                CswNbtNode ControlZoneNode = null;
                if( ( true == UpdateControlZone ) && ( false == string.IsNullOrEmpty( SelectedControlZoneNodeId ) ) )
                {
                    CswPrimaryKey IGKey = new CswPrimaryKey();
                    IGKey.FromString( SelectedControlZoneNodeId );
                    ControlZoneNode = _CswNbtResources.Nodes[IGKey];
                }



                CswDelimitedString Images = new CswDelimitedString( ',' );
                if( true == UpdateStorageCompatability )
                {
                    if( false == string.IsNullOrEmpty( SelectedImages ) )
                    {
                        Images.FromString( SelectedImages );
                    }
                }



                foreach( string CurrentLocationKey in LocationNodeKeys.Split( ',' ) )
                {
                    if( false == string.IsNullOrEmpty( CurrentLocationKey ) )
                    {
                        CswNbtNodeKey LKey = new CswNbtNodeKey( CurrentLocationKey );
                        CswNbtObjClassLocation CurrentLocationNode = _CswNbtResources.Nodes[LKey];
                        if( null != CurrentLocationNode )
                        {

                            if( true == UpdateInventoryGroup )
                            {
                                if( null != InventoryGroupNode )
                                {
                                    CurrentLocationNode.InventoryGroup.RelatedNodeId = InventoryGroupNode.NodeId;
                                }
                                else
                                {
                                    CurrentLocationNode.InventoryGroup.RelatedNodeId = null;
                                }
                            }

                            if( true == UpdateControlZone )
                            {
                                if( null != ControlZoneNode )
                                {
                                    CurrentLocationNode.ControlZone.RelatedNodeId = ControlZoneNode.NodeId;
                                }
                                else
                                {
                                    CurrentLocationNode.ControlZone.RelatedNodeId = null;
                                }
                            }
                            

                            if( UpdateAllowInventory )
                            {
                                CurrentLocationNode.AllowInventory.Checked = CswConvert.ToTristate( AllowInventory );
                            }

                            if( UpdateStorageCompatability )
                            {
                                CurrentLocationNode.StorageCompatibility.Value = Images;
                            }

                            CurrentLocationNode.postChanges( true );

                        }//if current key yielded a node

                    } //if there is a location keye

                } //iterate locations


            }//if we have location keys

        }//assignInventoryGroupToLocations()