Esempio n. 1
0
        public static void DbLoaderCommaNoCast <T>(DbDebugItem <T> debug, AttributeList list, int indexStart, int length)
        {
            var table = debug.AbsractDb.Table;

            foreach (string[] elements in TextFileHelper.GetElementsByCommas(IOHelper.ReadAllBytes(debug.FilePath)))
            {
                try {
                    T   itemId = (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(elements[0]);
                    int max    = length;

                    for (int index = 1; index < elements.Length && max > 0; index++)
                    {
                        DbAttribute property = list.Attributes[index + indexStart - 1];

                        int previousVal = 0;

                        if (table.ContainsKey(itemId))
                        {
                            previousVal = table.GetTuple(itemId).GetValue <int>(ServerSkillAttributes.Flag);
                        }

                        table.SetRaw(itemId, property, Int32.Parse(elements[index]) | previousVal);
                        max--;
                    }
                }
                catch (Exception err) {
                    if (!debug.ReportException(err))
                    {
                        return;
                    }
                }
            }
        }
Esempio n. 2
0
 internal AttributeListAttribute(INtfsContext context, AttributeRecord record)
     : base(context, record)
 {
     byte[] content = Utilities.ReadAll(Content);
     _list = new AttributeList();
     _list.ReadFrom(content, 0);
 }
Esempio n. 3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn public void ChangeOrder(List<int> permutations, int sourceProcessId)
        ///
        /// \brief Change order.
        ///
        /// \par Description.
        ///      This method change the order of messages coming from a process.
        ///
        /// \par Algorithm.
        ///      -# The first step is to create the __channelMessagesIdxs__ which is conversion list from the Q (which contains
        ///         messages from all processes) to a list that contains messages from the source process
        ///         -#  Example:
        ///             -#  Suppose we have the following Message Q
        ///                 -#  [0] Message0 from process 0
        ///                 -#  [1] Message1 from process 1
        ///                 -#  [2] Message2 from process 0
        ///                 -#  [3] Message3 from process 2
        ///             -#  The conversion table for process 0 will be
        ///                 -#  [0] 0
        ///                 -#  [1] 2
        ///      -# The second step is to create __messagesFromProcess__ which is a list of messages from the source process
        ///         -#  For this example the list will be
        ///                 -#  [0] message0
        ///                 -#  [1] message2
        ///      -# The third step is to apply the permutations:
        ///         -#  Example if we switched between message0 and message1
        ///             -# The permutation list will be
        ///                -#  [0] 1
        ///                -#  [1] 0
        ///                -#  The source index of each change is the value of the entry in __permutations__
        ///                -#  The target index of each change is the index of the entry in __permutations__
        ///                -#  The changes will be:
        ///                    -#  For index 0 in the __permutation__ list
        ///                        -#  Take the message in index 1 in the __messagesFromProcess__ list(because 1 is the value)
        ///                        -#  Put this message in the MessageQ in index __channelMessagesIdxs[0]__ which is 0
        ///                    -#  For index 1 in the __permutation__ list
        ///                        -#  Take the message in index 1 in the __messagesFromProcess__ list(because 0 is the value)
        ///                        -#  Put this message in the MessageQ in index __channelMessagesIdxs[1]__ which is 2.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 21/05/2018
        ///
        /// \param permutations    (List&lt;int&gt;) - The permutations.
        /// \param sourceProcessId (int) - Identifier for the source process.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void ChangeOrder(List <int> permutations, int sourceProcessId)
        {
            // Create a list of indexes of the messages coming from the source process
            // This list is used to convert indexes from the permutation list to the
            // MessageQues :
            // If we have a value in the permutations the message that corresponds to this value
            // Is channelMessagesIdx[value]
            List <int> channelMessagesIdxs = new List <int>();

            // Create a list of messagesFromProcess
            // The purpose of this list is to be the source of the messages that changed
            // If we have a permutation we copy from this list to the MessageQ and
            // don't have to worry about overriding messages in the messageQ
            AttributeList messagesFromProcess = new AttributeList();

            channelMessagesIdxs = ExstractChannelMessages(sourceProcessId, out messagesFromProcess);

            // Do the permutations
            for (int idx = 0; idx < permutations.Count; idx++)
            {
                if (permutations[idx] != idx)
                {
                    int originalIndex = permutations[idx];
                    int finalIndex    = idx;
                    this[channelMessagesIdxs[finalIndex]] = messagesFromProcess[originalIndex];
                }
            }

            // Change the message in process of the processor
            RetrieveFirstMessageFromQueue(ref ((BaseProcess)Element).MessageInProcess);
        }
Esempio n. 4
0
    /***************************************************************************/
    public SVGGradientElement(SVGParser xmlImp, AttributeList attrList)
    {
        _attrList      = attrList;
        _xmlImp        = xmlImp;
        _stopList      = new List <SVGStopElement>();
        _id            = _attrList.GetValue("id");
        _gradientUnits = SVGGradientUnit.ObjectBoundingBox;
        if (_attrList.GetValue("gradiantUnits") == "userSpaceOnUse")
        {
            _gradientUnits = SVGGradientUnit.UserSpaceOnUse;
        }

        //------
        // TODO: It's probably a bug that the value is not innoculated for CaSe
        // VaRiAtIoN in GetValue, below:
        _spreadMethod = SVGSpreadMethod.Pad;
        if (_attrList.GetValue("spreadMethod") == "reflect")
        {
            _spreadMethod = SVGSpreadMethod.Reflect;
        }
        else if (_attrList.GetValue("spreadMethod") == "repeat")
        {
            _spreadMethod = SVGSpreadMethod.Repeat;
        }

        GetElementList();
    }
Esempio n. 5
0
    public SVGPaintable(SVGPaintable inheritPaintable, AttributeList attrList)
    {
        this._linearGradList = inheritPaintable.linearGradList;
        this._radialGradList = inheritPaintable.radialGradList;;
        Initialize(attrList);

        if(IsFillX() == false) {
          if(inheritPaintable.IsLinearGradiantFill()) {
        this._gradientID = inheritPaintable.gradientID;
          } else if(inheritPaintable.IsRadialGradiantFill()) {
        this._gradientID = inheritPaintable.gradientID;
          } else this._fillColor = inheritPaintable.fillColor;
        }
        if(!IsStroke()&& inheritPaintable.IsStroke()) {
          this._strokeColor = inheritPaintable.strokeColor;
        }

        if(_strokeLineCap == SVGStrokeLineCapMethod.Unknown) {
          _strokeLineCap = inheritPaintable.strokeLineCap;
        }

        if(_strokeLineJoin == SVGStrokeLineJoinMethod.Unknown) {
          _strokeLineJoin = inheritPaintable.strokeLineJoin;
        }

        if(isStrokeWidth == false)
          this._strokeWidth.NewValueSpecifiedUnits(inheritPaintable.strokeWidth);
    }
 public SVGClipPathElement(SVGParser xmlImp, Node node)
 {
     _attrList = node.attributes;
     _xmlImp = xmlImp;
     _id = _attrList.GetValue("id");
     GetElementList();
 }
        private TileViewModel CreateItem(Product product, CurrencyString price)
        {
            var tileViewModel = new TileViewModel
            {
                Link    = this.CreateProductActionLink(product),
                ImageId = product.MainImageId ?? Guid.Empty,
                Name    = product.Name
            };

            if (this.user != null)
            {
                var attributes = new AttributeList();
                attributes.Add(new KeyValuePair <string, string>(StringResource.productTile_Available, this.GetProductAvailableString(product)));

                if (price != null)
                {
                    attributes.Add(new KeyValuePair <string, string>(StringResource.productTile_Price, price.ToString()));
                }

                tileViewModel.Attributes = attributes;

                /*
                 * if (!user.IsAdmin)
                 * {
                 *  tileViewModel.Action = this.CreateAddToCartLink(product);
                 * }
                 */
            }

            return(tileViewModel);
        }
Esempio n. 8
0
        /**********************************************************************************************//**
        * Adjust for other elements breakpoints.
        *
        * \author  Ilan Hindy
        * \date    29/09/2016
        *
        * \param   parametersList  List of parameters.
        * \param   network         The network.
        *
        **************************************************************************************************/

        private void AdjustForOtherElementsBreakpoints(AttributeList parametersList, BaseNetwork network)
        {
            // If the breakpoint is on other elements it has 4 parameters
            // 1. List of processors
            // 2. List of channels
            // 3. message handling mode
            // 4. breakpoint
            // The first 2 elements stayes and the other parameters are stored in member variables
            // Save the network in member
            // If the list of the channels is empty add -1 to the list - this will cause the evaluation method
            //    to evaluate with channel = null.
            // The -1 is inserted in a new list in order not effect the original list

            Operators o = or[brp.ork.Operator];

            if (o == Operators.OperationsOnOtherElements)
            {
                breakpointForOtherElements = ((Attribute)parametersList[3]).Value;
                messageHandlingForOtherElementOperation = ((Attribute)parametersList[2]).Value;
                networkForOtherElementOperation         = network;
                parametersList.RemoveAt(3);
                parametersList.RemoveAt(2);
                if (((Attribute)parametersList[1]).Value.Count == 0)
                {
                    parametersList[1] = new Attribute()
                    {
                        Value = new List <int>()
                        {
                            -1
                        }
                    };
                }
            }
        }
Esempio n. 9
0
        internal static string Open(
            string name,
            AttributeList attributes,
            TagOptions options)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return("");
            }

            options = TagOptions.UseOrCreate(options);

            // if we have a data-list of attributes, add to object
            if (attributes.Options == null)
            {
                attributes.Options = options.Attribute;
            }
            var attributeText = attributes?.ToString() ?? "";

            // ensure attributes have space in front
            if (!string.IsNullOrEmpty(attributeText) && attributeText[0] != ' ')
            {
                attributeText = " " + attributeText;
            }

            var selfClose = options.Close && options.SelfClose ? "/" : "";

            return($"<{name}{attributeText}{selfClose}>");
        }
