예제 #1
0
        // ]NOCPP]

        internal void AddAttribute(AttributeName name, string value
                                   // [NOCPP[
                                   , XmlViolationPolicy xmlnsPolicy
                                   // ]NOCPP]
                                   )
        {
            // [NOCPP[
            if (name == AttributeName.ID)
            {
                idValue = value;
            }

            if (name.IsXmlns)
            {
                if (xmlnsNames.Length == xmlnsLength)
                {
                    int             newLen   = xmlnsLength == 0 ? 2 : xmlnsLength << 1;
                    AttributeName[] newNames = new AttributeName[newLen];
                    Array.Copy(xmlnsNames, newNames, xmlnsNames.Length);

                    xmlnsNames = newNames;
                    string[] newValues = new string[newLen];
                    Array.Copy(xmlnsValues, newValues, xmlnsValues.Length);
                    xmlnsValues = newValues;
                }
                xmlnsNames[xmlnsLength]  = name;
                xmlnsValues[xmlnsLength] = value;
                xmlnsLength++;
                switch (xmlnsPolicy)
                {
                case XmlViolationPolicy.Fatal:
                    // this is ugly (TODO)
                    throw new Exception("Saw an xmlns attribute.");

                case XmlViolationPolicy.AlterInfoset:
                    return;

                case XmlViolationPolicy.Allow:
                    break;                             // fall through
                }
            }

            // ]NOCPP]

            if (names.Length == length)
            {
                int newLen = length << 1;                 // The first growth covers virtually
                // 100% of elements according to
                // Hixie
                AttributeName[] newNames = new AttributeName[newLen];
                Array.Copy(names, newNames, names.Length);
                names = newNames;
                string[] newValues = new string[newLen];
                Array.Copy(values, newValues, values.Length);
                values = newValues;
            }
            names[length]  = name;
            values[length] = value;
            length++;
        }
예제 #2
0
        private static bool isEventExpression(Expression expression, Signal clock)
        {
            if (expression is AttributeName)
            {
                AttributeName ae = (AttributeName)expression;
                if (!ae.Attribute.Identifier.EqualsIdentifier("event"))
                {
                    return(false);
                }

                return(ae.Prefix.Equals(clock));
            }
            else if (expression is Not)
            {
                Not not = (Not)expression;
                if (not.Expression is AttributeName)
                {
                    AttributeName ae = (AttributeName)not.Expression;
                    if (!ae.Attribute.Identifier.EqualsIdentifier("stable"))
                    {
                        return(false);
                    }

                    return(ae.Prefix.Equals(clock));
                }
            }

            return(false);
        }
예제 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((AttributeName != null ? AttributeName.GetHashCode() : 0) * 397) ^ (int)Occur);
     }
 }
예제 #4
0
 public static Attribute LoadAttribute( AttributeName name )
 {
     Attribute att = new Attribute();
     att.BaseValue = PlayerPrefs.GetInt(((AttributeName)name).ToString() + BASE_VALUE, 0);
     att.ExpToLevel = PlayerPrefs.GetInt(((AttributeName)name).ToString() + EXP_TO_LEVEL, Attribute.STARTING_EXP_COST);
     return att;
 }
        private string GetAttributeName(ITracingService tracingService, CodeActivityContext executionContext)
        {
            string attributeName = AttributeName.Get <string>(executionContext) ?? throw new ArgumentNullException("Attribute Name is empty");

            tracingService.Trace("Attribute name:'{0}'", attributeName);
            return(attributeName);
        }
예제 #6
0
        protected internal override void VisitAttributeName(AttributeName node)
        {
            base.VisitAttributeName(node);

            if (node.Span.Start <= this.position && this.position <= node.Span.End)
            {
                Debug.Assert(this.currentDirective != null, "currentDirective");
                var directiveDescriptor = DirectiveDescriptor.GetDirectiveDescriptor(this.currentDirective.GetType());

                var completions = new List <Completion>();
                foreach (AttributeDescriptor attribute in directiveDescriptor.Attributes.Values)
                {
                    if (!this.currentDirective.Attributes.ContainsKey(attribute.DisplayName))
                    {
                        completions.Add(CreateAttributeCompletion(attribute));
                    }
                }

                if (completions.Count > 0)
                {
                    this.Completions = completions;
                    this.Node        = node;
                }
            }
        }
