Beispiel #1
0
        public void Extensions_Dictionary_Clone()
        {
            Dictionary <string, int> dictionary = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase);
            Dictionary <string, int> clone;

            clone = dictionary.Clone(StringComparer.OrdinalIgnoreCase);
            Assert.AreEqual(0, clone.Count);

            dictionary.Add("Foo", 0);
            dictionary.Add("Bar", 1);
            dictionary.Add("Hello", 2);

            clone = dictionary.Clone(StringComparer.OrdinalIgnoreCase);
            Assert.AreEqual(3, clone.Count);
            Assert.AreEqual(0, clone["FOO"]);
            Assert.AreEqual(1, clone["BAR"]);
            Assert.AreEqual(2, clone["HELLO"]);

            clone = dictionary.Clone(null);
            Assert.AreEqual(3, clone.Count);
            Assert.AreEqual(0, clone["Foo"]);
            Assert.AreEqual(1, clone["Bar"]);
            Assert.AreEqual(2, clone["Hello"]);

            clone = dictionary.Clone(StringComparer.OrdinalIgnoreCase, entry => new KeyValuePair <string, int>(entry.Key + "-A", entry.Value + 10));
            Assert.AreEqual(3, clone.Count);
            Assert.AreEqual(10, clone["Foo-A"]);
            Assert.AreEqual(11, clone["Bar-A"]);
            Assert.AreEqual(12, clone["Hello-A"]);
        }
Beispiel #2
0
        public virtual ISetAccessor <Tdb, Tset> With <Trelated>(Expression <Func <Tset, ICollection <Trelated> > > target, Expression <Func <ICollection <Trelated>, IEnumerable <Trelated> > > value)
        {
            var newFilters = _relatedEntityFilters.Clone();

            newFilters.Add(target, value);
            return(new SetAccessor <Tdb, Tset>(_parent, _filter, newFilters, _usingRelationships.Clone()));
        }
        public void CloneTest()
        {
            Dictionary <int, int> attr = null;

            var attrNew = attr.Clone();

            Assert.Null(attrNew);

            attr    = GetBaseDic();
            attrNew = attr.Clone();
            Assert.NotNull(attrNew);
            Assert.NotNull(attr);
            Assert.Equal(attr.Count, attrNew.Count);
            Assert.Equal(attr[1], attrNew[1]);
            Assert.Equal(attr[3], attrNew[3]);
        }
Beispiel #4
0
        protected override void apply(Type pluginType, IConfiguredInstance instance)
        {
            if (_propertyDefaultsType != pluginType)
            {
                throw new ArgumentException($"Unexpected type being built. Expected: {_propertyDefaultsType.Name}, but instead received: {pluginType.Name}. This is an issue with CherryPicker, please raise an issue with recreatable steps in order for it to be fixed. Thank you!", nameof(pluginType));
            }

            //Take a Clone of the defaults as they are Cleared when a property is set to AutoBuild
            //i.e. the AutoBuild calls GetInstance on StructureMap and the first thing it does is
            //to clear the defaults and replace them as this class is a Singleton.
            var propertyDefaultsCopy = _propertyDefaults.Clone();

            foreach (var propertyDefault in propertyDefaultsCopy)
            {
                var propertyValue = propertyDefault.Value.Build();
                //PropertyValue can be null when the user specifies the property value as null
                //StructureMap throws an exception when a null value is passed into its Dependencies
                if (propertyValue == null)
                {
                    continue;
                }

                var property     = instance.SettableProperties().FirstOrDefault(prop => prop.Name == propertyDefault.Key);
                var propertyType = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType;
                instance.Dependencies.Add(property.Name, propertyType, propertyValue);
            }
        }
        public void Clone_DictionaryAndComparer_ShouldUseComparer()
        {
            var valueA = new List <string> {
                "ValueA", "Valuea"
            };
            var valueB = new List <string> {
                "Valueb", "ValueB"
            };

            var source = new Dictionary <string, ICollection <string> >
            {
                { "A", valueA },
                { "B", valueB },
            };

            var clone = source.Clone(new OrdinalIgnoreCaseComparer());

            Assert.NotNull(clone);
            Assert.Equal(source.Count, clone.Count);

            Assert.True(clone.ContainsKey("b"));
            Assert.Equal(valueA, clone["a"]);

            var newValueA = new List <string> {
                "newValueA"
            };

            clone["a"] = newValueA;

            Assert.Equal(2, clone.Count);
            Assert.Same(newValueA, clone["A"]);
            Assert.Same(newValueA, clone["a"]);
        }
 public object Clone()
 {
     return(new OrderManager
     {
         orders = orders.Clone() as Dictionary <uint, Order>
     });
 }