Esempio n. 10
0
    /***********************************************************************************/
    //Khoi tao
    private void Initialize(AttributeList attrList)
    {
        isStrokeWidth = false;

        if (attrList.GetValue("fill").IndexOf("url") >= 0)
        {
            _gradientID = SVGStringExtractor.ExtractUrl4Gradient(attrList.GetValue("fill"));
        }
        else
        {
            _fillColor = new SVGColor(attrList.GetValue("fill"));
        }
        _strokeColor = new SVGColor(attrList.GetValue("stroke"));

        if (attrList.GetValue("stroke-width") != "")
        {
            isStrokeWidth = true;
        }
        _strokeWidth = new SVGLength(attrList.GetValue("stroke-width"));


        SetStrokeLineCap(attrList.GetValue("stroke-linecap"));
        SetStrokeLineJoin(attrList.GetValue("stroke-linejoin"));

        if (attrList.GetValue("stroke-width") == "")
        {
            _strokeWidth.NewValueSpecifiedUnits(1f);
        }
        Style(attrList.GetValue("style"));
        //style="fill: #ffffff; stroke:#000000; stroke-width:0.172"
    }
Esempio n. 11
0
 /**
  * Adds a collection of attributes to this fragment. The compiler will embed the
  * attributes into the resulting scene graph as a osgSim::ShapeAttributeList.
  *
  * If a fragment has attributes, the compiler will be forces to maintain "feature
  * integrity" -- the feature will end up residing alone under a dedicated osg::Geode
  * instead of being optimized into a larger set of geometries.
  *
  * @param attrs
  *      Attributes to embed
  */
 public void addAttributes(AttributeList attrs)
 {
     foreach (Attribute i in attrs)
     {
         this.setAttribute(i);
     }
 }
