コード例 #1
0
ファイル: AttribTest.cs プロジェクト: 464884492/msbuildtasks
        public void ExecuteAttrib()
        {
            string attribFile = Path.Combine(TaskUtility.TestDirectory, @"attrib.txt");
            File.WriteAllText(attribFile, "This is a test file");

            Attrib task = new Attrib();
            task.BuildEngine = new MockBuild();
            task.Files = TaskUtility.StringArrayToItemArray(attribFile);
            task.ReadOnly = true;
            task.Hidden = true;
            task.System = true;
            task.Execute();

            bool isReadOnly = ((File.GetAttributes(attribFile) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);
            bool isHidden = ((File.GetAttributes(attribFile) & FileAttributes.Hidden) == FileAttributes.Hidden);
            bool isSystem = ((File.GetAttributes(attribFile) & FileAttributes.System) == FileAttributes.System);

            Assert.IsTrue(isReadOnly, "Attribute should be readonly");
            Assert.IsTrue(isHidden, "Attribute should be hidden");
            Assert.IsTrue(isSystem, "Attribute should be system");

            task = new Attrib();
            task.BuildEngine = new MockBuild();
            task.Files = TaskUtility.StringArrayToItemArray(attribFile);
            task.Hidden = false;
            task.System = false;
            task.Execute();

            isReadOnly = ((File.GetAttributes(attribFile) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);
            isHidden = ((File.GetAttributes(attribFile) & FileAttributes.Hidden) == FileAttributes.Hidden);
            isSystem = ((File.GetAttributes(attribFile) & FileAttributes.System) == FileAttributes.System);

            Assert.IsTrue(isReadOnly, "Attribute should be readonly");
            Assert.IsFalse(isHidden, "Attribute should not be hidden");
            Assert.IsFalse(isSystem, "Attribute should not be system");

            task = new Attrib();
            task.BuildEngine = new MockBuild();
            task.Files = TaskUtility.StringArrayToItemArray(attribFile);
            task.Normal = true;
            task.Execute();

            isReadOnly = ((File.GetAttributes(attribFile) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);
            Assert.IsFalse(isReadOnly, "Attribute should not be readonly");

        }
コード例 #2
0
ファイル: MAExtensionObject.cs プロジェクト: sean-m/umare
        private object GetSVAttributeValue(Attrib attribute)
        {
            object csEntryAttributeValue;

            if (!attribute.IsPresent || attribute.Values.Count <= 0)
            {
                if (attribute.DataType == AttributeType.Boolean)
                {
                    return(false);
                }
                else
                {
                    return(null);
                }
            }

            switch (attribute.DataType)
            {
            case AttributeType.Binary:
                csEntryAttributeValue = attribute.Values[0].ToBinary();
                break;

            case AttributeType.Boolean:
                csEntryAttributeValue = attribute.Values[0].ToBoolean();
                break;

            case AttributeType.Integer:
                csEntryAttributeValue = attribute.Values[0].ToInteger();
                break;

            case AttributeType.String:
                csEntryAttributeValue = attribute.Values[0].ToString();
                break;

            case AttributeType.Reference:
            case AttributeType.Undefined:
            default:
                throw new UnknownOrUnsupportedDataTypeException();
            }
            return(csEntryAttributeValue);
        }
コード例 #3
0
ファイル: MAExtensionObject.cs プロジェクト: sean-m/umare
        private void SetAttributeValues(IList <object> attributeValues, Attrib attribute)
        {
            if (attribute.Values.Count > 0)
            {
                attribute.Values.Clear();
            }

            if (!attribute.IsMultivalued && attributeValues.Count > 1)
            {
                throw new TooManyValuesException(attribute.Name);
            }

            foreach (object value in attributeValues)
            {
                if (value == null)
                {
                    continue;
                }

                switch (attribute.DataType)
                {
                case AttributeType.Binary:
                    attribute.Values.Add(TypeConverter.ConvertData <byte[]>(value));
                    break;

                case AttributeType.Integer:
                    attribute.Values.Add(TypeConverter.ConvertData <long>(value));
                    break;

                case AttributeType.String:
                    attribute.Values.Add(TypeConverter.ConvertData <string>(value));
                    break;

                case AttributeType.Boolean:
                case AttributeType.Reference:
                case AttributeType.Undefined:
                default:
                    throw new UnknownOrUnsupportedDataTypeException();
                }
            }
        }
コード例 #4
0
ファイル: MAExtensionObject.cs プロジェクト: sean-m/umare
        private IList <object> GetSourceValuesForImport(FlowRuleParameters parameters, CSEntry csentry, out AttributeType attributeType)
        {
            List <object> values = new List <object>();

            attributeType = AttributeType.Undefined;

            foreach (string attributeName in parameters.SourceAttributeNames)
            {
                if (attributeName == "DN")
                {
                    values.Add(csentry.DN.ToString());
                }
                else
                {
                    Attrib attribute = csentry[attributeName];

                    if (attributeType == AttributeType.Undefined)
                    {
                        attributeType = attribute.DataType;
                    }
                    else if (attributeType != attribute.DataType)
                    {
                        attributeType = AttributeType.String;
                    }

                    if (attribute.IsMultivalued)
                    {
                        values.AddRange(this.GetMVAttributeValue(attribute));
                    }
                    else
                    {
                        values.Add(this.GetSVAttributeValue(attribute));
                    }
                }
            }

            return(values);
        }
コード例 #5
0
ファイル: MAExtensionObject.cs プロジェクト: sean-m/umare
        private IList <object> GetSourceValuesFromMultipleConnectorsForImport(FlowRuleParameters parameters, CSEntry csentry, MVEntry mventry, out AttributeType attributeType)
        {
            List <object> values = new List <object>();

            attributeType = AttributeType.Undefined;

            IEnumerable <CSEntry> csentries = mventry.ConnectedMAs.OfType <ConnectedMA>().Where(t => t.Name == csentry.MA.Name).SelectMany(t => t.Connectors.OfType <CSEntry>());

            foreach (string attributeName in parameters.SourceAttributeNames)
            {
                foreach (CSEntry othercsentry in csentries.Where(t => t.ObjectType == csentry.ObjectType))
                {
                    Attrib attribute = othercsentry[attributeName];

                    if (attributeType == AttributeType.Undefined)
                    {
                        attributeType = attribute.DataType;
                    }
                    else if (attributeType != attribute.DataType)
                    {
                        attributeType = AttributeType.String;
                    }

                    if (attribute.IsMultivalued)
                    {
                        values.AddRange(this.GetMVAttributeValue(attribute));
                    }
                    else
                    {
                        values.Add(this.GetSVAttributeValue(attribute));
                    }
                }
            }

            return(values);
        }
コード例 #6
0
        public void AddComponent_WithComplexConfiguration_WorksFine()
        {
            Kernel.Register(
                Component.For <ClassWithComplexParameter>()
                .Configuration(
                    Child.ForName("parameters").Eq(
                        Attrib.ForName("notUsed").Eq(true),
                        Child.ForName("complexparam").Eq(
                            Child.ForName("complexparametertype").Eq(
                                Child.ForName("mandatoryvalue").Eq("value1"),
                                Child.ForName("optionalvalue").Eq("value2")
                                )
                            )
                        )
                    )
                );

            var component = Kernel.Resolve <ClassWithComplexParameter>();

            Assert.IsNotNull(component);
            Assert.IsNotNull(component.ComplexParam);
            Assert.AreEqual("value1", component.ComplexParam.MandatoryValue);
            Assert.AreEqual("value2", component.ComplexParam.OptionalValue);
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: rvrn22/NCache
        static public Attrib[] GetClassAttributes(Hashtable attrib, System.Type type)
        {
            System.Collections.Generic.List <Attrib> a = new System.Collections.Generic.List <Attrib>();
            IDictionaryEnumerator enu = attrib.GetEnumerator();

            System.Reflection.PropertyInfo pi = null;
            System.Reflection.FieldInfo    fi = null;
            string dt = null;
            string _unsupportedtypes         = "";
            bool   _nonPrimitiveAttSpecified = false;

            while (enu.MoveNext())
            {
                pi = type.GetProperty(enu.Key.ToString());
                if (pi != null)
                {
                    dt = pi.PropertyType.FullName;
                }
                if (pi == null)
                {
                    fi = type.GetField(enu.Key.ToString());
                    if (fi != null)
                    {
                        dt = fi.FieldType.FullName;
                    }
                }
                if (pi != null || fi != null)
                {
                    Attrib tempAttrib = new Attrib();

                    tempAttrib.Name = (string)enu.Key;
                    tempAttrib.ID   = (string)enu.Value;
                    tempAttrib.Type = dt;
                    System.Type currentType = System.Type.GetType(dt);
                    if (currentType != null && !currentType.IsPrimitive && currentType.FullName != "System.DateTime" && currentType.FullName != "System.String" && currentType.FullName != "System.Decimal")
                    {
                        _nonPrimitiveAttSpecified = true;
                        _unsupportedtypes        += currentType.FullName + "\n";
                    }
                    if (currentType == null)
                    {
                        _nonPrimitiveAttSpecified = true;
                        _unsupportedtypes        += "Unknown Type\n";
                    }
                    a.Add(tempAttrib);
                }
                else
                {
                    string message = "Invalid class attribute(s) specified '" + enu.Key.ToString() + "'.";
                    throw new Exception(message);
                }
                pi = null;
                fi = null;
            }
            if (_nonPrimitiveAttSpecified)
            {
                throw new Exception("NCache Queries only support primitive types. The following type(s) is/are not supported:\n" + _unsupportedtypes);
            }

            return((Attrib[])a.ToArray());
        }
コード例 #8
0
 protected Effect(Attrib affectedAttribute, int value)
 {
     AffectedAttribute = affectedAttribute;
     Value             = value;
 }
コード例 #9
0
 //Let the modifier apply it's own values... off the type... yea
 //I did that on purpose ;-)
 public void Apply(Attrib a)
 {
     a.Value = ModifierType.ApplyModifier(this, a.Value);
 }
コード例 #10
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "attrib")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DVertexAttributeNode attr = node as X3DVertexAttributeNode;
                    if (attr == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Attrib.Add(attr);
                    }
                }
            }
            else if (id == "color")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Color = node as X3DColorNode;
                    if (Color == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "fogCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FogCoord = node as IX3DFogCoordinateNode;
                    if (FogCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "normal")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Normal = node as X3DNormalNode;
                    if (Normal == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "texCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TexCoord = node as X3DTextureCoordinateNode;
                    if (TexCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "ccw")
            {
                CCW = parser.ParseBoolValue();
            }
            else if (id == "colorPerVertex")
            {
                ColorPerVertex = parser.ParseBoolValue();
            }
            else if (id == "creaseAngle")
            {
                CreaseAngle = parser.ParseDoubleValue();
            }
            else if (id == "height")
            {
                Height.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "normalPerVertex")
            {
                NormalPerVertex = parser.ParseBoolValue();
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else if (id == "xDimension")
            {
                XDimension = parser.ParseIntValue();
            }
            else if (id == "xSpacing")
            {
                XSpacing = parser.ParseDoubleValue();
            }
            else if (id == "zDimension")
            {
                ZDimension = parser.ParseIntValue();
            }
            else if (id == "zSpacing")
            {
                ZSpacing = parser.ParseDoubleValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #11
0
ファイル: ACD.cs プロジェクト: phiggins42/d3-LootMonitor
 public int GetInt(Attrib attrib)
 {
     return GetInt((uint)attrib, 0);
 }
コード例 #12
0
ファイル: Actor.cs プロジェクト: phiggins42/d3-LootMonitor
 public int GetInt(Attrib attrib)
 {
     if (acd == null)
         return -1;
     return acd.GetInt(attrib);
 }
コード例 #13
0
        /// <inheritdoc />
        public ErrorCode GetAttrib(Attrib attrib, ref byte[] buffer)
        {
            var ret = _cardChannel.GetAttrib(attrib, ref buffer);

            return(ret);
        }
コード例 #14
0
ファイル: VertexBuffer.cs プロジェクト: vetuomia/rocket
        /// <summary>
        /// Initializes a new instance of the <see cref="VertexBuffer" /> class.
        /// </summary>
        /// <param name="attributes">The vertex attributes.</param>
        /// <param name="caching">The data caching policy.</param>
        public VertexBuffer(Attrib attributes, Caching caching = Caching.Static)
        {
            this.attributes = attributes;
            this.caching = caching;
            this.stride = 12;

            if (this.Has(Attrib.Normal))
            {
                this.stride += 12;
            }

            if (this.Has(Attrib.Tangent))
            {
                this.stride += 16;
            }

            if (this.Has(Attrib.Color))
            {
                this.stride += 4;
            }

            if (this.Has(Attrib.UV))
            {
                this.stride += 8;
            }
        }
コード例 #15
0
 /// <inheritdoc/>
 public ErrorCode GetAttrib(Attrib attrib, ref byte[] buffer)
 {
     return(cardChannel.GetAttrib(attrib, ref buffer));
 }
コード例 #16
0
ファイル: ACDActor.cs プロジェクト: jujum4n/D3CRYPTGOLDFARM
 public float GetFloat(Attrib attribute)
 {
     return reader.ReadFloat(GetAttribute((uint)attribute));
 }
コード例 #17
0
ファイル: VertexBuffer.cs プロジェクト: vetuomia/rocket
 private bool Has(Attrib attribute)
 {
     return (this.attributes & attribute) == attribute;
 }
コード例 #18
0
        public static Settings Parse(Settings settings, XElement rootElement)
        {
            if (rootElement == null)
            {
                return(settings);
            }

            ParseAttributes(rootElement, Attrib.OptionalBool(nameof(AutoInit), x => settings.AutoInit = x),
                            Attrib.OptionalBool(nameof(GenerateRegistrations), x => settings.GenerateRegistrations = x),
                            Attrib.OptionalEnum <DebugLogLevel>(nameof(DebugLogLevel), x => settings.DebugLogLevel = x),
                            Attrib.OptionalBool(nameof(DebugExceptions), x => settings.DebugExceptions             = x),
                            Attrib.Create(nameof(Behavior), x => settings.Behavior = x, (string x, out Behaviors behavior) =>
            {
                behavior = Behaviors.None;

                if (string.IsNullOrWhiteSpace(x))
                {
                    return(false);
                }

                foreach (string value in x.Split(','))
                {
                    if (Enum.TryParse(value, out Behaviors @enum))
                    {
                        behavior |= @enum;
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }, false),
                            Attrib.OptionalEnum <CodeLanguage>(nameof(DebugCodeGeneration), x => settings.DebugCodeGeneration = x));

            foreach (XElement element in rootElement.DescendantNodes().OfType <XElement>())
            {
                if (element.Name.LocalName.Equals("Assembly", StringComparison.OrdinalIgnoreCase))
                {
                    string assemblyName = "";
                    ParseAttributes(element, Attrib.RequiredString("Name", x => assemblyName = x));
                    settings.Assemblies.Add(new MatchAssembly(assemblyName));
                }
                else if (element.Name.LocalName.Equals("Type", StringComparison.OrdinalIgnoreCase))
                {
                    string   typePattern = "";
                    Lifetime lifetime    = DefaultLifetime;
                    ParseAttributes(element, Attrib.RequiredString("Name", x => typePattern  = x),
                                    Attrib.RequiredEnum <Lifetime>("Lifetime", x => lifetime = x));
                    settings.Types.Add(new MatchType(typePattern, lifetime));
                }
                else if (element.Name.LocalName.Equals("Map", StringComparison.OrdinalIgnoreCase))
                {
                    string   from     = ""; //GetRequiredString(element, "From");
                    string   to       = ""; //GetRequiredString(element, "To");
                    bool     force    = false;
                    Lifetime?lifetime = null;
                    ParseAttributes(element, Attrib.RequiredString("From", x => from = x),
                                    Attrib.RequiredString("To", x => to     = x),
                                    Attrib.OptionalBool("Force", x => force = x),
                                    Attrib.OptionalEnum <Lifetime>("Lifetime", x => lifetime = x));

                    settings.Maps.Add(new Map(from, to, force, lifetime));
                }
                else
                {
                    throw new SettingsParseException($"'{element.Name.LocalName}' is not a valid child node of AutoDI");
                }
            }

            return(settings);

            void ParseAttributes(XElement element, params IAttribute[] attributes)
コード例 #19
0
ファイル: ExportMappingAction.cs プロジェクト: sean-m/umare
        private void SetDestinationAttributeValueForExport(CSEntry csentry, IEnumerable <object> values)
        {
            Attrib attribute = csentry[this.TargetAttribute];

            this.SetDestinationAttributeValue(attribute, values);
        }
コード例 #20
0
ファイル: ACD.cs プロジェクト: phiggins42/d3-LootMonitor
 public float GetFloat(Attrib attrib)
 {
     return GetFloat((uint)attrib, 0);
 }
コード例 #21
0
 /// <inheritdoc />
 public ErrorCode GetAttrib(Attrib attrib, ref byte[] buffer)
 {
     return(RequestLayer(null, SearchMode.Top).GetAttrib(attrib, ref buffer));
 }
コード例 #22
0
 public ModifyEffect(Attrib affectedAttribute, int value) : base(affectedAttribute, value)
 {
 }
コード例 #23
0
ファイル: ACD.cs プロジェクト: phiggins42/d3-LootMonitor
 public int GetInt(Attrib attrib)
 {
     return(GetInt((uint)attrib, 0));
 }
コード例 #24
0
 public GreaterThanAttribPrecondition(Attrib attribute, Attrib comparedAttrib) : base(attribute, comparedAttrib)
 {
 }
コード例 #25
0
ファイル: ACD.cs プロジェクト: phiggins42/d3-LootMonitor
 public float GetFloat(Attrib attrib)
 {
     return(GetFloat((uint)attrib, 0));
 }
コード例 #26
0
 //And a way to add attribs and set base values..
 //once again, you will want more but this will get you started
 public void AddAttribute(Attrib x)
 {
     _rawAttributes.Add(x.Name, x);
 }
コード例 #27
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "attrib")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DVertexAttributeNode attr = node as X3DVertexAttributeNode;
                    if (attr == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Attrib.Add(attr);
                    }
                }
            }
            else if (id == "color")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Color = node as X3DColorNode;
                    if (Color == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "coord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Coord = node as X3DCoordinateNode;
                    if (Coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "fogCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FogCoord = node as IX3DFogCoordinateNode;
                    if (FogCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #28
0
 public PreconditionCompareValue(Attrib attribute, int value) : base(attribute)
 {
     Value = value;
 }
コード例 #29
0
 protected override void InternalWrite()
 {
     foreach (EntityObject entity in Document.Entities)
     {
         if (entity is AcadProxyEntity)
         {
             AcadProxyEntity e = entity as AcadProxyEntity;
             TextWriter.Write(Utilities.AcadProxyEntityToDxfFormat(e));
             continue;
         }
         if (entity is Arc)
         {
             Arc e = entity as Arc;
             TextWriter.Write(Utilities.ArcToDxfFormat(e));
             continue;
         }
         if (entity is Attrib)
         {
             Attrib e = entity as Attrib;
             TextWriter.Write(Utilities.AttribToDxfFormat(e));
             continue;
         }
         if (entity is AttributeDefinition)
         {
             AttributeDefinition e = entity as AttributeDefinition;
             TextWriter.Write(Utilities.AttributeDefinitionToDxfFormat(e));
             continue;
         }
         if (entity is Body)
         {
             Body e = entity as Body;
             TextWriter.Write(Utilities.BodyToDxfFormat(e));
             continue;
         }
         if (entity is Circle)
         {
             Circle e = entity as Circle;
             TextWriter.Write(Utilities.CircleToDxfFormat(e));
             continue;
         }
         if (entity is Dimension)
         {
             Dimension e = entity as Dimension;
             TextWriter.Write(Utilities.DimensionToDxfFormat(e));
             continue;
         }
         if (entity is Ellipse)
         {
             Ellipse e = entity as Ellipse;
             TextWriter.Write(Utilities.EllipseToDxfFormat(e));
             continue;
         }
         if (entity is EndSection)
         {
             EndSection e = entity as EndSection;
             TextWriter.Write(Utilities.EndSectionToDxfFormat(e));
             continue;
         }
         if (entity is Face3d)
         {
             Face3d e = entity as Face3d;
             TextWriter.Write(Utilities.Face3dToDxfFormat(e));
             continue;
         }
         if (entity is Hatch)
         {
             Hatch e = entity as Hatch;
             TextWriter.Write(Utilities.HatchToDxfFormat(e));
             continue;
         }
         if (entity is Helix)
         {
             Helix e = entity as Helix;
             TextWriter.Write(Utilities.HelixToDxfFormat(e));
             continue;
         }
         if (entity is Image)
         {
             Image e = entity as Image;
             TextWriter.Write(Utilities.ImageToDxfFormat(e));
             continue;
         }
         if (entity is Insert)
         {
             Insert e = entity as Insert;
             TextWriter.Write(Utilities.InsertToDxfFormat(e));
             continue;
         }
         if (entity is Leader)
         {
             Leader e = entity as Leader;
             TextWriter.Write(Utilities.LeaderToDxfFormat(e));
             continue;
         }
         if (entity is Light)
         {
             Light e = entity as Light;
             TextWriter.Write(Utilities.LightToDxfFormat(e));
             continue;
         }
         if (entity is Line)
         {
             Line e = entity as Line;
             TextWriter.Write(Utilities.LineToDxfFormat(e));
             continue;
         }
         if (entity is LwPolyline)
         {
             LwPolyline e = entity as LwPolyline;
             TextWriter.Write(Utilities.LwPolylineToDxfFormat(e));
             continue;
         }
         if (entity is Mesh)
         {
             Mesh e = entity as Mesh;
             TextWriter.Write(Utilities.MeshToDxfFormat(e));
             continue;
         }
         if (entity is MultiLeader)
         {
             MultiLeader e = entity as MultiLeader;
             TextWriter.Write(Utilities.MultiLeaderToDxfFormat(e));
             continue;
         }
         if (entity is MultiLeaderStyle)
         {
             MultiLeaderStyle e = entity as MultiLeaderStyle;
             TextWriter.Write(Utilities.MultiLeaderStyleToDxfFormat(e));
             continue;
         }
         if (entity is MultiLine)
         {
             MultiLine e = entity as MultiLine;
             TextWriter.Write(Utilities.MultiLineToDxfFormat(e));
             continue;
         }
         if (entity is MultiText)
         {
             MultiText e = entity as MultiText;
             TextWriter.Write(Utilities.MultiTextToDxfFormat(e));
             continue;
         }
         if (entity is Ole2Frame)
         {
             Ole2Frame e = entity as Ole2Frame;
             TextWriter.Write(Utilities.Ole2FrameToDxfFormat(e));
             continue;
         }
         if (entity is OleFrame)
         {
             OleFrame e = entity as OleFrame;
             TextWriter.Write(Utilities.OleFrameToDxfFormat(e));
             continue;
         }
         if (entity is Point)
         {
             Point e = entity as Point;
             TextWriter.Write(Utilities.PointToDxfFormat(e));
             continue;
         }
         if (entity is PolyLine)
         {
             PolyLine e = entity as PolyLine;
             TextWriter.Write(Utilities.PolyLineToDxfFormat(e));
             continue;
         }
         if (entity is Ray)
         {
             Ray e = entity as Ray;
             TextWriter.Write(Utilities.RayToDxfFormat(e));
             continue;
         }
         if (entity is Region)
         {
             Region e = entity as Region;
             TextWriter.Write(Utilities.RegionToDxfFormat(e));
             continue;
         }
         if (entity is Section)
         {
             Section e = entity as Section;
             TextWriter.Write(Utilities.SectionToDxfFormat(e));
             continue;
         }
         if (entity is Shape)
         {
             Shape e = entity as Shape;
             TextWriter.Write(Utilities.ShapeToDxfFormat(e));
             continue;
         }
         if (entity is Solid)
         {
             Solid e = entity as Solid;
             TextWriter.Write(Utilities.SolidToDxfFormat(e));
             continue;
         }
         if (entity is Solid3d)
         {
             Solid3d e = entity as Solid3d;
             TextWriter.Write(Utilities.Solid3dToDxfFormat(e));
             continue;
         }
         if (entity is Spline)
         {
             Spline e = entity as Spline;
             TextWriter.Write(Utilities.SplineToDxfFormat(e));
             continue;
         }
         if (entity is Sun)
         {
             Sun e = entity as Sun;
             TextWriter.Write(Utilities.SunToDxfFormat(e));
             continue;
         }
         if (entity is Surface)
         {
             Surface e = entity as Surface;
             TextWriter.Write(Utilities.SurfaceToDxfFormat(e));
             continue;
         }
         if (entity is Table)
         {
             Table e = entity as Table;
             TextWriter.Write(Utilities.TableToDxfFormat(e));
             continue;
         }
         if (entity is Text)
         {
             Text e = entity as Text;
             TextWriter.Write(Utilities.TextToDxfFormat(e));
             continue;
         }
         if (entity is Tolerance)
         {
             Tolerance e = entity as Tolerance;
             TextWriter.Write(Utilities.ToleranceToDxfFormat(e));
             continue;
         }
         if (entity is Trace)
         {
             Trace e = entity as Trace;
             TextWriter.Write(Utilities.TraceToDxfFormat(e));
             continue;
         }
         if (entity is Underlay)
         {
             Underlay e = entity as Underlay;
             TextWriter.Write(Utilities.UnderlayToDxfFormat(e));
             continue;
         }
         if (entity is Vertex)
         {
             Vertex e = entity as Vertex;
             TextWriter.Write(Utilities.VertexToDxfFormat(e));
             continue;
         }
         if (entity is ViewPort)
         {
             ViewPort e = entity as ViewPort;
             TextWriter.Write(Utilities.ViewPortToDxfFormat(e));
             continue;
         }
         if (entity is WipeOut)
         {
             WipeOut e = entity as WipeOut;
             TextWriter.Write(Utilities.WipeOutToDxfFormat(e));
             continue;
         }
         if (entity is XLine)
         {
             XLine e = entity as XLine;
             TextWriter.Write(Utilities.XLineToDxfFormat(e));
             continue;
         }
     }
 }
コード例 #30
0
 public PreconditionAttribConstraint(Attrib attribute)
 {
     Attribute = attribute;
 }
コード例 #31
0
        public ErrorCode GetAttrib(Attrib attrib, ref byte[] buffer)
        {
            var ret = stack.RequestLayer(this, SearchMode.Next).GetAttrib(attrib, ref buffer);

            return(ret);
        }
コード例 #32
0
 public void Add(Attrib attrib, AttribType attribType, byte num, bool normalized, bool asInt)
 {
     vertex_layout_add((Bgfx.Bgfx.VertexLayout *)Unsafe.AsPointer(ref InternalHandle), attrib, num, attribType, normalized, asInt);
 }
コード例 #33
0
        internal void Click5LabelModel(
            Gaussian inputScoreMean,
            Gamma inputScorePrec,
            Gamma inputJudgePrec,
            Gamma inputClickPrec,
            Gaussian[] inputThresh,
            Gaussian[][] clickObservations)
        {
            // Add variables outside plate - all variables outside the plate should
            // be marked as outputs because we will be communicating their messages
            // across chunks
            double scoreMean = Factor.Random(inputScoreMean);
            double scorePrec = Factor.Random(inputScorePrec);
            double judgePrec = Factor.Random(inputJudgePrec);
            double clickPrec = Factor.Random(inputClickPrec);
            double thresh0   = Factor.Random(inputThresh[0]);
            double thresh1   = Factor.Random(inputThresh[1]);
            double thresh2   = Factor.Random(inputThresh[2]);
            double thresh3   = Factor.Random(inputThresh[3]);
            double thresh4   = Factor.Random(inputThresh[4]);
            double thresh5   = Factor.Random(inputThresh[5]);
            //Attrib.AllVars(new DivideMessages(false), thresh0, thresh1, thresh2, thresh3, thresh4, thresh5);
            //Attrib.AllVars(new DivideMessages(false), scoreMean, scorePrec, judgePrec, clickPrec);

            // Plate 1
            int n1 = clickObservations[0].Length;

            double[] scores1  = new double[n1];
            double[] scoresJ1 = new double[n1];
            double[] scoresC1 = new double[n1];
            for (int i1 = 0; i1 < n1; i1++)
            {
                Attrib.Var(i1, new Sequential());
                scores1[i1] = Factor.Gaussian(scoreMean, scorePrec);

                // click-based score
                scoresC1[i1] = Factor.Gaussian(scores1[i1], clickPrec);
                Constrain.EqualRandom(scoresC1[i1], clickObservations[0][i1]);

                // judged score
                scoresJ1[i1] = Factor.Gaussian(scores1[i1], judgePrec);
                bool h1 = Factor.IsBetween(scoresJ1[i1], thresh0, thresh1);
                Constrain.Equal(true, h1);
            }

            // Plate 2
            int n2 = clickObservations[1].Length;

            double[] scores2  = new double[n2];
            double[] scoresJ2 = new double[n2];
            double[] scoresC2 = new double[n2];
            for (int i2 = 0; i2 < n2; i2++)
            {
                Attrib.Var(i2, new Sequential());
                scores2[i2] = Factor.Gaussian(scoreMean, scorePrec);

                // click-based score
                scoresC2[i2] = Factor.Gaussian(scores2[i2], clickPrec);
                Constrain.EqualRandom(scoresC2[i2], clickObservations[1][i2]);

                // judged score
                scoresJ2[i2] = Factor.Gaussian(scores2[i2], judgePrec);
                bool h2 = Factor.IsBetween(scoresJ2[i2], thresh1, thresh2);
                Constrain.Equal(true, h2);
            }

            // Plate 3
            int n3 = clickObservations[2].Length;

            double[] scores3  = new double[n3];
            double[] scoresJ3 = new double[n3];
            double[] scoresC3 = new double[n3];
            for (int i3 = 0; i3 < n3; i3++)
            {
                Attrib.Var(i3, new Sequential());
                scores3[i3] = Factor.Gaussian(scoreMean, scorePrec);

                // click-based score
                scoresC3[i3] = Factor.Gaussian(scores3[i3], clickPrec);
                Constrain.EqualRandom(scoresC3[i3], clickObservations[2][i3]);

                // judged score
                scoresJ3[i3] = Factor.Gaussian(scores3[i3], judgePrec);
                bool h3 = Factor.IsBetween(scoresJ3[i3], thresh2, thresh3);
                Constrain.Equal(true, h3);
            }

            // Plate 4
            int n4 = clickObservations[3].Length;

            double[] scores4  = new double[n4];
            double[] scoresJ4 = new double[n4];
            double[] scoresC4 = new double[n4];
            for (int i4 = 0; i4 < n4; i4++)
            {
                Attrib.Var(i4, new Sequential());
                scores4[i4] = Factor.Gaussian(scoreMean, scorePrec);

                // click-based score
                scoresC4[i4] = Factor.Gaussian(scores4[i4], clickPrec);
                Constrain.EqualRandom(scoresC4[i4], clickObservations[3][i4]);

                // judged score
                scoresJ4[i4] = Factor.Gaussian(scores4[i4], judgePrec);
                bool h4 = Factor.IsBetween(scoresJ4[i4], thresh3, thresh4);
                Constrain.Equal(true, h4);
            }

            // Plate 5
            int n5 = clickObservations[4].Length;

            double[] scores5  = new double[n5];
            double[] scoresJ5 = new double[n5];
            double[] scoresC5 = new double[n5];
            for (int i5 = 0; i5 < n5; i5++)
            {
                Attrib.Var(i5, new Sequential());
                scores5[i5] = Factor.Gaussian(scoreMean, scorePrec);

                // click-based score
                scoresC5[i5] = Factor.Gaussian(scores5[i5], clickPrec);
                Constrain.EqualRandom(scoresC5[i5], clickObservations[4][i5]);

                // judged score
                scoresJ5[i5] = Factor.Gaussian(scores5[i5], judgePrec);
                bool h5 = Factor.IsBetween(scoresJ5[i5], thresh4, thresh5);
                Constrain.Equal(true, h5);
            }

            //Attrib.AllVars(new DivideMessages(false), scores1, scores2, scores3, scores4, scores5);
            //Attrib.AllVars(new DivideMessages(false), scoresC1, scoresC2, scoresC3, scoresC4, scoresC5);
            //Attrib.AllVars(new DivideMessages(false), scoresJ1, scoresJ2, scoresJ3, scoresJ4, scoresJ5);

            InferNet.Infer(scoreMean, nameof(scoreMean));
            InferNet.Infer(scorePrec, nameof(scorePrec));
            InferNet.Infer(judgePrec, nameof(judgePrec));
            InferNet.Infer(clickPrec, nameof(clickPrec));
            InferNet.Infer(thresh0, nameof(thresh0));
            InferNet.Infer(thresh1, nameof(thresh1));
            InferNet.Infer(thresh2, nameof(thresh2));
            InferNet.Infer(thresh3, nameof(thresh3));
            InferNet.Infer(thresh4, nameof(thresh4));
            InferNet.Infer(thresh5, nameof(thresh5));
        }
コード例 #34
0
ファイル: ACDActor.cs プロジェクト: jujum4n/D3CRYPTGOLDFARM
 public int GetInt(Attrib attribute)
 {
     return reader.ReadInt(GetAttribute((uint)attribute));
 }
コード例 #35
0
 public LessThanAttribPrecondition(Attrib attribute, Attrib comparedAttrib) : base(attribute, comparedAttrib)
 {
 }
コード例 #36
0
 public PreconditionCompareAttrib(Attrib attribute, Attrib comparedAttribute) : base(attribute)
 {
     ComparedAttribute = comparedAttribute;
 }
コード例 #37
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "attrib")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DVertexAttributeNode attr = node as X3DVertexAttributeNode;
                    if (attr == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Attrib.Add(attr);
                    }
                }
            }
            else if (id == "color")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Color = node as X3DColorNode;
                    if (Color == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "coord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Coord = node as X3DCoordinateNode;
                    if (Coord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "fogCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    FogCoord = node as IX3DFogCoordinateNode;
                    if (FogCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "normal")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    Normal = node as X3DNormalNode;
                    if (Normal == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "texCoord")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    TexCoord = node as X3DTextureCoordinateNode;
                    if (TexCoord == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "ccw")
            {
                CCW = parser.ParseBoolValue();
            }
            else if (id == "colorPerVertex")
            {
                ColorPerVertex = parser.ParseBoolValue();
            }
            else if (id == "normalPerVertex")
            {
                NormalPerVertex = parser.ParseBoolValue();
            }
            else if (id == "solid")
            {
                Solid = parser.ParseBoolValue();
            }
            else if (id == "index")
            {
                Index = parser.ParseSFInt32OrMFInt32Value();
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #38
0
ファイル: SetEffect.cs プロジェクト: Maroslav/PressToPlay
 public SetEffect(Attrib affectedAttribute, int value) : base(affectedAttribute, value)
 {
 }
コード例 #39
0
ファイル: Actor.cs プロジェクト: phiggins42/d3-LootMonitor
 public float GetFloat(Attrib attrib)
 {
     if (acd == null)
         return -1;
     return acd.GetFloat(attrib);
 }