Beispiel #7
0
        static int Part2()
        {
            isFinished = false;
            acc        = 0;
            foreach (var item in instructions)
            {
                if (isFinished)
                {
                    break;
                }

                var copy = instructions.Clone();

                switch (copy[item.Key].Split()[0])
                {
                case "nop":
                    copy[item.Key] = copy[item.Key].Replace("nop", "jmp");
                    ProcessInstruction(copy.First());
                    break;

                case "jmp":
                    copy[item.Key] = copy[item.Key].Replace("jmp", "nop");
                    ProcessInstruction(copy.First());
                    break;
                }
            }

            return(acc);
        }
Beispiel #8
0
        public Dictionary <Coord, MapType> GetChanges()
        {
            var changecpy = change.Clone();

            change.Clear();
            return(changecpy);
        }
        public void Clone_DictionaryAndComparer_ShouldUseDefaultEqualityComparerWhenComparerIsNull()
        {
            var valueA = new List <string> {
                "ValueA", "Valuea"
            };
            var valueB = new List <string> {
                "Valueb", "ValueB"
            };

            var source = new Dictionary <string, ICollection <string> >
            {
                { "A", valueA },
                { "B", valueB },
            };

            var clone = source.Clone(null);

            Assert.NotNull(clone);
            Assert.Equal(source.Count, clone.Count);

            Assert.False(clone.ContainsKey("b"));

            var newValueA = new List <string> {
                "newValueA"
            };

            clone["a"] = newValueA;

            Assert.Equal(3, clone.Count);
            Assert.Equal(valueA, clone["A"]);
            Assert.Same(newValueA, clone["a"]);
        }
 internal MessageDeferredToDestination(string destinationAddress, TimeSpan delay, object commandMessage, Dictionary <string, string> optionalHeaders, DateTimeOffset time) : base(time)
 {
     DestinationAddress = destinationAddress;
     Delay           = delay;
     CommandMessage  = commandMessage ?? throw new ArgumentNullException(nameof(commandMessage));
     OptionalHeaders = optionalHeaders?.Clone();
 }
Beispiel #11
0
 public override SerializableValue Clone()
 {
     return(new ObjectValue {
         _stringValues = _stringValues.Clone(),
         _integerValues = _integerValues.Clone()
     });
 }
Beispiel #12
0
        public void PopScope()
        {
            if (Variables.Count < 2)
            {
                throw new InterpreterException("Attempted to pop scope in an invalid context!");
            }
            Dictionary <string, object> current = Variables.Pop(); // Current scope
            Dictionary <string, object> prev    = Variables.Pop(); // Previous scope

            if (InsideFunction)                                    // Don't modify variables outside of scope
            {
                Variables.Push(prev);
                return;
            }

            Dictionary <string, object> temp = prev.Clone();

            // If variable in previous scope is changed in the current scope, update it
            foreach (KeyValuePair <string, object> kv in prev)
            {
                if (current.ContainsKey(kv.Key))
                {
                    temp[kv.Key] = current[kv.Key];
                }
            }
            Variables.Push(temp);
        }