Esempio n. 12
0
        /**********************************************************************************************//**
        * Creates parameters lists.
        *
        * \author  Ilan Hindy
        * \date    29/09/2016
        *
        * \param   parameters  Options for controlling the operation.
        *
        * \return  The new parameters lists.
        *  .
        **************************************************************************************************/

        private List <List <dynamic> > CreateParametersLists(AttributeList parameters)
        {
            List <List <dynamic> > parametersValuesLists = new List <List <dynamic> >();

            foreach (dynamic parameter in parameters)
            {
                List <dynamic> parameterValuesList   = new List <dynamic>();
                Attribute.AttributeCategory category = Attribute.GetValueCategory(parameter);
                switch (category)
                {
                case Attribute.AttributeCategory.ListOfAttributes:
                    foreach (Attribute attribute in parameter.Value)
                    {
                        parameterValuesList.Add(attribute.Value);
                    }
                    break;

                case Attribute.AttributeCategory.PrimitiveAttribute:
                    parameterValuesList.Add(parameter.Value);
                    break;

                case Attribute.AttributeCategory.NetworkElementAttribute:
                    parameterValuesList.Add(parameter.Value);
                    break;

                case Attribute.AttributeCategory.AttributeDictionary:
                    parameterValuesList.Add(parameter.Value);
                    break;
                }
                parametersValuesLists.Add(parameterValuesList);
            }
            return(parametersValuesLists);
        }
 public AddRequest(
     LDAPDN entry,
     AttributeList attributes)
 {
     this.entry = entry;
     this.attributes = attributes;
 }
Esempio n. 14
0
 internal AttributeListAttribute(INtfsContext context, AttributeRecord record)
     : base(context, record)
 {
     byte[] content = Utilities.ReadAll(Content);
     _list = new AttributeList();
     _list.ReadFrom(content, 0);
 }
Esempio n. 15
0
 public AttributeList(AttributeList a)
 {
     if(a.attrs != null)
       attrs = new Dictionary<string,string>(a.attrs);
     else
       attrs = null;
 }
Esempio n. 16
0
        /// <summary>
        /// Handles the Click event of the lbConfigure control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void lbConfigure_Click(object sender, EventArgs e)
        {
            SelectedAttributes = new List <int>();
            AttributeList.ForEach(a => SelectedAttributes.Add(a));

            ddlCategories.Items.Clear();

            int    attributeEntityTypeId = EntityTypeCache.Get("Rock.Model.Attribute").Id;
            string personEntityTypeId    = EntityTypeCache.Get("Rock.Model.Person").Id.ToString();

            foreach (var category in new CategoryService(new RockContext()).Queryable()
                     .Where(c =>
                            c.EntityTypeId == attributeEntityTypeId &&
                            c.EntityTypeQualifierColumn == "EntityTypeId" &&
                            c.EntityTypeQualifierValue == personEntityTypeId))
            {
                if (category.IsAuthorized(Authorization.VIEW, CurrentPerson))
                {
                    ListItem li = new ListItem(category.Name, category.Id.ToString());
                    ddlCategories.Items.Add(li);
                }
            }

            BindAttributeSelection(ddlCategories.SelectedValueAsId() ?? 0);

            ShowDialog("KEYATTRIBUTES");
        }
Esempio n. 17
0
        private void CreateControls(bool setValues)
        {
            fsAttributes.Controls.Clear();

            hfAttributeOrder.Value = AttributeList.AsDelimited("|");

            if (Person != null)
            {
                foreach (int attributeId in AttributeList)
                {
                    var    attribute      = AttributeCache.Get(attributeId);
                    string attributeValue = Person.GetAttributeValue(attribute.Key);
                    string formattedValue = string.Empty;

                    if (ViewMode != VIEW_MODE_EDIT || !attribute.IsAuthorized(Authorization.EDIT, CurrentPerson))
                    {
                        if (ViewMode == VIEW_MODE_ORDER)
                        {
                            var div = new HtmlGenericControl("div");
                            fsAttributes.Controls.Add(div);
                            div.Attributes.Add("data-attribute-id", attribute.Id.ToString());
                            div.Attributes.Add("class", "form-group");

                            var a = new HtmlGenericControl("a");
                            div.Controls.Add(a);

                            var i = new HtmlGenericControl("i");
                            a.Controls.Add(i);
                            i.Attributes.Add("class", "fa fa-bars");

                            div.Controls.Add(new LiteralControl(" " + attribute.Name));
                        }
                        else
                        {
                            if (attribute.FieldType.Class == typeof(Rock.Field.Types.ImageFieldType).FullName)
                            {
                                formattedValue = attribute.FieldType.Field.FormatValueAsHtml(fsAttributes, attribute.EntityTypeId, Person.Id, attributeValue, attribute.QualifierValues, true);
                            }
                            else
                            {
                                formattedValue = attribute.FieldType.Field.FormatValueAsHtml(fsAttributes, attribute.EntityTypeId, Person.Id, attributeValue, attribute.QualifierValues, false);
                            }

                            if (!string.IsNullOrWhiteSpace(formattedValue))
                            {
                                fsAttributes.Controls.Add(new RockLiteral {
                                    Label = attribute.Name, Text = formattedValue
                                });
                            }
                        }
                    }
                    else
                    {
                        attribute.AddControl(fsAttributes.Controls, attributeValue, string.Empty, setValues, true);
                    }
                }
            }

            pnlActions.Visible = (ViewMode != VIEW_MODE_VIEW);
        }