예제 #7
0
        // [NOCPP[

        internal void ProcessNonNcNames <T>(TreeBuilder <T> treeBuilder, XmlViolationPolicy namePolicy) where T : class
        {
            for (int i = 0; i < length; i++)
            {
                AttributeName attName = names[i];
                if (!attName.IsNcName(mode))
                {
                    string name = attName.GetLocal(mode);
                    switch (namePolicy)
                    {
                    case XmlViolationPolicy.AlterInfoset:
                        names[i] = AttributeName.Create(NCName.EscapeName(name));
                        goto case XmlViolationPolicy.Allow;                                 // fall through

                    case XmlViolationPolicy.Allow:
                        if (attName != AttributeName.XML_LANG)
                        {
                            treeBuilder.Warn("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
                        }
                        break;

                    case XmlViolationPolicy.Fatal:
                        treeBuilder.Fatal("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
                        break;
                    }
                }
            }
        }
예제 #8
0
        private void Frm_Wear_Load(object sender, EventArgs e)
        {
            Equipment primary_equipment = PlayerValue.Player.Equipments.GetEquipment(tybe);
            string    tem_str;

            if (primary_equipment != null)
            {
                tem_str = primary_equipment.Name + "\n";
                for (int i = 0; i < 6; i++)
                {
                    AttributeValue value = AttributeName.GetAttributeValue(i);
                    if (primary_equipment.GetAdditive(value) != 0)
                    {
                        tem_str += AttributeName.GetAttributeName(value) + Function.GetValueSymbol(primary_equipment.GetAdditive(value)) + "\n";
                    }
                }
            }
            else
            {
                tem_str = "未装备";
            }
            lab_PrimaryEquipment.Text = tem_str;
            tem_str = equipment.Name + "\n";
            for (int i = 0; i < 6; i++)
            {
                var value = AttributeName.GetAttributeValue(i);
                if (equipment.GetAdditive(value) != 0)
                {
                    tem_str += AttributeName.GetAttributeName(value) + Function.GetValueSymbol(equipment.GetAdditive(value)) + "\n";
                }
            }
            lab_NowEquipment.Text = tem_str;
        }
예제 #9
0
파일: Bag.cs 프로젝트: mo5h/omeo
        /// <summary>
        /// Checks whether the value is present in the bag.
        /// The type parameter checks the value type.
        /// </summary>
        public bool Contains <T>(AttributeName name)
        {
#pragma warning disable CompareNonConstrainedGenericWithNull
            return(TryGet <T>(name) != null);

#pragma warning restore CompareNonConstrainedGenericWithNull
        }
예제 #10
0
        /// <summary>
        /// Handles the RowDataBound event of the gvLookup control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param>
        protected void gvLookup_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string PK = string.Empty;

                if (AttributeName.ToUpper().EndsWith(".TITLE"))
                {
                    PK = e.Row.Cells[1].Text.Trim();
                }
                else
                {
                    PK = e.Row.Cells[0].Text.Trim();
                }

                e.Row.Attributes.Add("onClick",
                                     "ChangeRowColor('" + gvLookup.ClientID + "','" + e.Row.RowIndex + "','" +
                                     _hdnLookupId.ClientID + "','" + _btnSelect.ClientID + "','" + AttributeName + "','" + PK + "')");

                if (AttributeName.ToUpper().EndsWith(".TITLE"))
                {
                    e.Row.Attributes.Add("ondblclick", "Javascript:__doPostBack('myDblClick','" + e.Row.Cells[1].Text.Trim() + "~" + e.Row.RowIndex + "~" + AttributeName + "');");
                }
                else
                {
                    e.Row.Attributes.Add("ondblclick", "Javascript:__doPostBack('myDblClick','" + e.Row.Cells[0].Text.Trim() + "~" + e.Row.RowIndex + "~" + AttributeName + "');");
                }
            }
        }
예제 #11
0
            private void CreateOrUpdateOpenAttributeDefect(Lot lot, AttributeName attribute, double value, IAttributeRange range, ref List <LotAttributeDefect> lotAttributeDefects)
            {
                var nameKey         = attribute.ToAttributeNameKey();
                var attributeDefect = lotAttributeDefects.FirstOrDefault(d => d.LotDefect.Resolution == null && nameKey.Equals(d));

                if (attributeDefect == null)
                {
                    var newDefect = lot.AddNewDefect(attribute.DefectType, attribute.Name);
                    attributeDefect = new LotAttributeDefect
                    {
                        LotDateCreated     = lot.LotDateCreated,
                        LotDateSequence    = lot.LotDateSequence,
                        LotTypeId          = lot.LotTypeId,
                        DefectId           = newDefect.DefectId,
                        LotDefect          = newDefect,
                        AttributeShortName = nameKey.AttributeNameKey_ShortName
                    };
                    lotAttributeDefects.Add(attributeDefect);
                }

                attributeDefect.OriginalAttributeValue    = value;
                attributeDefect.OriginalAttributeMinLimit = range.RangeMin;
                attributeDefect.OriginalAttributeMaxLimit = range.RangeMax;

                CloseOpenAttributeDefects(nameKey, lotAttributeDefects.Where(a => a != attributeDefect));
            }
        private string GetAttributeName(Common context)
        {
            string attributeName = AttributeName.Get <string>(context.codeActivityContext) ?? throw new ArgumentNullException("Attribute Name is empty");

            context.tracingService.Trace("Attribute name:'{0}'", attributeName);
            return(attributeName);
        }