Beispiel #13
0
        private static int[][] GetSimpleAnswer(this Dictionary <Axis, bool> start, Dictionary <Axis, bool> end, Axis[] order, bool includeOrderChecks = false)
        {
            List <int[]> output   = new List <int[]>();
            var          newStart = start.Clone();

            if (includeOrderChecks)
            {
                for (int i = 0; i < newStart.Count - 1; i++)
                {
                    output.Add(new[] { i });
                    newStart[order[i]] = !newStart[order[i]];
                }
            }

            for (int i = 0; i < newStart.Count; i++)
            {
                if (newStart[order[i]] != end[order[i]])
                {
                    output.Add(new[] { i });
                    newStart[order[i]] = !newStart[order[i]];
                }
            }

            if (output.Any(i => i.Contains(-1)))
            {
                throw new IndexOutOfRangeException("i has -1: " + output.Select(i => i.Join("")).Join(", "));
            }
            return(output.ToArray());
        }
    /// <summary>
    /// Tests the dictionary methods.
    /// </summary>
    private static void TestDictionary()
    {
        Console.WriteLine("Dictionary Test:");
        Console.WriteLine(string.Empty);
        var dictionary = new Dictionary <string, string>();

        dictionary.AddIfNotExists("a", "abc");
        dictionary.AddIfNotExists("a", "abc");
        dictionary.AddIfNotExists("b", "def");
        PrintDictionaryToConsole(dictionary);
        dictionary.Update("b", "defg");
        PrintDictionaryToConsole(dictionary);
        var pair = dictionary.First(x => x.Key.Equals("b"));

        dictionary.Update(pair);
        PrintDictionaryToConsole(dictionary);
        dictionary.DeleteIfExistsKey("a");
        PrintDictionaryToConsole(dictionary);
        dictionary.DeleteIfExistsValue("defg");
        PrintDictionaryToConsole(dictionary);
        Print(dictionary.AreKeysNull());
        Print(dictionary.AreValuesNull());
        var dict1 = new Dictionary <string, string>();
        var dict2 = dict1.Clone();

        dict2.Add("1", "1");
        PrintDictionaryToConsole(dict1);
        PrintDictionaryToConsole(dict2);
    }
        /// <summary>
        /// 在指定索引位置插入新数据
        /// </summary>
        /// <typeparam name="TK">Key类型</typeparam>
        /// <typeparam name="TV">Value类型</typeparam>
        /// <param name="attr">字典</param>
        /// <param name="index">要插入的索引位置(0-Count)</param>
        /// <param name="newKey">新数据的Key</param>
        /// <param name="newValue">新数据的Value</param>
        /// <returns>插入成功Or失败</returns>
        public static bool Insert <TK, TV>(this Dictionary <TK, TV> attr, int index, TK newKey, TV newValue)
        {
            if (attr == null || newKey == null || index > attr.Count)
            {
                return(false);
            }

            // 先copy到Temp字典
            Dictionary <TK, TV> tempAttr = attr.Clone();

            attr.Clear();

            bool isInsert = false;
            int  number   = 0;

            foreach (var key in tempAttr.Keys)
            {
                if (number++ == index)
                {
                    isInsert     = true;
                    attr[newKey] = newValue;
                }

                attr[key] = tempAttr[key];
            }

            if (number++ == index)
            {
                isInsert     = true;
                attr[newKey] = newValue;
            }

            return(isInsert);
        }
Beispiel #16
0
 public InMemBlob(Dictionary<string, string> metadata, byte[] data)
 {
     if (metadata == null) throw new ArgumentNullException(nameof(metadata));
     if (data == null) throw new ArgumentNullException(nameof(data));
     Metadata = metadata.Clone();
     Data = data;
 }
Beispiel #17
0
        /// <summary>
        /// Gera uma cópia do histórico de vizinhos, adicionando nessa cópia o array de
        /// alunos embaralhados que foi passado por parâmetro.
        /// </summary>
        public Dictionary <string, List <Vizinho> > ObterHistoricoProjetadoComNovoEmbaralhamento(string[] alunosEmbaralhados)
        {
            var historicoAntigo = historicoVizinhos.Clone();

            PopulaDictionaryHistoricos(alunosEmbaralhados, historicoAntigo);

            return(historicoAntigo);
        }