Esempio n. 18
0
        internal void Reset()
        {
            foreach (CharacterAttrib objAttribute in AttributeList.Concat(SpecialAttributeList))
            {
                objAttribute.UnbindAttribute();
            }
            AttributeList.Clear();
            SpecialAttributeList.Clear();
            foreach (string strAttribute in AttributeStrings)
            {
                CharacterAttrib objAttribute;
                switch (CharacterAttrib.ConvertToAttributeCategory(strAttribute))
                {
                case CharacterAttrib.AttributeCategory.Special:
                    objAttribute = new CharacterAttrib(_objCharacter, strAttribute, CharacterAttrib.AttributeCategory.Special);
                    SpecialAttributeList.Add(objAttribute);
                    break;

                case CharacterAttrib.AttributeCategory.Standard:
                    objAttribute = new CharacterAttrib(_objCharacter, strAttribute, CharacterAttrib.AttributeCategory.Standard);
                    AttributeList.Add(objAttribute);
                    break;
                }
            }
            BuildBindingList();
        }
Esempio n. 19
0
 internal void Override(OverrideEditConfig ovEdit)
 {
     if (ovEdit.ReadOnly.HasValue)
     {
         ReadOnly = ovEdit.ReadOnly.Value;
     }
     if (ovEdit.Class != null)
     {
         Class = ovEdit.Class;
     }
     if (ovEdit.DefaultValue != null)
     {
         DefaultValue = ovEdit.DefaultValue;
     }
     if (ovEdit.Updating != null)
     {
         Updating = ovEdit.Updating;
     }
     if (ovEdit.AttributeList != null)
     {
         if (AttributeList == null)
         {
             AttributeList = ovEdit.AttributeList;
         }
         else
         {
             AttributeList.AddRange(ovEdit.AttributeList);
         }
     }
     if (ovEdit.Display != null)
     {
         Display = ovEdit.Display;
     }
 }
Esempio n. 20
0
        public CharacterAttrib GetAttributeByName(string abbrev)
        {
            bool            blnGetShifterAttribute = _objCharacter.MetatypeCategory == "Shapeshifter" && _objCharacter.Created && _objCharacter.AttributeSection.AttributeCategory == CharacterAttrib.AttributeCategory.Shapeshifter;
            CharacterAttrib objReturn = AttributeList.FirstOrDefault(att => att.Abbrev == abbrev && (att.MetatypeCategory == CharacterAttrib.AttributeCategory.Shapeshifter) == blnGetShifterAttribute) ?? SpecialAttributeList.FirstOrDefault(att => att.Abbrev == abbrev);

            return(objReturn);
        }
Esempio n. 21
0
 protected static AttributeList ConvertToAttributeList(object curvalue)
 {
     AttributeList multi;
     if (curvalue == null)
     {
         multi = new AttributeList(); // make list to hold multiple values
         multi.Add(curvalue);                 // Add previous single-valued attribute
     }
     else if (curvalue.GetType() == typeof(AttributeList))
     {
         // already a list made by Template
         multi = (AttributeList)curvalue;
     }
     else if (curvalue is IList)
     {
         // existing attribute is non-Template List
         // must copy to an Template-managed list before adding new attribute
         // (can't alter incoming attributes)
         IList listAttr = (IList)curvalue;
         multi = new AttributeList(listAttr.Count);
         multi.AddRange(listAttr.Cast<object>());
     }
     else
     {
         // curvalue nonlist and we want to Add an attribute
         // must convert curvalue existing to list
         multi = new AttributeList(); // make list to hold multiple values
         multi.Add(curvalue);                 // Add previous single-valued attribute
     }
     return multi;
 }
Esempio n. 22
0
    public static AttributeList GetCustomAttributes( Member member, TypeNode attrType ) {
      AttributeList result = null;
      if (member == null) 
	      return null;
      AttributeList attrs = member.Attributes;
      if( attrs != null ) {
        for( int i = 0; i < attrs.Count; i++ ) {
          AttributeNode an = attrs[i];
          if (an == null) continue;
          MemberBinding mb = an.Constructor as MemberBinding;
          if( mb != null && mb.BoundMember != null && mb.BoundMember.DeclaringType == attrType ) {
            if( result == null ) {
              result = new AttributeList();
            }
            result.Add(an);
          }
        }
      }
      if (result == null) {
        TypeNode tn = member as TypeNode;
        if (tn != null) return MetadataHelper.GetCustomAttributes(tn.BaseType, attrType);
        Property p = MetadataHelper.GetPropertyForMethod(member);
        if (p != null) return MetadataHelper.GetCustomAttributes(p, attrType);
      }      
      return result;
    }    
        public SVGGradientElement(SVGParser xmlImp, Node node)
        {
            _attrList = node.attributes;
            _xmlImp = xmlImp;
            _stopList = new List<SVGStopElement>();
            _id = _attrList.GetValue("id");
            _gradientUnits = SVGGradientUnit.ObjectBoundingBox;
            if (_attrList.GetValue("gradiantUnits") == "userSpaceOnUse")
            {
                _gradientUnits = SVGGradientUnit.UserSpaceOnUse;
            }

            _gradientTransform = new SVGTransformList(_attrList.GetValue("gradientTransform"));

            //------
            // TODO: It's probably a bug that the value is not innoculated for CaSe
            // VaRiAtIoN in GetValue, below:
            _spreadMethod = SVGSpreadMethod.Pad;
            if (_attrList.GetValue("spreadMethod") == "reflect")
            {
                _spreadMethod = SVGSpreadMethod.Reflect;
            } else if (_attrList.GetValue("spreadMethod") == "repeat")
            {
                _spreadMethod = SVGSpreadMethod.Repeat;
            }

            if(node is BlockOpenNode)
            {
                GetElementList();
            }
        }
