Inheritance: MonoBehaviour
Ejemplo n.º 1
0
            protected Attributes _attributes; // start tags get attributes on construction. End tags get attributes on first new attribute (but only for parser convenience, not used).

            public void NewAttribute()
            {
                if (_attributes == null)
                {
                    _attributes = new Attributes();
                }

                if (_pendingAttributeName != null)
                {
                    NSoup.Nodes.Attribute attribute;
                    if (_pendingAttributeValue == null)
                    {
                        attribute = new NSoup.Nodes.Attribute(_pendingAttributeName, "");
                    }
                    else
                    {
                        attribute = new NSoup.Nodes.Attribute(_pendingAttributeName, _pendingAttributeValue.ToString());
                    }

                    _attributes.Add(attribute);
                }
                _pendingAttributeName = null;
                if (_pendingAttributeValue != null)
                {
                    _pendingAttributeValue.Remove(0, _pendingAttributeValue.Length);
                }
            }
Ejemplo n.º 2
0
    public void InitializeStats(int level)
    {
        Attributes tempatts = new Attributes();
        _entity = GetComponent<Entity>();

        tempatts.Health = baseHP + scalingHP * (level - 1);
        tempatts.Resource = baseResource + scalingResource * (level - 1);
        tempatts.Power = basePower + scalingPower * (level - 1);
        tempatts.Defense = baseDefense + scalingDefense * (level - 1);
        tempatts.MinDamage = baseMinDmg + scalingMinDmg * (level - 1);
        tempatts.MaxDamage = baseMaxDmg + scalingMaxDmg * (level - 1);
        tempatts.MovementSpeed = baseMoveSpd + scalingMoveSpd * (level - 1);
        tempatts.AttackSpeed = baseAttackSpd + scalingAttackSpd * (level - 1);

        LootDropChance = UnityEngine.Random.Range(0f, 3f);

        MinLootDrops = 1;
        MaxLootDrops = 5;

        _entity.baseAtt = tempatts;

        GetComponent<Entity>().UpdateCurrentAttributes();

        GetComponent<AIController>().doesWander = wanders;
        GetComponent<AIController>().aggroRadius = _aggroRadius;
        GetComponent<AIPursuit>().doesFlee= flees;
    }
Ejemplo n.º 3
0
        internal string TestVideoConversion()
        {
            var readWriteFactory = new ReadWriteClassFactory();

            var attributes = new Attributes
            {
                ReadWriterEnableHardwareTransforms = true,
                SourceReaderEnableVideoProcessing = true
            };

            var readers = VideoFiles.Select(f => f.CreateSourceReader(readWriteFactory, attributes)).ToArray();

            var testOuputFile = readers.First().FileName + ".tmp.test.wmv";
            try
            {
                using (var sinkWriter = readWriteFactory.CreateSinkWriterFromURL(testOuputFile, attributes))
                {
                    var writeToSink = ConnectStreams(readers, sinkWriter);
                }
            }
            catch(Exception e)
            {
                return e.Message;
            }
            finally
            {
                if (readers != null)
                    foreach (var r in readers)
                        r.Dispose();

                File.Delete(testOuputFile);
            }

            return null;
        }
Ejemplo n.º 4
0
 void Start()
 {
     nma = GetComponent<NavMeshAgent>();
     attri = GetComponent<Attributes>();
     StartCoroutine("WaitATick");
     nma.stoppingDistance = attri.range;
 }
Ejemplo n.º 5
0
 private static Attributes CopyAttributes(Attributes source) {
   if (source == null) {
     return null;
   } else {
     return new Attributes(source.Name, source.Args, CopyAttributes(source.Prev));
   }
 }
 public override int Calculate(Attributes propertyAttrs, int val)
 {
     if (!Empty)
         foreach (List<EffectNode> list in effects)
             list.ForEach(node => node.Effect.Affect(propertyAttrs, node.Attributes, ref val));
     return val;
 }
Ejemplo n.º 7
0
 // attribute names are generally caught in one hop, not accumulated
 // but values are accumulated, from e.g. & in hrefs
 // start tags get attributes on construction. End tags get attributes on first new attribute (but only for parser convenience, not used).
 internal void NewAttribute()
 {
     if (attributes == null)
     {
         attributes = new Attributes();
     }
     if (pendingAttributeName != null)
     {
         Attribute attribute;
         if (pendingAttributeValue == null)
         {
             attribute = new Attribute(pendingAttributeName, string.Empty);
         }
         else
         {
             attribute = new Attribute(pendingAttributeName, pendingAttributeValue.ToString());
         }
         attributes.Put(attribute);
     }
     pendingAttributeName = null;
     if (pendingAttributeValue != null)
     {
         pendingAttributeValue.Remove(0, pendingAttributeValue.Length);
     }
 }
Ejemplo n.º 8
0
    public equipment(string name, equipSlots.equipmentType type, equipSlots.slots slot, int equipmentTier, int minlevel, int maxlevel, float health, float resource, float power, float defense, float mindmg, float maxdmg, float movespeed, float attackspeed, string flavortxt)
    {
        equipmentAttributes = new Attributes();
        equipmentName = name;
        equipmentType = type;
        flavorText = flavortxt;
        validSlot = slot;
        tier = equipmentTier;
        minlvl = minlevel;
        maxlvl = maxlevel;
        equipmentAttributes.Health = health;
        equipmentAttributes.Resource = resource;
        equipmentAttributes.Power = power;
        equipmentAttributes.Defense = defense;
        equipmentAttributes.MinDamage = mindmg;
        equipmentAttributes.MaxDamage = maxdmg;
        equipmentAttributes.AttackSpeed = attackspeed;
        equipmentAttributes.MovementSpeed = movespeed;

        slotList.Add("Head", equipSlots.slots.Head);
        slotList.Add("Legs", equipSlots.slots.Legs);
        slotList.Add("Feet", equipSlots.slots.Feet);
        slotList.Add("Chest", equipSlots.slots.Chest);
        slotList.Add("Main", equipSlots.slots.Main);
        slotList.Add("Off", equipSlots.slots.Off);

        twohand = false;
        ranged = false;
        onhit = "";

        prefixname = "";
        suffixname = "";

        modelname = "default";
    }
Ejemplo n.º 9
0
 public Screen(int x, int y)
 {
     Width = x;
     Height = y;
     Buffer = new char[y * x];
     Attributes = new Attributes[Buffer.Length];
 }