Beispiel #18
0
 internal MessageSentToSelf(object commandMessage, Dictionary <string, string> optionalHeaders)
 {
     if (commandMessage == null)
     {
         throw new ArgumentNullException(nameof(commandMessage));
     }
     CommandMessage  = commandMessage;
     OptionalHeaders = optionalHeaders?.Clone();
 }
Beispiel #19
0
        public TypeResolver Clone(string baseNamespace = null)
        {
            var resolver = new TypeResolver(baseNamespace ?? _baseNamespace)
            {
                _resolvedEnumerations = _resolvedEnumerations.Clone()
            };

            return(resolver);
        }
Beispiel #20
0
 internal ReplyMessageSent(object replyMessage, Dictionary <string, string> optionalHeaders)
 {
     if (replyMessage == null)
     {
         throw new ArgumentNullException(nameof(replyMessage));
     }
     ReplyMessage    = replyMessage;
     OptionalHeaders = optionalHeaders?.Clone();
 }
 /// <summary>
 /// get a new log item text formatter by cloning this
 /// </summary>
 /// <returns></returns>
 public ILogItemTextFormatter Clone()
 {
     return(new LogItemTextFormatter <T>()
     {
         LogItemToStringColumnsSeparator = LogItemToStringColumnsSeparator,
         AvailableColumns = AvailableColumns.Clone(),
         MinColumnSize = MinColumnSize.Clone()
     });
 }
Beispiel #22
0
 internal MessagePublished(object eventMessage, Dictionary <string, string> optionalHeaders)
 {
     if (eventMessage == null)
     {
         throw new ArgumentNullException(nameof(eventMessage));
     }
     EventMessage    = eventMessage;
     OptionalHeaders = optionalHeaders?.Clone();
 }
        public static SubstituteConstantsResultWithValues SubstituteConstants(Expression expression)
        {
            object[] args = null;
            SubstituteConstantsResult result;

            if (!cachedSubstitutedExpressions.TryGetValue(expression, out result))
            {
                var values     = new List <object>();
                var parameters = new List <ParameterExpression>();

                var replacement = SqlExpressionReplacer.Replace(expression, c =>
                {
                    if (c.NodeType != ExpressionType.Constant)
                    {
                        return(null);
                    }

                    var constantExpression = (ConstantExpression)c;

                    values.Add(constantExpression.Value);
                    var parameter = Expression.Parameter(constantExpression.Type);
                    parameters.Add(parameter);

                    return(parameter);
                });

                args = values.ToArray();
                var parametersArray = parameters.ToArray();

                result = new SubstituteConstantsResult(replacement, parametersArray);

                cachedSubstitutedExpressions = cachedSubstitutedExpressions.Clone(expression, result, "cachedSubstitutedExpressions");
            }

            if (args == null)
            {
                var i = 0;
                args = new object[result.AdditionalParameters.Length];

                SqlExpressionReplacer.Replace(expression, c =>
                {
                    if (c.NodeType != ExpressionType.Constant)
                    {
                        return(null);
                    }

                    var constantExpression = (ConstantExpression)c;

                    args[i++] = constantExpression.Value;

                    return(null);
                });
            }

            return(new SubstituteConstantsResultWithValues(result, args));
        }
Beispiel #24
0
 public GameInstance Create(float x, float y) => new GameInstance(name, sprite_index, x, y)
 {
     local          = local.Clone(),
     event_create   = event_create,
     event_keyboard = event_keyboard,
     event_step     = event_step,
     image_index    = image_index,
     image_size     = image_size,
     image_speed    = image_speed
 };