Esempio n. 24
0
        /**********************************************************************************************//**
        * Evaluates the given parameters.
        *
        * \author  Ilan Hindy
        * \date    29/09/2016
        *
        * \param   parameters  Options for controlling the operation.
        *
        * \return  true if it succeeds, false if it fails.
        *  .
        **************************************************************************************************/

        private bool Evaluate(AttributeList parameters)
        {
            Operators Operator = or[brp.ork.Operator];

            switch (Operator)
            {
            case Operators.None: return(false);

            case Operators.OperationsOnOtherElements: return(Evaluate(parameters, (x, y) => { return EvaluateForOtherElements(x, y); }));

            case Operators.DataEqual: return(Evaluate(parameters, (x, y) => { return (x is NetworkElement)? x.EqualsTo(y):x.Equals(y); }));

            case Operators.DataNotEqual: return(Evaluate(parameters, (x, y) => { return (x is NetworkElement) ? !(x.EqualsTo(y)) : !(x.Equals(y)); }));

            case Operators.And: return(Evaluate(parameters, (x, y) => { return x && y; }));

            case Operators.Bigger: return(Evaluate(parameters, (x, y) => { return x > y; }));

            case Operators.BiggerOrEqual: return(Evaluate(parameters, (x, y) => { return x >= y; }));

            case Operators.Equeal: return(Evaluate(parameters, (x, y) => { return x == y; }));

            case Operators.NotEqual: return(Evaluate(parameters, (x, y) => { return x != y; }));

            case Operators.Not: return(Evaluate(parameters, (x, y) => { return !x; }));

            case Operators.Or: return(Evaluate(parameters, (x, y) => { return x || y; }));

            case Operators.SmalerOrEqual: return(Evaluate(parameters, (x, y) => { return x <= y; }));

            case Operators.Smaller: return(Evaluate(parameters, (x, y) => { return x < y; }));

            default: return(false);
            }
        }
Esempio n. 25
0
 public virtual AttributeNode GetClosestMatch(AttributeNode/*!*/ nd1, AttributeList/*!*/ list1, AttributeList list2, int list1pos, ref int list2start,
   TrivialHashtable/*!*/ matchedNodes, out Differences closestDifferences, out int list2pos) {
   closestDifferences = null; list2pos = -1;
   if (list2 == null) return null;
   if (nd1 == null || list1 == null || matchedNodes == null ||  list1pos < 0 || list1pos >= list1.Count || list2start < 0 || list2start >= list2.Count) {
     Debug.Assert(false); return null;
   }
   AttributeNode closest = null;
   Differences winnerSoFar = null;
   for (int j = list2start, m = list2.Count; j < m; j++){
     AttributeNode nd2 = list2[j];
     if (list2start == j) list2start++;
     if (nd2 == null) continue;
     if (matchedNodes[nd2.UniqueKey] != null) continue;
     Differences diff = this.GetDifferences(nd1, nd2);
     if (diff == null){Debug.Assert(false); continue;}
     if (diff.Similarity <= 0.5){
       //Not a good enough match
       if (list2start == j+1) list2start--; //The next call to GetClosestMatch will start looking at list2start, so this node will be considered then
       continue; //ignore it for the rest of this call
     }
     if (winnerSoFar != null && winnerSoFar.Similarity >= diff.Similarity) continue;
     winnerSoFar = closestDifferences = diff;
     closest = nd2;
     list2pos = j;
     if (diff.NumberOfDifferences == 0) return closest; //Perfect match, no need to look for other matches
   }
   if (closest != null){
     //^ assert winnerSoFar != null;
     //closest is closer to nd1 than any other node in list2, but this is no good if some other node in list1 has a better claim on closest
     for (int i = list1pos+1, n = list1.Count; i < n; i++){
       AttributeNode nd1alt = list1[i];
       if (nd1alt == null) continue;
       if (matchedNodes[nd1alt.UniqueKey] != null) continue;
       Differences diff = this.GetDifferences(nd1alt, closest);
       if (diff == null){Debug.Assert(false); continue;}
       if (diff.Similarity <= winnerSoFar.Similarity) continue;
       //nd1alt has a better claim on closest. See if it wants closest.
       Differences diff2;
       int j, k = list2start;
       AttributeNode nd2alt = this.GetClosestMatch(nd1alt, list1, list2, i, ref k,  matchedNodes, out diff2, out j);
       if (nd2alt != closest){
         Debug.Assert(nd2alt != null && diff2 != null && diff2.Similarity >= diff.Similarity);
         continue; //nd1alt prefers nd2alt to closest, so closest is still available
       }
       //nd1alt wants closest, take it out of the running
       matchedNodes[closest.UniqueKey] = nd1alt;
       //Now that closest is out of the running, try again
       k = list2start;
       AttributeNode newClosest = this.GetClosestMatch(nd1, list1, list2, i, ref k, matchedNodes, out winnerSoFar, out list2pos);
       //put closest back in the running so that the next call to this routine will pick it up
       matchedNodes[closest.UniqueKey] = closest;
       closest = newClosest;
       break;
     }
   }
   closestDifferences = winnerSoFar;
   return closest;
 }
 internal CustomPropertyDescriptor(object owner, PropertyDescriptor pd)
     : base(pd)
 {
     propertyDescriptor = pd;
     this.owner = owner;
     attributes = new AttributeList(pd.Attributes);
     UpdateMemberData();
 }
 internal CustomPropertyDescriptor(object owner, PropertyDescriptor pd)
     : base(pd)
 {
     propertyDescriptor = pd;
     this.owner         = owner;
     attributes         = new AttributeList(pd.Attributes);
     UpdateMemberData();
 }