Ejemplo n.º 10
0
    public affix(string name, equipSlots.affixtype type, float health, float resource, float power, float defense, float mindmg, float maxdmg, float movespeed, float attackspeed, equipSlots.slots[] validslots)
    {
        affixAttributes = new Attributes();
        affixName = name;
        affixType = type;
        affixAttributes.Health = health;
        affixAttributes.Resource = resource;
        affixAttributes.Power = power;
        affixAttributes.Defense = defense;
        affixAttributes.MinDamage = mindmg;
        affixAttributes.MaxDamage = maxdmg;
        affixAttributes.AttackSpeed = attackspeed;
        affixAttributes.MovementSpeed = movespeed;

        foreach (equipSlots.slots slot in validslots)
        {
            affixSlots.Add(slot);
        }

        slotList.Add("Head", equipSlots.slots.Head);
        slotList.Add("Legs", equipSlots.slots.Legs);
        slotList.Add("Feet", equipSlots.slots.Feet);
        slotList.Add("Chest", equipSlots.slots.Chest);
        slotList.Add("Main", equipSlots.slots.Main);
        slotList.Add("Off", equipSlots.slots.Off);
    }
Ejemplo n.º 11
0
        public ControllerContext(ILog log, Attributes startupAttributes)
        {
            Ensure.NotNull(log, nameof(log));

            Log = log;
            StartupAttributes = startupAttributes ?? new Attributes();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates a new weapon with specified name and attributes.
 /// </summary>
 public Weapon(WeaponProperties data, CombatProperties propes, Attributes attri, StatusEffectProperties effect)
 {
     WeaponData = data;
     CombatProperties = propes;
     Attributes = attri;
     Effect = effect;
 }
Ejemplo n.º 13
0
        public SourceReaderExtra CreateSourceReader(ReadWriteClassFactory readWriteFactory, Attributes attributes)
        {
            TraceDebug.WriteLine("Attempting to open file {0}".F(this.FileName));
            var reader = readWriteFactory.CreateSourceReaderFromURL(this.FileName, attributes);
            TraceDebug.WriteLine("Opened file {0}.  Duration: {1}".F(this.FileName, reader.Duration.FromNanoToSeconds()));

            return new SourceReaderExtra(this.FileName,  this.State,  reader);
        }
Ejemplo n.º 14
0
        public override System.Web.UI.WebControls.WebControl RenderControl(Attributes.Setting setting, Object sender)
        {
            cc.ShowXPath = false;
            cc.ID = setting.GetName().Replace(" ", "_");

            cc.Value = _val;
            return (System.Web.UI.WebControls.WebControl)cc;
        }
Ejemplo n.º 15
0
Archivo: Node.cs Proyecto: bkzhn/dcsoup
 /// <summary>
 /// Create a new Node.
 /// </summary>
 /// <param name="baseUri">base URI</param>
 /// <param name="attributes">attributes (not null, but may be empty)</param>
 internal Node(string baseUri, Attributes attributes)
 {
     Validate.NotNull(baseUri);
     Validate.NotNull(attributes);
     childNodes = new List<Node>(4);
     this.baseUri = baseUri.Trim();
     this.attributes = attributes;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Returns a string for all attributes on the list "a".  Each attribute is
 /// followed by a space.
 /// </summary>
 public static string AttributesToString(Attributes a)
 {
     if (a == null) {
     return "";
       } else {
     return AttributesToString(a.Prev) + OneAttributeToString(a) + " ";
       }
 }
Ejemplo n.º 17
0
 public CreatedAttribute(Attributes attribute, bool isPhysical, int minRating, int maxRating)
 {
     IsPhysical = isPhysical;
     CurrentRating = minRating;
     MinRating = minRating;
     Attribute = attribute;
     _maxRating = maxRating;
 }
Ejemplo n.º 18
0
        public override System.Web.UI.WebControls.WebControl RenderControl(Attributes.Setting setting, Object sender)
        {
            tb.ID = setting.GetName();

            tb.TextMode = TextBoxMode.Password;
            tb.CssClass = "guiInputText guiInputStandardSize";
            return tb;
        }
Ejemplo n.º 19
0
 // render opcode 5 - change picture
 /**
    * @see <a href="XRenderChangePicture.html">XRenderChangePicture</a>
    */
 public void change(Attributes attr)
 {
     Request request = new Request (display, render.major_opcode, 5,
       5+attr.count ());
     request.write4 (id);
     request.write4 (attr.bitmask);
     attr.write (request);
     display.send_request (request);
 }
Ejemplo n.º 20
0
		public TypeContainer (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
			: base (parent, name, attrs)
		{
			this.Kind = kind;
			if (name != null)
				this.Basename = name.Basename;

			defined_names = new Dictionary<string, MemberCore> ();
		}
 public ItemWithAttributes(Attributes attributes)
 {
     Attributes = attributes;
     statusParticleTextureData = getTextureDataForStatus(Attributes.Status);
     statusParticleTimer = 0.0f;
     affiliationTint = getColorForAffiliation(Attributes.Affiliation);
     affiliationTintAlpha = 0.0f;
     incAffiliationTintAlpha = true;
 }
Ejemplo n.º 22
0
 public Skill(string name, SkillActionUsingType usingType, SkillUpgrader upgrader)
 {
     if (Upgrader == null)
         ArgumentNull.Throw("Upgrader");
     Name = name;
     UsingType = usingType;
     Upgrader = upgrader;
     Attributes = new Attributes();
 }
Ejemplo n.º 23
0
 void Start()
 {
     id = "Heal";
     damage = 50;
     cooldown = 20;
     magiccost = 60;
     self = gameObject.GetComponent<Attributes>();
     timestamp = 0;
 }
Ejemplo n.º 24
0
        public override System.Web.UI.WebControls.WebControl RenderControl(Attributes.Setting setting, Object sender)
        {
            fu.ID = setting.GetName();

            if (!string.IsNullOrEmpty(_val))
                fu.FileName = _val;

            return fu;
        }
Ejemplo n.º 25
0
 public IParseble Parse(JSONNode xsollaInfoNode)
 {
     name = xsollaInfoNode ["name"].Value;
     value = xsollaInfoNode ["value"].Value;
     string key = xsollaInfoNode["attributes"]["key"];
     string pref = xsollaInfoNode["attributes"]["pref"];
     string parameter = xsollaInfoNode["attributes"]["parameter"];
     attributes = new Attributes (key, pref, parameter);
     return this;
 }
Ejemplo n.º 26
0
        public void Create_Attributes_Single()
        {
            var attributes = new Attributes("Create_Attributes_Single");

            var expectet = Comparer.Create_Attributes_Single();
            var actual = attributes.ToString();

            Assert.AreEqual(expectet, actual);
            Console.WriteLine(actual);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Generates login URL
 /// </summary>
 /// <returns>The login URL based on request</returns>
 public string GenerateLoginURL(string Redirect, string Server, Attributes Required)
 {
     this.RedirectURL = Redirect;
     this.ServerURL = Server;
     foreach (AttributeExchange Extension in Extensions.OfType<AttributeExchange>())
     {
         Extension.Required = Required;
     }
     return GenerateLoginURL();
 }
Ejemplo n.º 28
0
        public override System.Web.UI.WebControls.WebControl RenderControl(Attributes.Setting setting, Object sender)
        {
            tb.ID = setting.GetName();
            tb.TextMode = TextBoxMode.SingleLine;
            tb.CssClass = "guiInputText guiInputStandardSize";

            if (string.IsNullOrEmpty(tb.Text) && Prevalues.Count > 0)
                tb.Text = Prevalues[0];

            return tb;
        }
Ejemplo n.º 29
0
 public void SetAttribute(Attributes.attributeNames _attributes)
 {
     if (_attributes == Attributes.attributeNames.NONE)
     {
         return;
     }
     if (_attributes == Attributes.attributeNames.FREEZE)
     {
         Freeze();
     }
 }
Ejemplo n.º 30
0
 public Attributes CloneAttributes(Attributes attrs)
 {
     if (attrs == null) {
     return null;
       } else if (attrs.Name.StartsWith("_")) {
     // skip this attribute, since it would have been produced during resolution
     return CloneAttributes(attrs.Prev);
       } else {
     return new Attributes(attrs.Name, attrs.Args.ConvertAll(CloneExpr), CloneAttributes(attrs.Prev));
       }
 }
Ejemplo n.º 31
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="effectiveAttributes">TBD</param>
 /// <returns>TBD</returns>
 public abstract IStage <TIn, TOut> Create(Attributes effectiveAttributes);
Ejemplo n.º 32
0
        /// <summary>
        /// Adds all attributes that should be added to the control begin tag.
        /// </summary>
        protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequestContext context)
        {
            writer.AddKnockoutDataBind("enable", this, EnabledProperty, () =>
            {
                if (!Enabled)
                {
                    writer.AddAttribute("disabled", "disabled");
                }
            });

            AddValueAndFormatBindingAttribute(writer, context);

            if (Type == TextBoxType.MultiLine)
            {
                TagName = "textarea";
            }
            else if (Type == TextBoxType.Normal)
            {
                TagName = "input";

                // do not overwrite type attribute
                if (!Attributes.ContainsKey("type"))
                {
                    writer.AddAttribute("type", "text");
                }
            }
            else
            {
                string type = null;
                switch (Type)
                {
                case TextBoxType.Password:
                    type = "password";
                    break;

                case TextBoxType.Telephone:
                    type = "tel";
                    break;

                case TextBoxType.Url:
                    type = "url";
                    break;

                case TextBoxType.Email:
                    type = "email";
                    break;

                case TextBoxType.Date:
                    type = "date";
                    break;

                case TextBoxType.Time:
                    type = "time";
                    break;

                case TextBoxType.Color:
                    type = "color";
                    break;

                case TextBoxType.Search:
                    type = "search";
                    break;

                case TextBoxType.Number:
                    type = "number";
                    break;

                default:
                    throw new NotSupportedException($"TextBox Type '{ Type }' not supported");
                }
                writer.AddAttribute("type", type);
                TagName = "input";
            }

            // prepare changed event attribute
            var changedBinding = GetCommandBinding(ChangedProperty);

            if (changedBinding != null)
            {
                writer.AddAttribute("onchange", KnockoutHelper.GenerateClientPostBackScript(nameof(Changed), changedBinding, this, useWindowSetTimeout: true, isOnChange: true));
            }

            base.AddAttributesToRender(writer, context);
        }
Ejemplo n.º 33
0
 // Our optional attributes implementation is little convoluted as there is
 // no such firsclass mechanism from the config system. We basically cache
 // any "unrecognized" attribute here and serialize it out later.
 protected override bool OnDeserializeUnrecognizedAttribute(String name, String value)
 {
     Attributes.Add(name, value);
     return(true);
 }
Ejemplo n.º 34
0
        /// <summary>
        /// This is a normalization step for the graph that also collects the needed
        /// information for later fusing. The goal is to transform an arbitrarily deep
        /// module tree into one that has exactly two levels: all direct submodules are
        /// CopiedModules where each contains exactly one atomic module. This way all
        /// modules have their own identity and all necessary port copies have been
        /// made. The upstreams/downstreams in the BuildStructuralInfo are rewritten
        /// to point to the shapes of the copied modules.
        ///
        /// The materialized value computation is rewritten as well in that all
        /// leaf nodes point to the copied modules and all nested computations are
        /// "inlined", resulting in only one big computation tree for the whole
        /// normalized overall module. The contained MaterializedValueSource stages
        /// are also rewritten to point to the copied MaterializedValueNodes. This
        /// correspondence is then used during materialization to trigger these sources
        /// when "their" node has received its value.
        /// </summary>
        private static LinkedList <KeyValuePair <IModule, IMaterializedValueNode> > Descend <T>(
            IModule module,
            Attributes inheritedAttributes,
            BuildStructuralInfo structInfo,
            ISet <IModule> openGroup,
            int indent)
        {
            var isAsync = module is GraphStageModule || module is GraphModule
                ? module.Attributes.Contains(Attributes.AsyncBoundary.Instance)
                : module.IsAtomic || module.Attributes.Contains(Attributes.AsyncBoundary.Instance);

            if (IsDebug)
            {
                Log(indent,
                    $"entering {module.GetType().Name} (hash={module.GetHashCode()}, async={isAsync}, name={module.Attributes.GetNameLifted()}, dispatcher={GetDispatcher(module)})");
            }
            var localGroup = isAsync ? structInfo.CreateGroup(indent) : openGroup;

            if (module.IsAtomic)
            {
                GraphModule graphModule;
                if ((graphModule = module as GraphModule) != null)
                {
                    if (!isAsync)
                    {
                        if (IsDebug)
                        {
                            Log(indent,
                                $"dissolving graph module {module.ToString().Replace("\n", $"\n{string.Empty.PadLeft(indent*2)}")}");
                        }
                        // need to dissolve previously fused GraphStages to allow further fusion
                        var attributes = inheritedAttributes.And(module.Attributes);
                        return(new LinkedList <KeyValuePair <IModule, IMaterializedValueNode> >(
                                   graphModule.MaterializedValueIds.SelectMany(
                                       sub => Descend <T>(sub, attributes, structInfo, localGroup, indent + 1))));
                    }
                    else
                    {
                        /*
                         * Importing a GraphModule that has an AsyncBoundary attribute is a little more work:
                         *
                         *  - we need to copy all the CopiedModules that are in matValIDs
                         *  - we need to rewrite the corresponding MaterializedValueNodes
                         *  - we need to match up the new (copied) GraphModule shape with the individual Shape copies
                         *  - we need to register the contained modules but take care to not include the internal
                         *    wirings into the final result, see also `struct.removeInternalWires()`
                         */
                        if (IsDebug)
                        {
                            Log(indent,
                                $"graph module {module.ToString().Replace("\n", $"\n{string.Empty.PadLeft(indent*2)}")}");
                        }

                        var oldShape = graphModule.Shape;
                        var mvids    = graphModule.MaterializedValueIds;

                        // storing the old Shape in arrays for in-place updating as we clone the contained GraphStages
                        var oldIns  = oldShape.Inlets.ToArray();
                        var oldOuts = oldShape.Outlets.ToArray();

                        var newIds = mvids.OfType <CopiedModule>().Select(x =>
                        {
                            var newShape = x.Shape.DeepCopy();
                            IModule copy = new CopiedModule(newShape, x.Attributes, x.CopyOf);

                            // rewrite shape: first the inlets
                            var oldIn = x.Shape.Inlets.GetEnumerator();
                            var newIn = newShape.Inlets.GetEnumerator();
                            while (oldIn.MoveNext() && newIn.MoveNext())
                            {
                                var idx = Array.IndexOf(oldIns, oldIn.Current);
                                if (idx >= 0)
                                {
                                    oldIns[idx] = newIn.Current;
                                }
                            }

                            // ... then the outlets
                            var oldOut = x.Shape.Outlets.GetEnumerator();
                            var newOut = newShape.Outlets.GetEnumerator();
                            while (oldOut.MoveNext() && newOut.MoveNext())
                            {
                                var idx = Array.IndexOf(oldOuts, oldOut.Current);
                                if (idx >= 0)
                                {
                                    oldOuts[idx] = newOut.Current;
                                }
                            }

                            // need to add the module so that the structural (internal) wirings can be rewritten as well
                            // but these modules must not be added to any of the groups
                            structInfo.AddModule(copy, new HashSet <IModule>(), inheritedAttributes, indent, x.Shape);
                            structInfo.RegisterInternals(newShape, indent);
                            return(copy);
                        }).ToArray();

                        var newGraphModule = new GraphModule(graphModule.Assembly,
                                                             oldShape.CopyFromPorts(oldIns.ToImmutableArray(), oldOuts.ToImmutableArray()),
                                                             graphModule.Attributes, newIds);
                        // make sure to add all the port mappings from old GraphModule Shape to new shape
                        structInfo.AddModule(newGraphModule, localGroup, inheritedAttributes, indent, oldShape);
                        // now compute the list of all materialized value computation updates
                        var result = new LinkedList <KeyValuePair <IModule, IMaterializedValueNode> >(
                            mvids.Select(
                                (t, i) =>
                                new KeyValuePair <IModule, IMaterializedValueNode>(t,
                                                                                   new Atomic(newIds[i]))));
                        result.AddLast(new KeyValuePair <IModule, IMaterializedValueNode>(module,
                                                                                          new Atomic(newGraphModule)));
                        return(result);
                    }
                }
                else
                {
                    if (IsDebug)
                    {
                        Log(indent, $"atomic module {module}");
                    }
                    var result = new LinkedList <KeyValuePair <IModule, IMaterializedValueNode> >();
                    result.AddFirst(
                        new KeyValuePair <IModule, IMaterializedValueNode>(module,
                                                                           structInfo.AddModule(module, localGroup, inheritedAttributes, indent))
                        );
                    return(result);
                }
            }
            else
            {
                var allAttributes = inheritedAttributes.And(module.Attributes);
                if (module is CopiedModule copied)
                {
                    var result = Descend <T>(copied.CopyOf, allAttributes, structInfo, localGroup, indent + 1);
                    if (result.Count == 0)
                    {
                        throw new IllegalStateException("Descend returned empty result from CopiedModule");
                    }

                    result.AddFirst(new KeyValuePair <IModule, IMaterializedValueNode>(copied, result.First.Value.Value));

                    structInfo.Rewire(copied.CopyOf.Shape, copied.Shape, indent);
                    return(result);
                }
                else
                {
                    // we need to keep track of all MaterializedValueSource nodes that get pushed into the current
                    // computation context (i.e. that need the same value).
                    structInfo.EnterMaterializationContext();

                    // now descend into submodules and collect their computations (plus updates to `struct`)
                    var subMatBuilder = ImmutableDictionary.CreateBuilder <IModule, IMaterializedValueNode>();
                    foreach (var sub in module.SubModules)
                    {
                        var res = Descend <T>(sub, allAttributes, structInfo, localGroup, indent + 1);
                        foreach (var r in res)
                        {
                            // key may already be in builder, we overwrite
                            subMatBuilder[r.Key] = r.Value;
                        }
                    }
                    var subMat = subMatBuilder.ToImmutable();
                    if (IsDebug)
                    {
                        Log(indent,
                            $"subMat\n  {string.Empty.PadLeft(indent*2)}{string.Join("\n  " + string.Empty.PadLeft(indent*2), subMat.Select(p => $"{p.Key.GetType().Name}[{p.Key.GetHashCode()}] -> {p.Value}"))}");
                    }

                    // we need to remove all wirings that this module copied from nested modules so that we don’t do wirings twice
                    var oldDownstreams =
                        (module as FusedModule)?.Info.Downstreams.ToImmutableHashSet()
                        ?? module.Downstreams.ToImmutableHashSet();

                    var down = module.SubModules.Aggregate(oldDownstreams, (set, m) => set.Except(m.Downstreams));
                    foreach (var entry in down)
                    {
                        structInfo.Wire(entry.Key, entry.Value, indent);
                    }

                    // now rewrite the materialized value computation based on the copied modules and their computation nodes
                    var matNodeMapping = new Dictionary <IMaterializedValueNode, IMaterializedValueNode>();
                    var newMat         = RewriteMaterializer(subMat, module.MaterializedValueComputation, matNodeMapping);
                    // and finally rewire all MaterializedValueSources to their new computation nodes
                    var materializedSources = structInfo.ExitMaterializationContext();
                    foreach (var c in materializedSources)
                    {
                        if (IsDebug)
                        {
                            Log(indent, $"materialized value source: {structInfo.Hash(c)}");
                        }
                        var ms = (IMaterializedValueSource)((GraphStageModule)c.CopyOf).Stage;

                        IMaterializedValueNode mapped;
                        if (ms.Computation is Atomic atomic)
                        {
                            mapped = subMat[atomic.Module];
                        }
                        else if (ms.Computation == StreamLayout.Ignore.Instance)
                        {
                            mapped = ms.Computation;
                        }
                        else
                        {
                            mapped = matNodeMapping[ms.Computation];
                        }

                        var outputType = ms.Outlet.GetType().GetGenericArguments().First();
                        var materializedValueSourceType = typeof(MaterializedValueSource <>).MakeGenericType(outputType);
                        var newSrc      = (IMaterializedValueSource)Activator.CreateInstance(materializedValueSourceType, mapped, ms.Outlet);
                        var replacement = new CopiedModule(c.Shape, c.Attributes, newSrc.Module);
                        structInfo.Replace(c, replacement, localGroup);
                    }

                    // the result for each level is the materialized value computation
                    var result = new LinkedList <KeyValuePair <IModule, IMaterializedValueNode> >();
                    result.AddFirst(new KeyValuePair <IModule, IMaterializedValueNode>(module, newMat));
                    return(result);
                }
            }
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Return the <see cref="StructuralInfoModule"/> for this Graph without any fusing
        /// </summary>
        /// <typeparam name="TShape">TBD</typeparam>
        /// <typeparam name="TMat"></typeparam>
        /// <param name="graph"></param>
        /// <param name="attributes"></param>
        /// <returns></returns>
        public static StructuralInfoModule StructuralInfo <TShape, TMat>(IGraph <TShape, TMat> graph, Attributes attributes) where TShape : Shape
        {
            var structuralInfo = new BuildStructuralInfo();

            // First perform normalization by descending the module tree and recording
            // information in the BuildStructuralInfo instance.

            try
            {
                var materializedValue = Descend <TMat>(graph.Module, Attributes.None, structuralInfo,
                                                       structuralInfo.CreateGroup(0), 0);

                // Then create a copy of the original Shape with the new copied ports.
                var shape = graph.Shape.CopyFromPorts(structuralInfo.NewInlets(graph.Shape.Inlets),
                                                      structuralInfo.NewOutlets(graph.Shape.Outlets));

                // Extract the full topological information from the builder
                return(structuralInfo.ToInfo(shape, materializedValue.Select(pair => (pair.Key, pair.Value)).ToList(), attributes));
            }
            catch (Exception)
            {
                if (IsDebug)
                {
                    structuralInfo.Dump();
                }

                throw;
            }
        }
 protected override GraphStageLogic CreateLogic(Attributes inheritedAttributes)
 {
     return(new CurrentPersistenceIdsLogic(_redis.GetDatabase(_database), _system, Outlet, Shape));
 }
Ejemplo n.º 37
0
 public ClassViewModel()
 {
     MouseMove = new Command(() => {});
     MouseUp   = new Command(() =>
     {
         _mouseDownFlag = false;
         MouseMove      = new Command(() => { });
         OnPropertyChanged("MouseMove");
     });
     MouseDown = new Command(() =>
     {
         MainWindowViewModel.MainWindowSingleton.EndNewLine(this);
         MainWindowViewModel.MainWindowSingleton.EndDeleteLine(this);
         var mousePosition  = MainWindow.MousePosition - Position;
         _resizeDirection   = mousePosition.OnBorder(new Size(_width, _height), ThicknessResize);
         _lastPositionMouse = MainWindow.MousePosition;
         if (_resizeDirection == ResizeDirection.Nothing)
         {
             _mouseDownFlag = true;
             MouseMove      = new Command(() =>
             {
                 if (_mouseDownFlag == false)
                 {
                     return;
                 }
                 Position          += (MainWindow.MousePosition - _lastPositionMouse);
                 _lastPositionMouse = MainWindow.MousePosition;
             });
         }
         else
         {
             MouseMove = new Command(ResizeMove);
         }
         OnPropertyChanged("MouseMove");
     });
     EditAttributes            = new Command(() => { EditSelect(_selectAttribute); });
     EditMethods               = new Command(() => { EditSelect(_selectMethod); });
     SelectionAttributeChanged = new Command <RoutedEventArgs>((RoutedEventArgs e) =>
     {
         ListView listView = (ListView)e.Source;
         if (listView.SelectedItem == null)
         {
             return;
         }
         _selectAttribute = (FieldViewModel)listView.SelectedItem;
     });
     SelectionMethodChanged = new Command <RoutedEventArgs>((RoutedEventArgs e) =>
     {
         ListView listView = (ListView)e.Source;
         if (listView.SelectedItem == null)
         {
             return;
         }
         _selectMethod = (FieldViewModel)listView.SelectedItem;
     });
     AddAttribute = new Command(() =>
     {
         FieldViewModel fieldViewModel = new FieldViewModel();
         Attributes.Add(fieldViewModel);
         EditSelect(fieldViewModel);
     });
     AddMethod = new Command(() =>
     {
         FieldViewModel fieldViewModel = new FieldViewModel();
         Methods.Add(fieldViewModel);
         EditSelect(fieldViewModel);
     });
     DeleteAttribute = new Command(() =>
     {
         Attributes.Remove(_selectAttribute);
         _selectAttribute = null;
     });
     DeleteMethod = new Command(() =>
     {
         Methods.Remove(_selectMethod);
         _selectMethod = null;
     });
     AddLine = new Command(() =>
     {
         MainWindowViewModel.MainWindowSingleton.StartNewLine(this);
     });
     DeleteLine = new Command(() =>
     {
         MainWindowViewModel.MainWindowSingleton.StartDeleteLine(this);
     });
     DeleteClass = new Command(() =>
     {
         MainWindowViewModel.MainWindowSingleton.DeleteClass(this);
         ;
     });
 }
Ejemplo n.º 38
0
 public bool HasAttribute(SwiftTypeAttribute attribute)
 {
     return(Attributes.Any(attr => attr == attribute));
 }
 private void HandleItem(AssemblyLinkedResource alres)
 {
     _alres = alres;
     Attributes.Bind(alres);
     NameReference.Bind(alres == null ? null : alres.Assembly);
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Add the given attributes to this <see cref="IGraph{TShape}"/>.
 /// Further calls to <see cref="WithAttributes"/>
 /// will not remove these attributes. Note that this
 /// operation has no effect on an empty Flow (because the attributes apply
 /// only to the contained processing stages).
 /// </summary>
 IGraph <SinkShape <TIn>, TMat> IGraph <SinkShape <TIn>, TMat> .AddAttributes(Attributes attributes)
 => AddAttributes(attributes);
Ejemplo n.º 41
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(Attributes.GetDescription((MapTo)(int)value));
 }
Ejemplo n.º 42
0
 /// <summary>
 /// Change the attributes of this <see cref="IGraph{TShape}"/> to the given ones
 /// and seal the list of attributes. This means that further calls will not be able
 /// to remove these attributes, but instead add new ones. Note that this
 /// operation has no effect on an empty Flow (because the attributes apply
 /// only to the contained processing stages).
 /// </summary>
 IGraph <SinkShape <TIn>, TMat> IGraph <SinkShape <TIn>, TMat> .WithAttributes(Attributes attributes)
 => WithAttributes(attributes);
Ejemplo n.º 43
0
 /// <summary>
 /// Add a name attribute to this Sink.
 /// </summary>
 /// <param name="name">TBD</param>
 /// <returns>TBD</returns>
 public Sink <TIn, TMat> Named(string name) => AddAttributes(Attributes.CreateName(name));
Ejemplo n.º 44
0
        public BoundInterface(InterfaceGen iface, CodeGenerationOptions opt, CodeGeneratorContext context, GenerationInfo genInfo)
        {
            context.ContextTypes.Push(iface);

            Name = iface.Name;

            AddNestedSiblingTypes(iface, opt, context, genInfo);
            AddAlternativesClass(iface, opt, context);

            // If this interface is just fields and we can't generate any of them
            // then we don't need to write the interface.  We still keep this type
            // because it may have nested types or need an InterfaceMemberAlternativeClass.
            if (iface.IsConstSugar(opt) && iface.GetGeneratableFields(opt).Count() == 0)
            {
                dont_generate = true;
                return;
            }

            IsPartial = true;

            UsePriorityOrder = true;

            SetVisibility(iface.Visibility);

            iface.JavadocInfo?.AddJavadocs(Comments);
            Comments.Add($"// Metadata.xml XPath interface reference: path=\"{iface.MetadataXPathReference}\"");

            if (iface.IsDeprecated)
            {
                Attributes.Add(new ObsoleteAttr(iface.DeprecatedComment)
                {
                    WriteAttributeSuffix = true, WriteEmptyString = true
                });
            }

            if (!iface.IsConstSugar(opt))
            {
                var signature = string.IsNullOrWhiteSpace(iface.Namespace)
                                        ? iface.FullName.Replace('.', '/')
                                        : iface.Namespace + "." + iface.FullName.Substring(iface.Namespace.Length + 1).Replace('.', '/');

                Attributes.Add(new RegisterAttr(iface.RawJniName, string.Empty, signature + "Invoker", additionalProperties: iface.AdditionalAttributeString()));
            }

            if (iface.TypeParameters != null && iface.TypeParameters.Any())
            {
                Attributes.Add(new CustomAttr(iface.TypeParameters.ToGeneratedAttributeString()));
            }

            AddInheritedInterfaces(iface, opt);

            AddClassHandle(iface, opt);
            AddFields(iface, opt, context);
            AddProperties(iface, opt);
            AddMethods(iface, opt);
            AddNestedTypes(iface, opt, context, genInfo);

            // If this interface is just constant fields we don't need to add all the invoker bits
            if (iface.IsConstSugar(opt))
            {
                return;
            }

            if (!iface.AssemblyQualifiedName.Contains('/'))
            {
                if (iface.Methods.Any(m => m.CanHaveStringOverload) || iface.Methods.Any(m => m.Asyncify))
                {
                    post_sibling_types.Add(new InterfaceExtensionsClass(iface, null, opt));
                }
            }

            post_sibling_types.Add(new InterfaceInvokerClass(iface, opt, context));

            AddInterfaceEventHandler(iface, opt, context);

            context.ContextTypes.Pop();
        }
Ejemplo n.º 45
0
        /// <summary>
        /// Transform a set of GraphStageModules into a single GraphModule. This is done
        /// by performing a traversal of all their Inlets, sorting them into those without
        /// internal connections(the exposed inlets) and those with internal connections
        /// (where the corresponding Outlet is recorded in a map so that it will be wired
        /// to the same slot number in the GraphAssembly). Then all Outlets are traversed,
        /// completing internal connections using the aforementioned maps and appending
        /// the others to the list of exposed Outlets.
        /// </summary>
        private static GraphModule FuseGroup(BuildStructuralInfo info, ISet <IModule> group)
        {
            var stages = new IGraphStageWithMaterializedValue <Shape, object> [group.Count];
            var materializedValueIds = new IModule[group.Count];
            var attributes           = new Attributes[group.Count];

            /*
             * The overall GraphAssembly arrays are constructed in three parts:
             * - 1) exposed inputs (ins)
             * - 2) connections (ins and outs)
             * - 3) exposed outputs (outs)
             */
            var insB1       = new List <Inlet>();
            var insB2       = new List <Inlet>();
            var outsB3      = new List <Outlet>();
            var inOwnersB1  = new List <int>();
            var inOwnersB2  = new List <int>();
            var outOwnersB3 = new List <int>();

            // for the shape of the GraphModule
            var inlets  = ImmutableArray.CreateBuilder <Inlet>(2);
            var outlets = ImmutableArray.CreateBuilder <Outlet>(2);

            // connection slots are allocated from the inputs side, outs find their place by this map
            var outConns = new Dictionary <OutPort, int>();

            /*
             * First traverse all Inlets and sort them into exposed and internal,
             * taking note of their partner Outlets where appropriate.
             */
            var pos        = 0;
            var enumerator = group.GetEnumerator();
            var ups        = info.Upstreams;
            var downs      = info.Downstreams;
            var outGroup   = info.OutGroups;

            while (enumerator.MoveNext())
            {
                CopiedModule     copy;
                GraphStageModule graphStageModule;
                if ((copy = enumerator.Current as CopiedModule) != null && (graphStageModule = copy.CopyOf as GraphStageModule) != null)
                {
                    stages[pos] = graphStageModule.Stage;
                    materializedValueIds[pos] = copy;
                    attributes[pos]           = copy.Attributes.And(graphStageModule.Attributes);

                    var copyInlets     = copy.Shape.Inlets.GetEnumerator();
                    var originalInlets = graphStageModule.Shape.Inlets.GetEnumerator();
                    while (copyInlets.MoveNext() && originalInlets.MoveNext())
                    {
                        var copyInlet     = copyInlets.Current;
                        var originalInlet = originalInlets.Current;
                        var isInternal    = ups.TryGetValue(copyInlet, out var outport) &&
                                            outGroup.TryGetValue(outport, out var g) &&
                                            g == group;
                        if (isInternal)
                        {
                            ups.Remove(copyInlet);

                            downs.Remove(outport);
                            outConns[outport] = insB2.Count;
                            insB2.Add(originalInlet);
                            inOwnersB2.Add(pos);
                        }
                        else
                        {
                            insB1.Add(originalInlet);
                            inOwnersB1.Add(pos);
                            inlets.Add(copyInlet);
                        }
                    }
                    pos++;
                }
                else
                {
                    throw new ArgumentException("unexpected module structure");
                }
            }

            var outsB2      = new Outlet[insB2.Count];
            var outOwnersB2 = new int[insB2.Count];

            /*
             * Then traverse all Outlets and complete connections.
             */
            pos        = 0;
            enumerator = group.GetEnumerator();
            while (enumerator.MoveNext())
            {
                CopiedModule     copy;
                GraphStageModule graphStageModule;
                if ((copy = enumerator.Current as CopiedModule) != null && (graphStageModule = copy.CopyOf as GraphStageModule) != null)
                {
                    var copyOutlets     = copy.Shape.Outlets.GetEnumerator();
                    var originalOutlets = graphStageModule.Shape.Outlets.GetEnumerator();
                    while (copyOutlets.MoveNext() && originalOutlets.MoveNext())
                    {
                        var copyOutlet     = copyOutlets.Current;
                        var originalOutlet = originalOutlets.Current;
                        if (outConns.TryGetValue(copyOutlet, out int idx))
                        {
                            outConns.Remove(copyOutlet);
                            outsB2[idx]      = originalOutlet;
                            outOwnersB2[idx] = pos;
                        }
                        else
                        {
                            outsB3.Add(originalOutlet);
                            outOwnersB3.Add(pos);
                            outlets.Add(copyOutlet);
                        }
                    }
                    pos++;
                }
                else
                {
                    throw new ArgumentException("unexpected module structure");
                }
            }

            /*
             * Now mechanically gather together the GraphAssembly arrays from their various pieces.
             */
            var shape     = new AmorphousShape(inlets.ToImmutable(), outlets.ToImmutable());
            var connStart = insB1.Count;
            var conns     = insB2.Count;
            var outStart  = connStart + conns;
            var count     = outStart + outsB3.Count;

            var ins = new Inlet[count];

            insB1.CopyTo(ins, 0);
            insB2.CopyTo(ins, insB1.Count);

            var inOwners = new int[count];

            inOwnersB1.CopyTo(inOwners, 0);
            inOwnersB2.CopyTo(inOwners, inOwnersB1.Count);
            for (int i = inOwnersB1.Count + inOwnersB2.Count; i < inOwners.Length; i++)
            {
                inOwners[i] = -1;
            }

            var outs = new Outlet[count];

            Array.Copy(outsB2, 0, outs, connStart, conns);
            outsB3.CopyTo(outs, outStart);

            var outOwners = new int[count];

            for (int i = 0; i < connStart; i++)
            {
                outOwners[i] = -1;
            }
            Array.Copy(outOwnersB2, 0, outOwners, connStart, conns);
            outOwnersB3.CopyTo(outOwners, outStart);

            var firstModule = group.First();

            if (!(firstModule is CopiedModule))
            {
                throw new ArgumentException("unexpected module structure");
            }
            var asyncAttrs      = IsAsync((CopiedModule)firstModule) ? new Attributes(Attributes.AsyncBoundary.Instance) : Attributes.None;
            var dispatcher      = GetDispatcher(firstModule);
            var dispatcherAttrs = dispatcher == null ? Attributes.None : new Attributes(dispatcher);
            var attr            = asyncAttrs.And(dispatcherAttrs);

            return(new GraphModule(new GraphAssembly(stages, attributes, ins, inOwners, outs, outOwners), shape, attr, materializedValueIds));
        }
Ejemplo n.º 46
0
        public override ILogicAndMaterializedValue <Task> CreateLogicAndMaterializedValue(Attributes inheritedAttributes)
        {
            var finishPromise = new TaskCompletionSource <NotUsed>();

            return(new LogicAndMaterializedValue <Task>(new Logic(this, finishPromise), finishPromise.Task));
        }
Ejemplo n.º 47
0
 protected override void LoadInDepth(int depth)
 {
     Attributes.ForEach(attribute => attribute.Load(depth));
     Parameters.ForEach(parameter => parameter.Load(depth));
 }
Ejemplo n.º 48
0
        public override ILogicAndMaterializedValue <ICancelable> CreateLogicAndMaterializedValue(Attributes inheritedAttributes)
        {
            var cancelled = new AtomicBoolean();
            var c         = new TickSourceCancellable(cancelled);
            var logic     = new Logic(c, this);

            return(new LogicAndMaterializedValue <ICancelable>(logic, c));
        }
Ejemplo n.º 49
0
 /// <summary>
 /// Change the attributes of this <see cref="Sink{TIn,TMat}"/> to the given ones
 /// and seal the list of attributes. This means that further calls will not be able
 /// to remove these attributes, but instead add new ones. Note that this
 /// operation has no effect on an empty Flow (because the attributes apply
 /// only to the contained processing stages).
 /// </summary>
 /// <param name="attributes">TBD</param>
 /// <returns>TBD</returns>
 public Sink <TIn, TMat> WithAttributes(Attributes attributes)
 => new Sink <TIn, TMat>(Module.WithAttributes(attributes));
Ejemplo n.º 50
0
 protected override GraphStageLogic CreateLogic(Attributes inheritedAttributes) => new Logic(this);
Ejemplo n.º 51
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="inheritedAttributes">TBD</param>
        /// <returns>TBD</returns>
        public override ILogicAndMaterializedValue <Task <TIn> > CreateLogicAndMaterializedValue(Attributes inheritedAttributes)
        {
            var logic = new Logic(this);

            return(new LogicAndMaterializedValue <Task <TIn> >(logic, logic.Task));
        }
Ejemplo n.º 52
0
 public GraphStageModule(Shape shape, Attributes attributes, IGraphStageWithMaterializedValue <Shape, object> stage)
 {
     Shape      = shape;
     Attributes = attributes;
     Stage      = stage;
 }
Ejemplo n.º 53
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="attributes">TBD</param>
 /// <returns>TBD</returns>
 protected Decider Supervision(Attributes attributes)
 => attributes.GetAttribute(new ActorAttributes.SupervisionStrategy(Deciders.StoppingDecider)).Decider;
Ejemplo n.º 54
0
 public override IModule WithAttributes(Attributes attributes) => new GraphStageModule(Shape, attributes, Stage);
Ejemplo n.º 55
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="attributes">TBD</param>
 protected SymbolicStage(Attributes attributes)
 {
     Attributes = attributes;
 }
Ejemplo n.º 56
0
        /// <summary>
        /// 读取一个节点的所有属性
        /// </summary>
        /// <param name="tag"></param>
        /// <returns></returns>
        public OpcNodeAttribute[] ReadNoteAttributes(string tag)
        {
            NodeId sourceId = new NodeId(tag);
            ReadValueIdCollection nodesToRead = new ReadValueIdCollection();

            // attempt to read all possible attributes.
            // 尝试着去读取所有可能的特性
            for (uint ii = Attributes.NodeClass; ii <= Attributes.UserExecutable; ii++)
            {
                ReadValueId nodeToRead = new ReadValueId();
                nodeToRead.NodeId      = sourceId;
                nodeToRead.AttributeId = ii;
                nodesToRead.Add(nodeToRead);
            }

            int startOfProperties = nodesToRead.Count;

            // find all of the pror of the node.
            BrowseDescription nodeToBrowse1 = new BrowseDescription();

            nodeToBrowse1.NodeId          = sourceId;
            nodeToBrowse1.BrowseDirection = BrowseDirection.Forward;
            nodeToBrowse1.ReferenceTypeId = ReferenceTypeIds.HasProperty;
            nodeToBrowse1.IncludeSubtypes = true;
            nodeToBrowse1.NodeClassMask   = 0;
            nodeToBrowse1.ResultMask      = (uint)BrowseResultMask.All;

            BrowseDescriptionCollection nodesToBrowse = new BrowseDescriptionCollection();

            nodesToBrowse.Add(nodeToBrowse1);

            // fetch property references from the server.
            ReferenceDescriptionCollection references = FormUtils.Browse(m_session, nodesToBrowse, false);

            if (references == null)
            {
                return(new OpcNodeAttribute[0]);
            }

            for (int ii = 0; ii < references.Count; ii++)
            {
                // ignore external references.
                if (references[ii].NodeId.IsAbsolute)
                {
                    continue;
                }

                ReadValueId nodeToRead = new ReadValueId();
                nodeToRead.NodeId      = (NodeId)references[ii].NodeId;
                nodeToRead.AttributeId = Attributes.Value;
                nodesToRead.Add(nodeToRead);
            }

            // read all values.
            DataValueCollection      results         = null;
            DiagnosticInfoCollection diagnosticInfos = null;

            m_session.Read(
                null,
                0,
                TimestampsToReturn.Neither,
                nodesToRead,
                out results,
                out diagnosticInfos);

            ClientBase.ValidateResponse(results, nodesToRead);
            ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead);

            // process results.


            List <OpcNodeAttribute> nodeAttribute = new List <OpcNodeAttribute>();

            for (int ii = 0; ii < results.Count; ii++)
            {
                OpcNodeAttribute item = new OpcNodeAttribute();

                // process attribute value.
                if (ii < startOfProperties)
                {
                    // ignore attributes which are invalid for the node.
                    if (results[ii].StatusCode == StatusCodes.BadAttributeIdInvalid)
                    {
                        continue;
                    }

                    // get the name of the attribute.
                    item.Name = Attributes.GetBrowseName(nodesToRead[ii].AttributeId);

                    // display any unexpected error.
                    if (StatusCode.IsBad(results[ii].StatusCode))
                    {
                        item.Type  = Utils.Format("{0}", Attributes.GetDataTypeId(nodesToRead[ii].AttributeId));
                        item.Value = Utils.Format("{0}", results[ii].StatusCode);
                    }

                    // display the value.
                    else
                    {
                        TypeInfo typeInfo = TypeInfo.Construct(results[ii].Value);

                        item.Type = typeInfo.BuiltInType.ToString();

                        if (typeInfo.ValueRank >= ValueRanks.OneOrMoreDimensions)
                        {
                            item.Type += "[]";
                        }

                        item.Value = results[ii].Value;//Utils.Format("{0}", results[ii].Value);
                    }
                }

                // process property value.
                else
                {
                    // ignore properties which are invalid for the node.
                    if (results[ii].StatusCode == StatusCodes.BadNodeIdUnknown)
                    {
                        continue;
                    }

                    // get the name of the property.
                    item.Name = Utils.Format("{0}", references[ii - startOfProperties]);

                    // display any unexpected error.
                    if (StatusCode.IsBad(results[ii].StatusCode))
                    {
                        item.Type  = String.Empty;
                        item.Value = Utils.Format("{0}", results[ii].StatusCode);
                    }

                    // display the value.
                    else
                    {
                        TypeInfo typeInfo = TypeInfo.Construct(results[ii].Value);

                        item.Type = typeInfo.BuiltInType.ToString();

                        if (typeInfo.ValueRank >= ValueRanks.OneOrMoreDimensions)
                        {
                            item.Type += "[]";
                        }

                        item.Value = results[ii].Value; //Utils.Format("{0}", results[ii].Value);
                    }
                }

                nodeAttribute.Add(item);
            }

            return(nodeAttribute.ToArray());
        }
Ejemplo n.º 57
0
        public AnchorDrawable(SvgAnchor svgAnchor, SKRect skOwnerBounds, Drawable?root, Drawable?parent, Attributes ignoreAttributes = Attributes.None)
            : base(svgAnchor, root, parent)
        {
            IgnoreAttributes = ignoreAttributes;
            IsDrawable       = true;

            if (!IsDrawable)
            {
                return;
            }

            CreateChildren(svgAnchor, skOwnerBounds, root, this, ignoreAttributes);

            IsAntialias = SvgPaintingExtensions.IsAntialias(svgAnchor);

            TransformedBounds = SKRect.Empty;

            CreateTransformedBounds();

            Transform = SvgTransformsExtensions.ToSKMatrix(svgAnchor.Transforms);

            Fill   = null;
            Stroke = null;

            // TODO: Transform _skBounds using _skMatrix.
            TransformedBounds = Transform.MapRect(TransformedBounds);

            ClipPath     = null;
            MaskDrawable = null;
            Opacity      = IgnoreAttributes.HasFlag(Attributes.Opacity) ? null : SvgPaintingExtensions.GetOpacitySKPaint(svgAnchor, _disposable);
            Filter       = null;
        }
Ejemplo n.º 58
0
 // Start is called before the first frame update
 void Start()
 {
     attributes = GetComponentInParent <Attributes>();
 }
Ejemplo n.º 59
0
 public void Visit(MaterialGeneratorContext context)
 {
     Attributes.Visit(context);
     Layers.Visit(context);
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Add the given attributes to this <see cref="Sink{TIn,TMat}"/>.
 /// Further calls to <see cref="WithAttributes"/>
 /// will not remove these attributes. Note that this
 /// operation has no effect on an empty Flow (because the attributes apply
 /// only to the contained processing stages).
 /// </summary>
 /// <param name="attributes">TBD</param>
 /// <returns>TBD</returns>
 public Sink <TIn, TMat> AddAttributes(Attributes attributes)
 => WithAttributes(Module.Attributes.And(attributes));