Beispiel #25
0
 internal MessageDeferred(TimeSpan delay, object commandMessage, Dictionary <string, string> optionalHeaders)
 {
     if (commandMessage == null)
     {
         throw new ArgumentNullException(nameof(commandMessage));
     }
     Delay           = delay;
     CommandMessage  = commandMessage;
     OptionalHeaders = optionalHeaders?.Clone();
 }
        public static Dictionary <K, V> RemoveKeys <K, V>(this Dictionary <K, V> @this, IEnumerable <K> excludedKeys)
        {
            var newDict = @this.Clone();

            foreach (var excludedKey in excludedKeys)
            {
                newDict.Remove(excludedKey);
            }

            return(newDict);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionDataCollection" class
        /// from a previous instance of <see cref="SectionDataCollection".
        /// </summary>
        /// <remarks>
        /// Data is deeply copied
        /// </remarks>
        /// <param name="ori">
        /// The instance of the <see cref="SectionDataCollection" class
        /// used to create the new instance.</param>
        public SectionDataCollection(SectionDataCollection ori, IEqualityComparer <string> searchComparer)
        {
            this.searchComparer = searchComparer ?? EqualityComparer <string> .Default;

            sectionData = new Dictionary <string, SectionData>(this.searchComparer);
            foreach (var sectionData in ori)
            {
                this.sectionData.Add(sectionData.SectionName, (SectionData)sectionData.Clone());
            }
            ;
        }
Beispiel #28
0
 public Node(Dictionary <Node, float> weights, float bias, bool isInput = false)
 {
     this.weights          = weights;
     TrainingWeightsSmudge = weights.Clone();
     foreach (var w in TrainingWeightsSmudge)
     {
         TrainingWeightsSmudge[w.Key] = 0;
     }
     this.bias    = bias;
     this.isInput = isInput;
 }
Beispiel #29
0
 System.Collections.IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator()
 {
     lock (locker)
         if (InternalObject == null)
         {
             return((new Dictionary <TKey, TValue>() as System.Collections.IDictionary).GetEnumerator());
         }
         else
         {
             return((InternalObject.Clone() as System.Collections.IDictionary).GetEnumerator());
         }
 }
Beispiel #30
0
 public InMemBlob(Dictionary <string, string> metadata, byte[] data)
 {
     if (metadata == null)
     {
         throw new ArgumentNullException(nameof(metadata));
     }
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     Metadata = metadata.Clone();
     Data     = data;
 }
        public void Clone_DictionaryAndComparer_ShouldMakeCopyOfValues()
        {
            const string valueA = "A";
            const string valueB = "B";
            var          list1  = new List <string> {
                valueA, valueB
            };
            var list2 = new List <string> {
                valueB, valueA
            };
            var list3 = new List <string>();

            var source = new Dictionary <int, ICollection <string> >
            {
                { 1, list1 },
                { 2, list2 },
                { 3, list3 },
            };

            var clone = source.Clone();

            Assert.NotNull(clone);
            Assert.Equal(source.Count, clone.Count);

            Assert.True(clone.ContainsKey(1));
            var clonedCollection1 = clone[1];

            Assert.NotSame(list1, clonedCollection1);
            Assert.Equal(2, clonedCollection1.Count);
            var clonedList1 = clonedCollection1.ToList();

            Assert.Same(valueA, clonedList1[0]);
            Assert.Same(valueB, clonedList1[1]);

            Assert.True(clone.ContainsKey(2));
            var clonedCollection2 = clone[2];

            Assert.NotSame(list2, clonedCollection2);
            Assert.Equal(2, clonedCollection2.Count);
            var clonedList2 = clonedCollection2.ToList();

            Assert.Same(valueB, clonedList2[0]);
            Assert.Same(valueA, clonedList2[1]);

            Assert.True(clone.ContainsKey(3));
            var clonedCollection3 = clone[3];

            Assert.NotSame(list3, clonedCollection3);
            Assert.Equal(0, clonedCollection3.Count);
        }
        public void Model_With_UpDownDotSymbol_Inside_AttributeValue_Is_Valid()
        {
            string ss = "{0:ProductName}<br>{0:Version}<br><br>{0:Copyright}<br><br>{0:Company}<br><br>{0:Description}".XMLEncode();
            string formatStr = "<Application><Views><DetailView><Items><StaticText ID=\"AboutText\" Text=\"" +ss+ "\"/></Items></DetailView></Views></Application>";
            DictionaryNode readFromString = new DictionaryXmlReader().ReadFromString(formatStr);
            var dictionary1 = new Dictionary(readFromString, Schema.GetCommonSchema());
            var differenceObject = Isolate.Fake.Instance<DifferenceObject>(Members.CallOriginal, ConstructorWillBe.Called, Session.DefaultSession);
            differenceObject.Model=dictionary1.Clone();
            differenceObject.Save();

            differenceObject.Reload();

            Assert.AreEqual(dictionary1.RootNode.ToXml(), differenceObject.Model.RootNode.ToXml());
            
        }
        public void ApplicationModel_with_one_aspect_Can_Be_Saved()
        {
            var dictionary1 = new Dictionary(new DictionaryXmlReader().ReadFromString("<Application><BOModel><Class Name=\"MyClass\" Caption=\"Default\"></Class><Class Name=\"MyClass2\" Caption=\"Default\"></Class></BOModel></Application>"),Schema.GetCommonSchema());
            var dictionary =dictionary1.Clone();
            var elDict = new Dictionary(new DictionaryXmlReader().ReadFromString("<Application><BOModel><Class Name=\"MyClass\" Caption=\"elDefault\" AttributeWithOnlyAspect=\"something\"></Class><Class Name=\"MyClass2\" Caption=\"Default\"></Class></BOModel></Application>"), Schema.GetCommonSchema());
            dictionary.AddAspect("el", elDict.RootNode);
            var application =Isolate.Fake.Instance<DifferenceObject>(Members.CallOriginal, ConstructorWillBe.Called,Session.DefaultSession);
            application.Model = dictionary;
            application.Save();

            application.Reload();

            Assert.AreEqual(dictionary1.RootNode.ToXml(), new DictionaryXmlReader().ReadFromString(new DictionaryXmlWriter().GetAspectXML(DictionaryAttribute.DefaultLanguage, application.Model.RootNode)).ToXml());
            Assert.AreEqual(elDict.RootNode.ToXml(), new DictionaryXmlReader().ReadFromString(new DictionaryXmlWriter().GetAspectXML("el", application.Model.RootNode)).ToXml());
        }
        public void Test()
        {
            const string elXml = "<Application><BOModel><Class Name=\"MyClass\" Caption=\"el&amp;caption\"></Class></BOModel></Application>";
            const string xml = "<Application><BOModel><Class Name=\"MyClass\" Caption=\"capt&quot;ion\"></Class></BOModel></Application>";
            var elDict = new Dictionary(new DictionaryXmlReader().ReadFromString(elXml), Schema.GetCommonSchema());
            var dict = new Dictionary(new DictionaryXmlReader().ReadFromString(xml), Schema.GetCommonSchema());
            Dictionary dictionary = dict.Clone();
            dictionary.AddAspect("el", elDict.RootNode);

            var dictionaryHelper = new DictionaryHelper();
            string aspectFromXml = dictionaryHelper.GetAspectFromXml(new List<string> { "el" }, dictionary.RootNode);

            Assert.AreEqual(dict.RootNode.ToXml(), new DictionaryXmlReader().ReadFromString(aspectFromXml).ToXml());
//            Assert.AreEqual(elDict.RootNode.ToXml(), new DictionaryXmlReader().ReadFromString(dictionaryHelper.AspectValues["el"]).ToXml());


        }
Beispiel #35
0
        public Experience GetExperience(Dictionary<ExperienceFactor, int> factors, bool addIfMissing = false)
        {
            foreach (var exp in Experiences)
            {
                if (exp.Levels.Contains(factors, true))
                {
                    return exp;
                }
            }

            if (addIfMissing)
            {
                Experiences.Add(new Experience
                {
                    Number = Experiences.Count,
                    Levels = factors.Clone()
                });

                return Experiences[Experiences.Count - 1];
            }

            throw new KeyNotFoundException("No such experience");
        }
Beispiel #36
0
        /// <summary>
        /// Create some preset filters
        /// </summary>
        /// <returns></returns>
        private IEnumerable<Preset> CreatePresets()
        {
            Dictionary<string, bool> All = new Dictionary<string, bool>();
            foreach (Control c in this.Controls)
                if (c is CheckBox)
                    All[c.Text] = true;
            yield return new Preset() { Name = "All", Filter = All };

            Dictionary<string, bool> None = new Dictionary<string, bool>();
            foreach (Control c in this.Controls)
                if (c is CheckBox)
                    None[c.Text] = false;
            yield return new Preset() { Name = "None", Filter = None };

            Dictionary<string, bool> LessVerbose = All.Clone();
            LessVerbose["GameTickMessage"] = false;
            LessVerbose["TrickleMessage"] = false;
            LessVerbose["ACDTranslateFacingMessage"] = false;
            yield return new Preset() { Name = "Less verbose", Filter = LessVerbose };

            Dictionary<string, bool> Questing = None.Clone();
            Questing["QuestCounterMessage"] = true;
            Questing["QuestMeterMessage"] = true;
            Questing["QuestUpdateMessage"] = true;
            Questing["WorldTargetMessage"] = true;
            yield return new Preset() { Name = "Questing", Filter = Questing };

            Dictionary<string, bool> Conversation = None.Clone();
            Conversation["PlayConvLineMessage"] = true;
            Conversation["FinishConversationMessage"] = true;
            Conversation["EndConversationMessage"] = true;
            Conversation["RequestCloseConversationWindowMessage"] = true;
            Conversation["StopConvLineMessage"] = true;
            Conversation["WorldTargetMessage"] = true;

            yield return new Preset() { Name = "Conversation", Filter = Conversation };
 
        }
Beispiel #37
0
        private Dictionary<string, NodeInfo> GetNodeFactors(ConfigNode node, Dictionary<string, NodeInfo> source)
        {
            var result = source.Clone();

            if (node != null)
            {
                foreach (var v in node.values.Cast<ConfigNode.Value>())
                {
                    result[v.name] = new NodeInfo(v.value);
                }
            }

            if (!result.ContainsKey("base"))
            {
                result["base"] = new NodeInfo(Family, 1.0f);
            }

            return result;
        }
 Dictionary GetCombinedModel(Dictionary dictionary, bool isSaving) {
     Dictionary clone = dictionary.Clone();
     clone.ResetIsModified();
     if (!isSaving)
         clone.CombineWith(Model);
     return clone;
 }
Beispiel #39
0
 public Dictionary GetCombinedModel(Dictionary dictionary)
 {
     Dictionary clone = dictionary.Clone();
     clone.ResetIsModified();
     clone.CombineWith(Model);
     return clone;
 }
        public void Application_Model_With_More_Than_one_Aspect_And_Spaces_Between_Attribute_Values_Can_Be_Saved(){
            const string defaultS = "ProtectedContentText=\"Protected Content\" PreferredLanguage=\"el\" VersionFormat=\"Version {0}.{1}.{2}\" Title=\"Solution1\" Logo=\"ExpressAppLogo\" Company=\"Endligh\" WebSite=\"1\" CanClose=\"True\" ";
            var dictionary1 = new Dictionary(new DictionaryXmlReader().ReadFromString("<Application "+defaultS + "><BOModel><Class Name=\"MyClass2\" Caption=\"Default\"></Class></BOModel></Application>"), Schema.GetCommonSchema());
            Dictionary dictionary = dictionary1.Clone();
            dictionary1.AddAspect("el", new DictionaryXmlReader().ReadFromString("<Application Company=\"Greek\"></Application>"));
            var application = Isolate.Fake.Instance<DifferenceObject>(Members.CallOriginal, ConstructorWillBe.Called, Session.DefaultSession);
            application.Model=dictionary1;
            application.Save();

            application.Reload();


            var dictionaryXmlWriter = new DictionaryXmlWriter();
            Assert.AreEqual(dictionary.RootNode.ToXml(), new DictionaryXmlReader().ReadFromString(dictionaryXmlWriter.GetAspectXML(DictionaryAttribute.DefaultLanguage, application.Model.RootNode)).ToXml());
        }