Esempio n. 28
0
        protected AttributeList Init_ork_ReceivedMessageFrom()
        {
            AttributeList list = new AttributeList();

            list.codeAttributeCounter   = 0;
            list.designAttributeCounter = 0;
            return(list);
        }
Esempio n. 29
0
 /***********************************************************************************/
 public SVGPathElement(AttributeList attrList, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable, SVGGraphics r)
     : base(inheritTransformList)
 {
     _attrList = attrList;
     _paintable = new SVGPaintable(inheritPaintable, attrList);
     _render = r;
     Initial();
 }
Esempio n. 30
0
 public void AddAttribute(string key, string value)
 {
     if (AttributeList == null)
     {
         AttributeList = new List <KeyValuePair <string, string> >();
     }
     AttributeList.Add(new KeyValuePair <string, string>(key, value));
 }
Esempio n. 31
0
 public ListMerge(AttributeList existList, AttributeList newList)
 {
     InitializeComponent();
     this.existList = existList;
     this.newList   = newList;
     FillPresentData();
     PresentAll();
 }
Esempio n. 32
0
    public void Test()
    {
        var attributeList = AttributeList.GetCustomAttributeList(typeof(TestClass));

        Assert.IsTrue(attributeList.IsAttributeSet <TestAttrAttribute>());
        Assert.IsFalse(attributeList.IsAttributeSet <TestClassAttribute>());
        Assert.IsInstanceOfType(attributeList.FindAttribute <TestAttrAttribute>(), typeof(TestAttrAttribute));
    }
        protected AttributeList Init_ork_State()
        {
            AttributeList list = new AttributeList();

            list.codeAttributeCounter   = 0;
            list.designAttributeCounter = 0;
            return(list);
        }
Esempio n. 34
0
        public void AddToState(BaseMessage message)
        {
            AttributeList state = OperationResults.Value[OperationResultKeys.State].Value;

            state.Add(new Attribute {
                Value = message
            });
        }
Esempio n. 35
0
        public static void PostRender()
        {
            AttributeList list = Manager.GetAttributes();

            if (list == null)
            {
                return;
            }
        }
Esempio n. 36
0
        public static GEXF DataGraph()
        {
            var _GEXF = new GEXF();

            _GEXF.Metadata
            .SetCreator("Gephi.org")
            .SetDescription("A Web network");

            var _AttributeList = new AttributeList(AttributeClass.NODE);

//            _GEXF.Graph.AttributeLists.Add(_AttributeList);
            //Attribute attUrl      = _AttributeList.CreateAttribute("0", AttributeType.STRING,  "url");
            //Attribute attIndegree = _AttributeList.CreateAttribute("1", AttributeType.FLOAT,   "indegree");
            //Attribute attFrog     = _AttributeList.CreateAttribute("2", AttributeType.BOOLEAN, "frog")
            //    .setDefaultValue("true");

            var gephi = _GEXF.Graph.AddNode("0");

            gephi
            .SetLabel("Gephi");
            //.getAttributeValues()
            //    .addValue(attUrl, "http://gephi.org")
            //    .addValue(attIndegree, "1");

            var webatlas = _GEXF.Graph.AddNode("1");

            webatlas
            .SetLabel("Webatlas");
            //.getAttributeValues()
            //    .addValue(attUrl, "http://webatlas.fr")
            //    .addValue(attIndegree, "2");

            var rtgi = _GEXF.Graph.AddNode("2");

            rtgi
            .SetLabel("RTGI");
            //.getAttributeValues()
            //    .addValue(attUrl, "http://rtgi.fr")
            //    .addValue(attIndegree, "1");

            var blab = _GEXF.Graph.AddNode("3");

            blab
            .SetLabel("BarabasiLab");
            //.getAttributeValues()
            //    .addValue(attUrl, "http://barabasilab.com")
            //    .addValue(attIndegree, "1")
            //    .addValue(attFrog, "false");

            gephi.ConnectTo("0", webatlas);
            gephi.ConnectTo("1", rtgi);
            webatlas.ConnectTo("2", gephi);
            rtgi.ConnectTo("3", webatlas);
            gephi.ConnectTo("4", blab);

            return(_GEXF);
        }
Esempio n. 37
0
 public CreatureEntry(object owner)
     : base(owner)
 {
     Lands     = new string[0];
     Inventory = new InventoryEntry[0];
     Abilities = new AttributeList();
     Skills    = new AttributeList();
     Dialog    = new DialogEntry();
 }
Esempio n. 38
0
 private AttributeList Translate(CodeAttributeDeclarationCollection attributes, AttributeList attributeList){
   if (attributes == null) return null;
   int n = attributes.Count;
   if (attributeList == null)
     if (n == 0) return null; else attributeList = new AttributeList(n);
   for (int i = 0; i < n; i++)
     attributeList.Add(this.Translate(attributes[i]));
   return attributeList;
 }
