Esempio n. 1
0
        private void MergeStrokes(DrawingAttributes attr)
        {
            try
            {
                StylusPointCollection points          = new StylusPointCollection();
                StrokeCollection      strokesToRemove = new StrokeCollection();

                foreach (CustomStroke trait in Traits)
                {
                    if (trait.uid == currentStrokeId)
                    {
                        points.Add(trait.StylusPoints);
                        strokesToRemove.Add(trait);
                    }
                }

                CustomStroke fullStroke = new CustomStroke(points, attr);
                fullStroke.uid = currentStrokeId;

                App.Current.Dispatcher.Invoke(delegate
                {
                    Traits.Add(fullStroke);
                    Traits.Remove(strokesToRemove);
                });

                currentStrokeId = Guid.NewGuid();
            }
            catch (Exception)
            {
                App.Current.Dispatcher.Invoke(delegate
                {
                    Traits.Clear();
                });
            }
        }
Esempio n. 2
0
        /// <inheritdoc/>
        protected override void Initialize()
        {
            base.Initialize();

            var factAttribute   = TestMethod.Method.GetCustomAttributes(typeof(FactAttribute)).Single();
            var baseDisplayName = factAttribute.GetNamedArgument <string>("DisplayName") ?? BaseDisplayName;

            DisplayName = TypeUtility.GetDisplayNameWithArguments(TestMethod.Method, baseDisplayName, TestMethodArguments, MethodGenericTypes);
            SkipReason  = factAttribute.GetNamedArgument <string>("Skip");

            foreach (var traitAttribute in TestMethod.Method.GetCustomAttributes(typeof(ITraitAttribute))
                     .Concat(TestMethod.TestClass.Class.GetCustomAttributes(typeof(ITraitAttribute))))
            {
                var discovererAttribute = traitAttribute.GetCustomAttributes(typeof(TraitDiscovererAttribute)).FirstOrDefault();
                if (discovererAttribute != null)
                {
                    var discoverer = ExtensibilityPointFactory.GetTraitDiscoverer(discovererAttribute);
                    if (discoverer != null)
                    {
                        foreach (var keyValuePair in discoverer.GetTraits(traitAttribute))
                        {
                            Traits.Add(keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                }
                // TODO: Log an environmental warning about the missing discoverer attribute
            }
        }
Esempio n. 3
0
        /// <inheritdoc/>
        protected override void Initialize()
        {
            base.Initialize();

            var factAttribute   = TestMethod.Method.GetCustomAttributes(typeof(FactAttribute)).First();
            var baseDisplayName = factAttribute.GetNamedArgument <string>("DisplayName") ?? BaseDisplayName;

            DisplayName = GetDisplayName(factAttribute, baseDisplayName);
            SkipReason  = GetSkipReason(factAttribute);

            foreach (var traitAttribute in GetTraitAttributesData(TestMethod))
            {
                var discovererAttribute = traitAttribute.GetCustomAttributes(typeof(TraitDiscovererAttribute)).FirstOrDefault();
                if (discovererAttribute != null)
                {
                    var discoverer = ExtensibilityPointFactory.GetTraitDiscoverer(DiagnosticMessageSink, discovererAttribute);
                    if (discoverer != null)
                    {
                        foreach (var keyValuePair in discoverer.GetTraits(traitAttribute))
                        {
                            Traits.Add(keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                }
                else
                {
                    DiagnosticMessageSink.OnMessage(new DiagnosticMessage($"Trait attribute on '{DisplayName}' did not have [TraitDiscoverer]"));
                }
            }
        }
Esempio n. 4
0
        public ASInstance(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            TypeIndex      = reader.Read7BitEncodedInt();
            SuperTypeIndex = reader.Read7BitEncodedInt();
            ClassInfo      = (ClassFlags)reader.ReadByte();

            if ((ClassInfo & ClassFlags.ProtectedNamespace) != 0)
            {
                ProtectedNamespaceIndex = reader.Read7BitEncodedInt();
            }

            InterfaceIndices.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < InterfaceIndices.Capacity; i++)
            {
                InterfaceIndices.Add(reader.Read7BitEncodedInt());
            }

            ConstructorIndex = reader.Read7BitEncodedInt();
            if (Constructor != null)
            {
                Constructor.IsConstructor = true;
            }

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }
        }
Esempio n. 5
0
        public ASMethodBody(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            MethodIndex       = reader.Read7BitEncodedInt();
            MaxStack          = reader.Read7BitEncodedInt();
            LocalCount        = reader.Read7BitEncodedInt();
            InitialScopeDepth = reader.Read7BitEncodedInt();
            MaxScopeDepth     = reader.Read7BitEncodedInt();

            int bytecodeLength = reader.Read7BitEncodedInt();
            Bytecode = reader.ReadBytes(bytecodeLength);

            Exceptions.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Exceptions.Capacity; i++)
            {
                Exceptions.Add(new ASException(abc, reader));
            }

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }

            Method.Body = this;
        }
        protected CulturedXunitTestCase(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            culture = info.GetString("Culture");

            Traits.Add("Culture", culture);
        }
        public CulturedXunitTestCase(ITestCollection testCollection, IAssemblyInfo assembly, ITypeInfo type, IMethodInfo method, IAttributeInfo factAttribute, string culture)
            : base(testCollection, assembly, type, method, factAttribute)
        {
            this.culture = culture;

            Traits.Add("Culture", culture);
        }
Esempio n. 8
0
 public void UpdateProperties()
 {
     RelationToMainHeroText = "";
     GovernorOfText         = "";
     Skills.Clear();
     Traits.Clear();
     UpdateLearningSkillSelection();
     foreach (SkillObject item in SkillObject.All)
     {
         Skills.Add(new EncyclopediaSkillVM(item, _hero.GetSkillValue(item)));
     }
     foreach (TraitObject heroTrait in CampaignUIHelper.GetHeroTraits())
     {
         if (_hero.GetTraitLevel(heroTrait) != 0)
         {
             Traits.Add(new EncyclopediaTraitItemVM(heroTrait, _hero));
         }
     }
     IsChild = _hero.IsChild;
     if (_hero != Hero.MainHero)
     {
         RelationToMainHeroText = CampaignUIHelper.GetHeroRelationToHeroText(_hero, Hero.MainHero).ToString();
     }
     if (_hero.GovernorOf != null)
     {
         GameTexts.SetVariable("SETTLEMENT_NAME", _hero.GovernorOf.Owner.Settlement.EncyclopediaLinkWithName);
         GovernorOfText = GameTexts.FindText("str_governor_of_label").ToString();
     }
     HeroModel = new HeroViewModel();
     HeroModel.FillFrom(_hero);
     Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(_hero.ClanBanner), nineGrid: true);
 }
Esempio n. 9
0
        private static void UpdateSegmentIOInformationOnThisUser()
        {
            _traits = new Traits()
            {
                { "lastName", _userInfo.LastName },
                { "firstName", _userInfo.FirstName },
                { "Email", _userInfo.Email },
                { "UILanguage", _userInfo.UILanguageCode },
                //segmentio collects this in context, but doesn't seem to convey it to MixPanel
                { "$browser", GetOperatingSystemLabel() }
            };
            foreach (var property in _userInfo.OtherProperties)
            {
                if (!string.IsNullOrWhiteSpace(property.Value))
                {
                    _traits.Add(property.Key, property.Value);
                }
            }

            if (!AllowTracking)
            {
                return;
            }

            Segment.Analytics.Client.Identify(AnalyticsSettings.Default.IdForAnalytics, _traits, _options);
        }
Esempio n. 10
0
        /// <inheritdoc/>
        protected override void Initialize()
        {
            base.Initialize();

            var factAttribute   = TestMethod.Method.GetCustomAttributes(typeof(FactAttribute)).Single();
            var baseDisplayName = factAttribute.GetNamedArgument <string>("DisplayName") ?? BaseDisplayName;

            DisplayName = TypeUtility.GetDisplayNameWithArguments(TestMethod.Method, baseDisplayName, TestMethodArguments, MethodGenericTypes);
            SkipReason  = factAttribute.GetNamedArgument <string>("Skip");

            foreach (var traitAttribute in TestMethod.Method.GetCustomAttributes(typeof(ITraitAttribute))
                     .Concat(TestMethod.TestClass.Class.GetCustomAttributes(typeof(ITraitAttribute))))
            {
                var discovererAttribute = traitAttribute.GetCustomAttributes(typeof(TraitDiscovererAttribute)).FirstOrDefault();
                if (discovererAttribute != null)
                {
                    var discoverer = ExtensibilityPointFactory.GetTraitDiscoverer(diagnosticMessageSink, discovererAttribute);
                    if (discoverer != null)
                    {
                        foreach (var keyValuePair in discoverer.GetTraits(traitAttribute))
                        {
                            Traits.Add(keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                }
                else
                {
                    diagnosticMessageSink.OnMessage(new DiagnosticMessage("Trait attribute on '{0}' did not have [TraitDiscoverer]", DisplayName));
                }
            }
        }
Esempio n. 11
0
        public PersonConnection(string t) : base()
        {
            creationID = id++.ToString();

            switch (t.ToUpper())
            {
            case "FAMILY":
                Traits.Add("Physical Proximity", Node.rng.Next(25, 101));
                Traits.Add("Temporal Proximity", Node.rng.Next(75, 101));
                break;

            case "FRIENDS":
                Traits.Add("Physical Proximity", Node.rng.Next(40, 76));
                Traits.Add("Temporal Proximity", Node.rng.Next(40, 101));
                break;

            case "WORK":
                Traits.Add("Physical Proximity", Node.rng.Next(25, 61));
                Traits.Add("Temporal Proximity", Node.rng.Next(40, 81));
                break;

            case "ACQUIANTANCES":
                Traits.Add("Physical Proximity", Node.rng.Next(5, 46));
                Traits.Add("Temporal Proximity", Node.rng.Next(5, 16));
                break;

            default:
                Traits.Add("Physical Proximity", Node.rng.Next(1, 101));
                Traits.Add("Temporal Proximity", Node.rng.Next(1, 101));
                break;
            }
        }
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     if (addBaseTraits)
     {
         foreach (Klei.AI.Attribute resource in Db.Get().Attributes.resources)
         {
             if (attributes.Get(resource) == null)
             {
                 attributes.Add(resource);
             }
         }
         Traits component = GetComponent <Traits>();
         Trait  trait     = Db.Get().traits.Get(MinionConfig.MINION_BASE_TRAIT_ID);
         component.Add(trait);
         foreach (Disease resource2 in Db.Get().Diseases.resources)
         {
             AmountInstance amountInstance = AddAmount(resource2.amount);
             attributes.Add(resource2.cureSpeedBase);
             amountInstance.SetValue(0f);
         }
         ChoreConsumer component2 = GetComponent <ChoreConsumer>();
         if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
         {
             component2.AddProvider(GlobalChoreProvider.Instance);
             base.gameObject.AddComponent <QualityOfLifeNeed>();
         }
     }
 }
Esempio n. 13
0
 public void Identify(UserDO userDO)
 {
     var props = new Traits();
     foreach (var prop in GetProperties(userDO))
         props.Add(prop.Key, prop.Value);
     
     Analytics.Client.Identify(userDO.Id, props);
 }
Esempio n. 14
0
        void Initialize(string culture)
        {
            this.culture = culture;

            Traits.Add("Culture", culture);

            DisplayName += String.Format(" [{0}]", culture);
        }
Esempio n. 15
0
 public ClassOrigin(string cls, IObjectStore data) : this()
 {
     Class     = cls;
     Name      = data.GetString("name");
     Weighting = data.GetInteger("weight");
     Traits.Add(data.GetListOptional("traits"));
     Storylines.Add(data.GetListOptional("storylines"));
 }
    public void ApplyTraits(GameObject go)
    {
        Traits component = go.GetComponent <Traits>();

        component.Clear();
        foreach (Trait trait in Traits)
        {
            component.Add(trait);
        }
        component.Add(stressTrait);
        if (congenitaltrait != null)
        {
            component.Add(congenitaltrait);
        }
        go.GetComponent <MinionIdentity>().SetName(Name);
        go.GetComponent <MinionIdentity>().SetGender(GenderStringKey);
    }
        void Initialize(string culture)
        {
            this.culture = culture;

            Traits.Add("Culture", culture);

            DisplayName += $" [{culture}]";
        }
        /// <inheritdoc/>
        protected override void Initialize()
        {
            base.Initialize();

            Traits.Add("Scenario", new List <string>()
            {
                _scenarioIdentifier.ToString()
            });
        }
Esempio n. 19
0
        public Skill AddTrait(SkillTraits t)
        {
            if (!Traits.Contains(t))
            {
                Traits.Add(t);
            }

            return(this);
        }
Esempio n. 20
0
        public void addTrait(Trait trait)
        {
            if (Traits == null)
            {
                Traits = new List <Trait>();
            }

            Traits.Add(trait);
        }
Esempio n. 21
0
        void Initialize(string culture)
        {
            Culture = culture;

            Traits.Add("Culture", new List <string> {
                culture
            });

            DisplayName += $"[{culture}]";
        }
Esempio n. 22
0
 public override void Init(CharacterObject character)
 {
     base.Init(character);
     Traits.Add(new Giant(character));
     CurrentCharacter = character;
     if (CurrentCharacter != null)
     {
         Util.LogMessage("BigCharacterTraitSet initialized for a given character!" + character.Name + " Activating!");
         Activate();
     }
 }
Esempio n. 23
0
        public ASScript(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            FunctionIndex   = reader.Read7BitEncodedInt();
            Traits.Capacity = reader.Read7BitEncodedInt();

            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Adds a new trait to the list of traits belonging to current GeneticEntity/entity.
 /// </summary>
 /// <param name="trait">Trait to add to the list.</param>
 public void AddTrait(Trait trait)
 {
     try
     {
         Traits.Add(trait);
     }
     catch (Exception e)
     {
         MlSharpLogger.LogError("Error while adding new trait: " + e.Message);
         throw;
     }
 }
Esempio n. 25
0
    void SetTraits(List <Trait> allTraits, int maxTraits)
    {
        int numberOfPossibleTraits;
        int traitsSet = 0;
        int traitSelection;

        while (traitsSet < maxTraits)
        {
            numberOfPossibleTraits = allTraits.Count;
            traitSelection         = GameObject.Find("GameController").GetComponent <GameController>().GameRandom.Next(numberOfPossibleTraits);
            Traits.Add(allTraits[traitSelection]);
            allTraits.RemoveAt(traitSelection);
            traitsSet++;
        }
    }
Esempio n. 26
0
        public BenchmarkTestCase(ITestMethod testMethod, int iterations, bool collectGarbage)
            : base(TestMethodDisplay.ClassAndMethod, testMethod)
        {
            Iterations     = iterations;
            CollectGargage = collectGarbage;

            Traits.Add("Iterations", new List <string>()
            {
                Iterations.ToString()
            });
            Traits.Add("CollectGargage", new List <string>()
            {
                CollectGargage.ToString()
            });
        }
Esempio n. 27
0
        public ASClass(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            ConstructorIndex = reader.Read7BitEncodedInt();
            if (Constructor != null)
            {
                Constructor.IsConstructor = true;
            }

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }
        }
Esempio n. 28
0
        public Dictionary <string, Member> ImplementTrait(SkryptTrait trait)
        {
            var dict = new Dictionary <string, Member>();

            Traits.Add(trait);

            foreach (var kv in trait.TraitMembers)
            {
                var newMember = new Member(kv.Value.value, kv.Value.isPrivate, kv.Value.definitionBlock);

                Template.Members[kv.Key] = newMember;
                dict[kv.Key]             = newMember;
            }

            return(dict);
        }
Esempio n. 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CulturedXunitTheoryTestCase"/> class.
        /// </summary>
        /// <param name="defaultMethodDisplay">Default method display to use (when not customized).</param>
        /// <param name="defaultMethodDisplayOptions">Default method display options to use (when not customized).</param>
        /// <param name="testMethod">The method under test.</param>
        public CulturedXunitTheoryTestCase(
            TestMethodDisplay defaultMethodDisplay,
            TestMethodDisplayOptions defaultMethodDisplayOptions,
            _ITestMethod testMethod,
            string culture)
            : base(defaultMethodDisplay, defaultMethodDisplayOptions, testMethod)
        {
            Culture = Guard.ArgumentNotNull(culture);

            Traits.Add("Culture", Culture);

            var cultureDisplay = $"[{Culture}]";

            TestCaseDisplayName += cultureDisplay;
            UniqueID            += cultureDisplay;
        }
Esempio n. 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CulturedXunitTheoryTestCase"/> class.
        /// </summary>
        /// <param name="diagnosticMessageSink">The message sink which receives <see cref="_DiagnosticMessage"/> messages.</param>
        /// <param name="defaultMethodDisplay">Default method display to use (when not customized).</param>
        /// <param name="defaultMethodDisplayOptions">Default method display options to use (when not customized).</param>
        /// <param name="testMethod">The method under test.</param>
        public CulturedXunitTheoryTestCase(
            _IMessageSink diagnosticMessageSink,
            TestMethodDisplay defaultMethodDisplay,
            TestMethodDisplayOptions defaultMethodDisplayOptions,
            _ITestMethod testMethod,
            string culture)
            : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod)
        {
            Culture = Guard.ArgumentNotNull(nameof(culture), culture);

            Traits.Add("Culture", Culture);

            var cultureDisplay = $"[{Culture}]";

            DisplayName += cultureDisplay;
            UniqueID    += cultureDisplay;
        }
Esempio n. 31
0
        protected void PopulateTraits(FlashReader input)
        {
            Traits.Capacity = input.ReadInt30();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                var trait = new ASTrait(ABC, input);
                trait.IsStatic = IsStatic;

                if (trait.Kind == TraitKind.Method ||
                    trait.Kind == TraitKind.Getter ||
                    trait.Kind == TraitKind.Setter)
                {
                    trait.Method.Container = this;
                }

                Traits.Add(trait);
            }
        }
		private static void UpdateSegmentIOInformationOnThisUser()
		{
			_traits = new Traits()
			{
				{"lastName", _userInfo.LastName},
				{"firstName", _userInfo.FirstName},
				{"Email", _userInfo.Email},
				{"UILanguage", _userInfo.UILanguageCode},
	            //segmentio collects this in context, but doesn't seem to convey it to MixPanel
	            {"$browser", GetOperatingSystemLabel()}
			};
			foreach (var property in _userInfo.OtherProperties)
			{
				if (!string.IsNullOrWhiteSpace(property.Value))
					_traits.Add(property.Key, property.Value);
			}

			if (!AllowTracking)
				return;

			Segment.Analytics.Client.Identify(AnalyticsSettings.Default.IdForAnalytics, _traits, _options);
		}