예제 #13
0
 public ClampedAttribute(AttributeName attributeName, float baseValue, float minValue, float maxValue,
                         float levelIncrement, LevelIncrementType levelIncrementType) : base(attributeName, baseValue,
                                                                                             levelIncrement, levelIncrementType)
 {
     this.minValue = minValue;
     this.maxValue = maxValue;
 }
예제 #14
0
        /// <summary>
        /// When implemented in a derived class, performs the execution of the activity.
        /// </summary>
        /// <param name="context">The execution context under which the activity executes.</param>
        protected override void Execute(CodeActivityContext context)
        {
            var attributeName              = AttributeName.Get(context);
            var attributeValue             = AttributeValue.Get(context);
            var createAttributeIfNotExists = CreateAttributeIfNotExists.Get(context);
            var directoryToSearch          = DirectoryToSearch.Get(context);
            var fileNamesToSearch          = FileNamesToSearch.Get(context);
            var commandLog = new CodeActivityContextCommandLog(context);
            var recursive  = Recursive.Get(context);
            var writeVerboseLogMessages = WriteVerboseLogMessages.Get(context);

            var command =
                new SetAssemblyAttributeInFilesCommand
            {
                AttributeName              = attributeName,
                AttributeValue             = attributeValue,
                CreateAttributeIfNotExists = createAttributeIfNotExists,
                DirectoryToSearch          = directoryToSearch,
                FileNamesToSearch          = fileNamesToSearch,
                CommandLog = commandLog,
                Recursive  = recursive,
                WriteVerboseLogMessages = writeVerboseLogMessages
            };

            var successful = command.Execute();

            if (false == successful)
            {
                commandLog.Error("The SetAssemblyAttributeInFiles activity failed.");
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (HcName != null)
         {
             hashCode = hashCode * 59 + HcName.GetHashCode();
         }
         if (HcTags != null)
         {
             hashCode = hashCode * 59 + HcTags.GetHashCode();
         }
         if (HcMbeanName != null)
         {
             hashCode = hashCode * 59 + HcMbeanName.GetHashCode();
         }
         if (MbeanName != null)
         {
             hashCode = hashCode * 59 + MbeanName.GetHashCode();
         }
         if (AttributeName != null)
         {
             hashCode = hashCode * 59 + AttributeName.GetHashCode();
         }
         if (AttributeValueConstraint != null)
         {
             hashCode = hashCode * 59 + AttributeValueConstraint.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #16
0
        protected override void Execute(IWorkflowActivityContext context)
        {
            this.EnsureNotNull(context, nameof(context));

            var activityContext = context.GetExecutionContext();

            var primaryEntityId   = context.WorkflowContext.PrimaryEntityId;
            var primaryEntityName = context.WorkflowContext.PrimaryEntityName;
            var attributeName     = AttributeName.Get(activityContext);
            var primaryEntity     = RetrievePrimaryEntity(context, primaryEntityName, primaryEntityId, attributeName);

            var value = primaryEntity?.GetAttributeValue <Object>(attributeName);

            if (value == null)
            {
                return;
            }

            if (!(value is EntityReference))
            {
                throw new InvalidPluginExecutionException($"Invalid field value type {value.GetType().FullName}.");
            }

            var entityReference = (EntityReference)value;

            EntityLogicalName.Set(activityContext, entityReference.LogicalName);
            EntityId.Set(activityContext, entityReference.Id.ToString());
        }
예제 #17
0
        private static Expression clockEdge(Signal clock, bool rising, bool useFunction)
        {
            if (useFunction)
            {
                FunctionCall call;
                if (rising)
                {
                    call = new FunctionCall(StdLogic1164.RISING_EDGE);
                }
                else
                {
                    call = new FunctionCall(StdLogic1164.FALLING_EDGE);
                }
                call.Parameters.Add(new AssociationElement(Name.reference(clock)));
                return(call);
            }
            else
            {
                Expression condition1 = new AttributeName(Name.reference(clock), SignalAttributes.EVENT);
                Expression state      = rising ? StdLogic1164.STD_LOGIC_1 : StdLogic1164.STD_LOGIC_0;
                Expression condition2 = new Equals(Name.reference(clock), state);

                return(new And(condition1, condition2));
            }
        }
예제 #18
0
 public float GetAttribute(AttributeName attributeName)
 {
     if (Attributes.ContainsKey(attributeName))
     {
         return(Attributes[attributeName]);
     }
     return(0f);
 }
예제 #19
0
파일: Bag.cs 프로젝트: mo5h/omeo
 /// <summary>
 /// Casts the value to the given type.
 /// Throws a detailed message if that is not possible.
 /// </summary>
 private static T DynamicCast <T>(AttributeName name, object value)
 {
     if (!(value is T))
     {
         throw new InvalidOperationException(string.Format("The “{0}” task input parameter must be of type “{1}”.", name, typeof(T).AssemblyQualifiedName));
     }
     return((T)value);
 }
예제 #20
0
        public async Task DeleteAttributeNameById(int attrNameId)
        {
            AttributeName attributeName = await _context.AttributeNames.Include(a => a.AttributeValues).FirstAsync(a => a.AttributeNameId == attrNameId);

            _context.Remove(attributeName);

            await _context.SaveChangesAsync();
        }
예제 #21
0
    public static Attribute LoadAttribute(AttributeName name)
    {
        Attribute att = new Attribute();

        att.BaseValue  = PlayerPrefs.GetInt(((AttributeName)name).ToString() + BASE_VALUE, 0);
        att.ExpToLevel = PlayerPrefs.GetInt(((AttributeName)name).ToString() + EXP_TO_LEVEL, Attribute.STARTING_EXP_COST);
        return(att);
    }
예제 #22
0
 public Defect(AttributeName name, double value, double min, double max, bool resolution = false)
 {
     Name       = name;
     Value      = value;
     Min        = min;
     Max        = max;
     Resolution = resolution;
 }
예제 #23
0
            IEnumerator <Line> GetEnumerator(AttributeName name)
            {
                yield return(new Line(name, ":"));

                foreach (var line in json.Lines)
                {
                    yield return(line + 1);
                }
            }
예제 #24
0
        public static IEnumerable <XElement> ElementsBy(this XContainer container, AttributeName attributeName)
        {
            Contract.Requires(container.IsNotNull());
            Contract.Requires(attributeName.IsNotNull());

            var elements = container.Descendants().Where(item => item.Attributes().Any(a => a.Name.LocalName.Equals(attributeName.Value)));

            return(elements);
        }
예제 #25
0
        public void ReLabel(AttributeName name)
        {
            if (name == null)
            {
                throw new InvariantGuardFailureException();
            }

            ApplyChange(new ReLabelAttributeEvent(GetIdentity(), name.Name));
        }
        public override int GetHashCode()
        {
            const int constant = 197;

            return(AttributeName.GetHashCode() * constant
                   + ValueType.GetHashCode()
                   + SerializedEnumValues.GetHashCode()
                   + EnumValues.GetHashCode());
        }
예제 #27
0
    private void AddSkillModifier(SkillName skillName, AttributeName attributeName,
                                  float ratio)
    {
        ModifyingAttribute modifyingAttribute = new ModifyingAttribute();

        modifyingAttribute.attribute = GetPrimaryAttribute(attributeName);
        modifyingAttribute.ratio     = ratio;
        GetSkill(skillName).AddModifier(modifyingAttribute);
    }
예제 #28
0
        public static XElement ElementBy(this XContainer container, AttributeName attributeName)
        {
            Contract.Requires(container.IsNotNull());
            Contract.Requires(attributeName.IsNotNull());

            var element = container.ElementsBy(attributeName).FirstOrDefault();

            return(element);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         // ReSharper disable NonReadonlyMemberInGetHashCode
         return(((AttributeName != null ? AttributeName.GetHashCode(StringComparison.Ordinal) : 0) * 397) ^
                (Value != null ? Value.GetHashCode() : 0));
         // ReSharper restore NonReadonlyMemberInGetHashCode
     }
 }
예제 #30
0
파일: Bag.cs 프로젝트: mo5h/omeo
        /// <summary>
        /// Gets a <paramref name="name"/> value from the bag, or default if it's missing.
        /// </summary>
        public T Get <T>(AttributeName name, T defaultvalue)
        {
            object value;

            if ((Store.TryGetValue(name, out value)) || (value == null))
            {
                return(DynamicCast <T>(name, value));
            }
            return(defaultvalue);
        }
        private static void TestProductSpecDefect(LotStat lotStat, AttributeName attributeName, bool tooHigh = true, string description = null)
        {
            var stat = GetLotStatHelper.GetProductSpecDefectStat(new[]
            {
                BuildProductSpecDefect(attributeName, tooHigh ? 4 : 1, 2, 3, false)
            });

            Assert.AreEqual(lotStat, stat.LotStat);
            Assert.AreEqual(description, stat.Description);
        }
예제 #32
0
    public Attribute(AttributeName name, Character target, int initialValue)
    {
        _name = name;
        _value = initialValue;
        this.target = target;

        appliedEffect = null;
        statModifiers = new Dictionary<StatModifier, float>();

        InitialiseModifier();
        foreach(KeyValuePair<StatModifier, float> statMod in statModifiers)
            target.AddModifier(statMod.Key);

        if(appliedEffect != null)
            target.AddEffect(appliedEffect, intercept);
    }
예제 #33
0
 private void DrawAttributeEditorControl(AttributeName attr, bool changalbe)
 {
     Attribute targetAttr = this.BasicCharacterInfo.GetCharAttribute(attr);
     GUILayout.BeginHorizontal();
     GUILayout.Label(Enum.GetName(typeof(AttributeName), attr));
     GUILayout.Space(80);
     GUILayout.Box(targetAttr.AdjustedValue.ToString());
     GUILayout.Space(30);
     if (changalbe)
     {
         if (GUILayout.Button("+", GUILayout.Width(20)))
         {
             targetAttr.BasicValue++;
         }
         if (GUILayout.Button("-", GUILayout.Width(20)))
         {
             targetAttr.BasicValue = Math.Max(--targetAttr.BasicValue, 0);
         }
     }
     GUILayout.Space(30);
     GUILayout.EndHorizontal();
 }
예제 #34
0
 public Attribute GetCharAttribute(AttributeName name)
 {
     return this.CharAttributes[(int)name];
 }
예제 #35
0
 public AttributeCreatedEvent(Guid identity, AttributeName name, bool allowMultiple)
     : base(identity)
 {
     Name = name;
     AllowMultiple = allowMultiple;
 }
예제 #36
0
 public bool IsPrimary(AttributeName att)
 {
     return Array.IndexOf(primaryAttributes, att) != -1;
 }
예제 #37
0
 public bool equalsAnother(AttributeName another)
 {
     return this.getLocal(AttributeName.HTML) == another.getLocal(AttributeName.HTML);
 }
예제 #38
0
 private void AddSkillModifier(SkillName skillName, AttributeName attributeName,
     float ratio)
 {
     ModifyingAttribute modifyingAttribute = new ModifyingAttribute();
     modifyingAttribute.attribute = GetPrimaryAttribute(attributeName);
     modifyingAttribute.ratio = ratio;
     GetSkill(skillName).AddModifier(modifyingAttribute);
 }
예제 #39
0
 public Attribute GetAttribute(AttributeName index)
 {
     return GetAttribute((int)index);
 }
예제 #40
0
 public Attribute GetPrimaryAttribute(AttributeName attributeName)
 {
     return GetPrimaryAttribute((int)attributeName);
 }
 public static void LoadAttribute( AttributeName name )
 {
     PC.Instance.GetPrimaryAttribute( (int)name ).BaseValue  = PlayerPrefs.GetInt(((AttributeName)name).ToString() + BASE_VALUE, 0);
     PC.Instance.GetPrimaryAttribute( (int)name ).ExpToLevel = PlayerPrefs.GetInt(((AttributeName)name).ToString() + EXP_TO_LEVEL, Attribute.STARTING_EXP_COST);
 }
 public static void SaveAttribute( AttributeName name, Attribute attribute )
 {
     PlayerPrefs.SetInt(((AttributeName)name).ToString() + BASE_VALUE, attribute.BaseValue );
     PlayerPrefs.SetInt(((AttributeName)name).ToString() + EXP_TO_LEVEL, attribute.ExpToLevel );
 }
예제 #43
0
 private void AddSkillModifier(SkillName skill, AttributeName mod, float ratio)
 {
     GetSkill((int)skill).AddModifier(new ModifyingAttribute{attribute = GetPrimaryAttribute((int)mod), ratio = ratio});
 }
예제 #44
0
 private void AddVitalModifier(VitalName vital, AttributeName mod, float ratio)
 {
     GetSkill((int)vital).AddModifier(new ModifyingAttribute{attribute = GetPrimaryAttribute((int)mod), ratio = ratio});
 }