Esempio n. 39
0
        public static void DbItemsTradeFunction <T>(DbDebugItem <T> debug, AttributeList list, string[] elements, Table <T, ReadableTuple <T> > table)
        {
            T itemId = (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(elements[0]);

            Trade trade = new Trade();

            trade.Set(elements[1], elements[2]);
            table.SetRaw(itemId, ServerItemAttributes.Trade, trade);
        }
        public MethodTemplate(MethodInfo method)
        {
            Method     = method;
            Name       = method.Name;
            IsAsync    = method.ReturnType.FullName.StartsWith(typeof(Task).FullName);
            ReturnType = new TypeTemplate(method.ReturnType);
            foreach (var attr in CustomAttributeData.GetCustomAttributes(method))
            {
                AttributeList.Add(new CustomAttributeTemplate(attr).ToString());
            }
            //方法参数
            foreach (var parameter in method.GetParameters())
            {
                Parameters.Add(new ParameterTemplate(parameter));
            }

            if (method.IsGenericMethod)
            {
                foreach (var argumentType in method.GetGenericArguments())
                {
                    var argument = new GenericArgumentTemplate()
                    {
                        Name = argumentType.Name
                    };
                    GenericArguments.Add(argument);

                    if (argumentType.GenericParameterAttributes == GenericParameterAttributes.None &&
                        argumentType.GetGenericParameterConstraints().Length == 0)
                    {
                        continue;
                    }

                    //class约束
                    if (argumentType.GenericParameterAttributes.HasFlag(GenericParameterAttributes.ReferenceTypeConstraint))
                    {
                        argument.Constraints.Add("class");
                    }
                    //值类型约束
                    if (argumentType.GenericParameterAttributes.HasFlag(GenericParameterAttributes.NotNullableValueTypeConstraint))
                    {
                        argument.Constraints.Add("struct");
                    }

                    foreach (var type in argumentType.GetGenericParameterConstraints())
                    {
                        argument.Constraints.Add(new TypeTemplate(type).ToString());
                    }

                    //无参构造函数
                    if (argumentType.GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint))
                    {
                        argument.Constraints.Add("new()");
                    }
                }
            }
        }
Esempio n. 41
0
 public override AttributeList VisitAttributeList(AttributeList attributes)
 {
     AttributeList list = new AttributeList();
     for (int i = 0; i < attributes.Count; i++)
     {
         AttributeNode a = attributes[i];
         list.Add(VisitAttributeNode(a));
     }
     return list;
 }
Esempio n. 42
0
 public void UnbindAttributeSection()
 {
     _dicBindings.Clear();
     foreach (CharacterAttrib objAttribute in AttributeList.Concat(SpecialAttributeList))
     {
         objAttribute.UnbindAttribute();
     }
     AttributeList.Clear();
     SpecialAttributeList.Clear();
 }
 //================================================================================
 public SVGPolylineElement(  AttributeList attrList,
             SVGTransformList inheritTransformList,
             SVGPaintable inheritPaintable,
             SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._render = _render;
     this._paintable = new SVGPaintable(inheritPaintable, attrList);
     this._listPoints = ExtractPoints(this._attrList.GetValue("points"));
 }
        public SVGPathElement(Node node, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable = null) : base(inheritTransformList)
        {
            _attrList = node.attributes;
            _paintable = new SVGPaintable(inheritPaintable, node);
            currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));
            Rect viewport = _paintable.viewport;
            this.currentTransformList.AppendItem(new SVGTransform(SVGTransformable.GetViewBoxTransform(_attrList, ref viewport, false)));
            paintable.SetViewport(viewport);

            Initial();
        }
 public SVGPolygonElement(Node node, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable = null) : base(inheritTransformList)
 {
     this._attrList = node.attributes;
     this._paintable = new SVGPaintable(inheritPaintable, node);
     this._listPoints = ExtractPoints(this._attrList.GetValue("points"));
     this.currentTransformList = new SVGTransformList(attrList.GetValue("transform"));
     
     Rect viewport = _paintable.viewport;
     this.currentTransformList.AppendItem(new SVGTransform(SVGTransformable.GetViewBoxTransform(_attrList, ref viewport, false)));
     paintable.SetViewport(viewport);
 }
Esempio n. 46
0
 /***************************************************************************/
 public SVGStopElement(AttributeList attrList)
 {
     _stopColor = new SVGColor(attrList.GetValue("stop-color"));
     string temp = attrList.GetValue("offset").Trim();
     if(temp != "") {
       if(temp.EndsWith("%")) {
     _offset = SVGNumber.ParseToFloat(temp.TrimEnd(new char[1]{'%'}));
       } else {
     _offset = SVGNumber.ParseToFloat(temp)* 100;
       }
     }
 }
Esempio n. 47
0
 /***************************************************************************/
 public SVGStopElement(AttributeList attrList)
 {
     _stopColor = new SVGColor(attrList.GetValue("stop-color"));
     string temp = attrList.GetValue("offset").Trim();
     if(temp != "") {
       if(temp.EndsWith("%")) {
     _offset = float.Parse(temp.TrimEnd(new char[1] { '%' }), System.Globalization.CultureInfo.InvariantCulture);
       } else {
     _offset = float.Parse(temp, System.Globalization.CultureInfo.InvariantCulture)* 100;
       }
     }
 }
        public SVGCircleElement(Node node, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable = null) : base(inheritTransformList)
        {
            this._attrList = node.attributes;
            this._paintable = new SVGPaintable(inheritPaintable, node);
            this._cx = new SVGLength(attrList.GetValue("cx"));
            this._cy = new SVGLength(attrList.GetValue("cy"));
            this._r = new SVGLength(attrList.GetValue("r"));
            this.currentTransformList = new SVGTransformList(attrList.GetValue("transform"));

            Rect viewport = _paintable.viewport;
            this.currentTransformList.AppendItem(new SVGTransform(SVGTransformable.GetViewBoxTransform(this._attrList, ref viewport, false)));
            paintable.SetViewport(viewport);
        }
