Ejemplo n.º 1
0
        public virtual void ConnectEntity(string EntityTypeName)
        {
            MonsterTestState NewState = (MonsterTestState)TypeUtils.GetNewObjectOfTypeString(EntityTypeName);

            NewState.CreateStaticNodesIfNotPresent();

            MonsterTestBaseBox NewBox = SetupNewBox(EntityTypeName, NewState);

            if (NewBox.GetAllAnchors().Count > 0)
            {
                Anchor <MonsterTestBase> NewBoxAnchor = NewBox.GetAllAnchors()[0];

                ConnectInputToOutput(NewBoxAnchor, StartingAnchorForNewBox);
            }
        }
Ejemplo n.º 2
0
        public virtual void EntityToFilename(ref EntityType SourceEntity, ref string SavedFilename)
        {
            if (SourceEntity != null)
            {
                SavedFilename = SourceEntity.GetEntityName() + ":=:" + SourceEntity.GetFilename();
            }
            else if (SavedFilename != null)
            {
                string[] Delimiters     = { ":=:" };
                string[] NameTypeString = SavedFilename.Split(Delimiters, System.StringSplitOptions.None);
                string   TypeString     = NameTypeString[0];
                string   NameString     = NameTypeString[1];

                CreateOrUpdateEntityFromFilename(NameString, ref Entities, TypeUtils.GetNewObjectOfTypeString(TypeString), TypeUtils.GetXMLSerializerForTypeString(TypeString));
            }
        }
Ejemplo n.º 3
0
        public virtual void AddEntity(string EntityTypeName)
        {
            MonsterTestState NewState = (MonsterTestState)TypeUtils.GetNewObjectOfTypeString(EntityTypeName);

            SetupNewBox(EntityTypeName, NewState);
        }
Ejemplo n.º 4
0
        public void SerializeDictionaryStringEmbedded <ValueType>(string ListName, string KeyName, string ValueName, ref Dictionary <string, ValueType> DictionaryToSerialize)
            where ValueType : XMLSerializable, new()
        {
            if (bReading)
            {
                bool isEmptyElement = InternalReader.IsEmptyElement;
                InternalReader.ReadStartElement(ListName);

                if (!isEmptyElement)
                {
                    int CurrentDepth = InternalReader.Depth;
                    while (InternalReader.Depth >= CurrentDepth)
                    {
                        string NewKey = "";

                        SerializeString(KeyName, ref NewKey);

                        ValueType NewValue = new ValueType();

                        if (InternalReader.IsStartElement())
                        {
                            string NextElementType = InternalReader.Name;

                            object Temp = TypeUtils.GetNewObjectOfTypeString(NextElementType);

                            if (typeof(ValueType).IsAssignableFrom(Temp.GetType()))
                            {
                                NewValue = (ValueType)Temp;
                            }

                            bReadStartElement = true;
                        }

                        XMLSerializable.SerializeFromXMLEmbedded <ValueType>(ref InternalReader, ref InternalWriter, ref NewValue);
                        NewValue = (ValueType)NewValue.ResolveIDPatching();

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

                        if (NewValue == null)
                        {
                            NewValue = new ValueType();
                        }

                        DictionaryToSerialize.Add(NewKey, NewValue);
                    }
                    InternalReader.ReadEndElement();
                }
            }
            else
            {
                InternalWriter.WriteStartElement(ListName);
                if (DictionaryToSerialize.Count > 0)
                {
                    foreach (KeyValuePair <string, ValueType> CurrentElement in DictionaryToSerialize)
                    {
                        string RefCurrentKey = CurrentElement.Key;
                        SerializeString(KeyName, ref RefCurrentKey);
                        ValueType RefCurrentValue = CurrentElement.Value;
                        XMLSerializable.SerializeFromXMLEmbedded <ValueType>(ref InternalReader, ref InternalWriter, ref RefCurrentValue);
                    }
                }
                InternalWriter.WriteEndElement();
            }
        }