Esempio n. 49
0
 //================================================================================
 public SVGCircleElement(AttributeList attrList,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._render = _render;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._cx = new SVGLength(attrList.GetValue("cx"));
     this._cy = new SVGLength(attrList.GetValue("cy"));
     this._r = new SVGLength(attrList.GetValue("r"));
 }
Esempio n. 50
0
		public Tag GetTag()
		{
			AttributeList attributes = new AttributeList();

			foreach(Attribute x in List)
			{
				attributes.Add((Attribute)x.Clone());
			}

            Tag retVal = new Tag(m_tag, attributes);

			return(retVal);
		}
Esempio n. 51
0
 private void GetAttributesStartPos(AttributeList attrs, ref int priorStartLine, ref int priorStartPos) {
   if (attrs != null) {
     for (int i=0; i<attrs.Count; i++) {
       if (attrs[i] != null) {
         int candidateStart = attrs[i].SourceContext.StartPos;
         if (candidateStart < priorStartPos) {
           priorStartPos = candidateStart;
           priorStartLine = attrs[i].SourceContext.StartLine;
         }
       }
     }
   }
 }
Esempio n. 52
0
 /***********************************************************************************/
 public SVGSVGElement(  SVGParser xmlImp,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics r)
     : base(inheritTransformList)
 {
     _render = r;
     _xmlImp = xmlImp;
     _attrList = _xmlImp.Node.Attributes;
     _paintable = new SVGPaintable(inheritPaintable, _attrList);
     _width = new SVGLength(_attrList.GetValue("width"));
     _height = new SVGLength(_attrList.GetValue("height"));
     Initial();
 }
Esempio n. 53
0
        public Tag(string name, AttributeList attributes)
        {
            if (name == null)
            {
                throw new ArgumentException("name cannot be null");
            }
            if (attributes == null)
            {
                throw new ArgumentException("attributes cannot be null");
            }

            this._name = name;
            this._attributes = attributes;
        }
Esempio n. 54
0
 /***********************************************************************************/
 public SVGLineElement(  AttributeList attrList,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._render = _render;
     this._x1 = new SVGLength(attrList.GetValue("x1"));
     this._y1 = new SVGLength(attrList.GetValue("y1"));
     this._x2 = new SVGLength(attrList.GetValue("x2"));
     this._y2 = new SVGLength(attrList.GetValue("y2"));
 }
 public SVGLineElement(Node node, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable = null) : base(inheritTransformList)
 {
     this._attrList = node.attributes;
     this._paintable = new SVGPaintable(inheritPaintable, node);
     this._x1 = new SVGLength(attrList.GetValue("x1"));
     this._y1 = new SVGLength(attrList.GetValue("y1"));
     this._x2 = new SVGLength(attrList.GetValue("x2"));
     this._y2 = new SVGLength(attrList.GetValue("y2"));
     this.currentTransformList = new SVGTransformList(attrList.GetValue("transform"));
     
     Rect viewport = _paintable.viewport;
     this.currentTransformList.AppendItem(new SVGTransform(SVGTransformable.GetViewBoxTransform(_attrList, ref viewport, false)));
     paintable.SetViewport(viewport);
 }
Esempio n. 56
0
 /***********************************************************************************/
 public SVGGElement(SVGParser xmlImp,
                   SVGTransformList inheritTransformList,
                   SVGPaintable inheritPaintable,
                   SVGGraphics render)
     : base(inheritTransformList)
 {
     _render = render;
     _xmlImp = xmlImp;
     _attrList = _xmlImp.Node.Attributes;
     _paintable = new SVGPaintable(inheritPaintable, _attrList);
     _elementList = new List<object>();
     currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));
     GetElementList();
 }
        private static void ScrubAttributeList(AttributeList attributes)
        {
            if (attributes == null) return;
            for (int i = 0, n = attributes.Count; i < n; i++)
            {
                if (attributes[i] == null) continue;

                if (attributes[i].Type == null) continue;

                if (ContractNodes.ContractClassAttributeName.Matches(attributes[i].Type.Name))
                {
                    attributes[i] = null;
                }
            }
        }
    /***************************************************************************/
    public SVGLinearGradientElement(SVGParser xmlImp, AttributeList attrList)
        : base(xmlImp, attrList)
    {
        string temp;
        temp = _attrList.GetValue("x1");
        _x1 = new SVGLength((temp == "") ? "0%" : temp);

        temp = this._attrList.GetValue("y1");
        _y1 = new SVGLength((temp == "") ? "0%" : temp);

        temp = this._attrList.GetValue("x2");
        _x2 = new SVGLength((temp == "") ? "100%" : temp);

        temp = this._attrList.GetValue("y2");
        _y2 = new SVGLength((temp == "") ? "0%" : temp);
    }
Esempio n. 59
0
 //================================================================================
 public SVGRectElement(AttributeList attrList,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._render = _render;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._x = new SVGLength(attrList.GetValue("x"));
     this._y = new SVGLength(attrList.GetValue("y"));
     this._width = new SVGLength(attrList.GetValue("width"));
     this._height = new SVGLength(attrList.GetValue("height"));
     this._rx = new SVGLength(attrList.GetValue("rx"));
     this._ry = new SVGLength(attrList.GetValue("ry"));
 }
    /***************************************************************************/
    public SVGRadialGradientElement(SVGParser xmlImp, AttributeList attrList)
        : base(xmlImp, attrList)
    {
        string temp;
        temp = attrList.GetValue("cx");
        _cx = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("cy");
        _cy = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("r");
        _r = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("fx");
        _fx = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("fy");
        _fy = new SVGLength((temp == "") ? "50%" : temp);
    }