当前位置: 首页>>代码示例>>C#>>正文


C# System.Attribute方法代码示例

本文整理汇总了C#中System.Attribute方法的典型用法代码示例。如果您正苦于以下问题:C# System.Attribute方法的具体用法?C# System.Attribute怎么用?C# System.Attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.Attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToPhysical

        public System.Xml.Linq.XElement ToPhysical(System.Xml.Linq.XElement udsService)
        {
            string name = udsService.Attribute("Name").Value;
            XElement x = new XElement("Service", new XAttribute("Name", name));
            XElement prop = new XElement("Property", new XAttribute("Name", "Definition"));
            x.Add(prop);

            XElement serv = new XElement("Service");
            prop.Add(serv);

            XElement sd = new XElement("ServiceDescription");
            serv.Add(sd);

            XElement handler = new XElement("Handler", new XAttribute("ExecType", "RemoteComponent"));
            sd.Add(handler);
            
            XElement udsDefinition = udsService.Element("Definition");
            foreach (XElement e in udsDefinition.Elements())
                sd.Add(e);

            XElement usage = new XElement("Usage");
            sd.Add(usage);

            XElement sh = new XElement("ServiceHelp");
            sh.Add(new XElement("Description"));
            sh.Add(new XElement("RequestSDDL"));
            sh.Add(new XElement("ResponseSDDL"));
            sh.Add(new XElement("Errors"));
            sh.Add(new XElement("RelatedDocumentServices"));
            sh.Add(new XElement("Samples"));
            serv.Add(sh);
            return x;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:33,代码来源:RemoteComponentConverter.cs

示例2: WriteFixedWidth

 public void WriteFixedWidth(System.Xml.Linq.XElement CommandNode, DataTable Table, Stream outputStream)
 {
     StreamWriter Output = new StreamWriter(outputStream);
     int StartAt = CommandNode.Attribute("StartAt") != null ? int.Parse(CommandNode.Attribute("StartAt").Value) : 0;
     var positions = from c in CommandNode.Descendants("Position")
                     orderby int.Parse(c.Attribute("Start").Value) ascending
                     select new
                     {
                         Name = c.Attribute("Name").Value,
                         Start = int.Parse(c.Attribute("Start").Value) - StartAt,
                         Length = int.Parse(c.Attribute("Length").Value),
                         Justification = c.Attribute("Justification") != null ? c.Attribute("Justification").Value.ToLower() : "left"
                     };
     int lineLength = positions.Last().Start + positions.Last().Length;
     foreach (DataRow row in Table.Rows)
     {
         StringBuilder line = new StringBuilder(lineLength);
         foreach (var p in positions)
             line.Insert(p.Start,
               p.Justification == "left" ? (row.Field<string>(p.Name) ?? "").PadRight(p.Length, ' ')
                            : (row.Field<string>(p.Name) ?? "").PadLeft(p.Length, ' ')
               );
         Output.WriteLine(line.ToString());
     }
     Output.Flush();
 }
开发者ID:kiranmath,项目名称:PcanRepository,代码行数:26,代码来源:testBench.cs

示例3: FromXml

 public static ColorInfo FromXml(System.Xml.Linq.XElement el)
 {
     var c = new ColorInfo();
     c.Category = el.Attribute("Category").Value;
     c.Name= el.Attribute("Name").Value;
     c.rgb = int.Parse(el.Attribute("RGB").Value.Substring(1),System.Globalization.NumberStyles.HexNumber);
     return c;
 }
开发者ID:saveenr,项目名称:saveenr,代码行数:8,代码来源:Program.cs

示例4: GetFileAsync

 public override async Task<DriveFile> GetFileAsync(System.Xml.Linq.XElement xml, CancellationToken token)
 {
     var file = new MockDriveFile(this,
         xml.Attribute("name").Value,
         bool.Parse(xml.Attribute("isFolder").Value),
         bool.Parse(xml.Attribute("isImage").Value),
         bool.Parse(xml.Attribute("isRoot").Value));
     return file;
 }
开发者ID:fiftin,项目名称:oblqo,代码行数:9,代码来源:MockDrive.cs

示例5: AddTypeElement

 public bool AddTypeElement(System.Xml.Linq.XElement elemtype)
 {
     XAttribute colorRedAtt = elemtype.Attribute("red");
     if (colorRedAtt == null)
     {
         //Add error message here
         color = default(Color);
         return false;
     }
     XAttribute colorGreenAtt = elemtype.Attribute("green");
     if (colorGreenAtt == null)
     {
         //Add error message here
         color = default(Color);
         return false;
     }
     XAttribute colorBlueAtt = elemtype.Attribute("blue");
     if (colorBlueAtt == null)
     {
         //Add error message here
         color = default(Color);
         return false;
     }
     int alpha = 255;
     XAttribute colorAlphaAtt = elemtype.Attribute("metal");
     if (colorAlphaAtt != null)
     {
         switch (colorAlphaAtt.Value)
         {
             case "yes":
                 alpha = 0;
                 break;
             case "no":
                 alpha = 255;
                 break;
             default:
                 if (!int.TryParse(colorAlphaAtt.Value, out alpha))
                     alpha = 255;
                 break;
         }
     }
     int red, green, blue;
     int.TryParse(colorRedAtt.Value, out red);
     int.TryParse(colorGreenAtt.Value, out green);
     int.TryParse(colorBlueAtt.Value, out blue);
     color = new Color(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f);
     // LINEAR
     //if (PlayerSettings.colorSpace == ColorSpace.Linear)
     {
         color = color.linear;
     }
     UniqueIndex = num_created;
     num_created++;
     return true;
 }
开发者ID:JapaMala,项目名称:armok-vision,代码行数:55,代码来源:ColorContent.cs

示例6: Location

        public Location(System.Xml.Linq.XElement data)
        {
            this.RealName = data.Attribute("RealName").Value;
            this.Latitude = data.Attribute("Latitude").Value;
            this.Longtitude = data.Attribute("Longtitude").Value;
            this.LocationType = (TransportType)Enum.Parse(typeof(TransportType), data.Attribute("LocationType").Value);

            foreach (var x in data.Elements("Alias"))
            {
                this.aliases.Add(x.Value);
            }
        }
开发者ID:andrew-js-wright,项目名称:nirail,代码行数:12,代码来源:Location.cs

示例7: FromXmlElement

        public static PidProfile FromXmlElement(System.Xml.Linq.XElement pidProfileElement)
        {
            var profile = new PidProfile()
            {
                DirectionProfile = (DirectionProfile)Enum.Parse(typeof(DirectionProfile), pidProfileElement.Attribute("Direction").Value),
                ProportionalGain = pidProfileElement.Attribute("ProportionalGain").ParseDouble(),
                IntegralGain = pidProfileElement.Attribute("IntegralGain").ParseDouble(),
                DerivativeGain = pidProfileElement.Attribute("DerivativeGain").ParseDouble(),
            };

            return profile;
        }
开发者ID:aftabn,项目名称:HelicopterController,代码行数:12,代码来源:PidProfile.cs

示例8: draw

 public override void draw(System.Xml.Linq.XElement e, System.Windows.Controls.Canvas c)
 {
     if (e.Attribute("color") != null)
     {
         String col = e.Attribute("color").Value;
         Console.WriteLine("BGCOL : " + col);
         Rectangle rect = new Rectangle();
         rect.Height = cHeight;//HARD CODED BUG
         rect.Width = cWidth;
         rect.Fill = new SolidColorBrush(ColorParser.parse(col));
         addToCanvas(e, rect, c);
     }
 }
开发者ID:muzefm,项目名称:ebucms,代码行数:13,代码来源:BackgroundRender.cs

示例9: ParseDefinition

        public override bool ParseDefinition(System.Xml.Linq.XElement element)
        {
            bool result = this.parse(element);
            Tag = element.Attribute("Tag").Value;

            return result;
        }
开发者ID:rrajaguk,项目名称:QOEParser,代码行数:7,代码来源:TLValue.cs

示例10: AddTypeElement

    public bool AddTypeElement(System.Xml.Linq.XElement elemtype)
    {
        if (store == null) //nowhere to put the image.
        {
            Debug.LogError("Texture Storage is Null: " + elemtype);
            return false;
        }

        XAttribute fileAtt = elemtype.Attribute("file");
        if (fileAtt == null)
        {
            Debug.LogError("No file attribute in " + elemtype);
            //Add error message here
            return false;
        }
        string filePath = Path.Combine(Path.GetDirectoryName(new Uri(elemtype.BaseUri).LocalPath), fileAtt.Value);
        filePath = Path.GetFullPath(filePath);

        if (!File.Exists(filePath))
        {
            Debug.LogError("File not found: " + filePath);
            return false;
        }

        byte[] fileData = File.ReadAllBytes(filePath);

        Texture2D tex = new Texture2D(2,2);
        tex.LoadImage(fileData);

        tex.name = filePath;

        storageIndex = store.AddTexture(tex);
        return true;
    }
开发者ID:christopherbauer,项目名称:armok-vision,代码行数:34,代码来源:TextureContent.cs

示例11: AddTypeElement

    public bool AddTypeElement(System.Xml.Linq.XElement elemtype)
    {
        XAttribute fileAtt = elemtype.Attribute("file");
        if (fileAtt == null)
        {
            //Add error message here
            return false;
        }
        string filePath = Path.Combine(Path.GetDirectoryName(new Uri(elemtype.BaseUri).LocalPath), fileAtt.Value);
        filePath = Path.GetFullPath(filePath);

        //	Load the OBJ in
        var lStream = new FileStream(filePath, FileMode.Open);
        var lOBJData = OBJLoader.LoadOBJ(lStream);
        lStream.Close();
        meshData = new MeshData[(int)MeshLayer.Count];
        Mesh tempMesh = new Mesh();
        for (int i = 0; i < meshData.Length; i++)
        {
            tempMesh.LoadOBJ(lOBJData, ((MeshLayer)i).ToString());
            meshData[i] = new MeshData(tempMesh);
            tempMesh.Clear();
        }
        lStream = null;
        lOBJData = null;
        return true;
    }
开发者ID:christopherbauer,项目名称:armok-vision,代码行数:27,代码来源:MeshContent.cs

示例12: FromXmlElement

        public static TiltControllerSettings FromXmlElement(System.Xml.Linq.XElement angleControllerElement)
        {
            var cwProfileElement = angleControllerElement.Elements("PidProfile").Single(x => x.Attribute("Direction").Value == DirectionProfile.CW.ToString());

            var settings = new TiltControllerSettings()
            {
                IsEnabled = angleControllerElement.Attribute("IsEnabled").ParseOptionalBoolean(),
                MotorDriver = (MotorDriver)Enum.Parse(typeof(MotorDriver), angleControllerElement.Attribute("MotorDriver").Value),
                IntegralWindupThreshold = angleControllerElement.Attribute("IntegralWindupThreshold").ParseDouble(),
                OutputRateLimit = angleControllerElement.Attribute("OutputRateLimit").ParseInt(),
                PidProfiles = new Dictionary<DirectionProfile, PidProfile>
                {
                    {DirectionProfile.CW, PidProfile.FromXmlElement(cwProfileElement) }
                },
            };

            return settings;
        }
开发者ID:aftabn,项目名称:HelicopterController,代码行数:18,代码来源:TiltControllerSettings.cs

示例13: AddTypeElement

 public bool AddTypeElement(System.Xml.Linq.XElement elemtype)
 {
     XAttribute indexAtt = elemtype.Attribute("index");
     if (indexAtt == null)
     {
         //Add error message here
         value = default(int);
         return false;
     }
     return int.TryParse(indexAtt.Value, out value);
 }
开发者ID:Chronovore,项目名称:armok-vision,代码行数:11,代码来源:IndexContent.cs

示例14: ListItem

 //<tcm:Item ID="tcm:17-384-64" Title="Some Page Title" Type="64" OrgItemID="tcm:17-107-4" Path="\040 Web Publication\Root\030 - Work" Icon="T64L1P0" Publication="040 Web Publication"></tcm:Item>
 public ListItem(System.Xml.Linq.XElement node)
 {
     TcmId = node.Attribute("ID").SafeStringVal();
     Title = node.Attribute("Title").SafeStringVal();
     ItemTypeId = node.Attribute("Type").SafeStringVal();
     WebDavPath = node.Attribute("Path").SafeStringVal();
     Icon = node.Attribute("Icon").SafeStringVal();
     ParentTcmId = node.Attribute("OrgItemID").SafeStringVal();
     PublicationTitle = node.Attribute("Publication").SafeStringVal();
     ItemTypeName = EnumHelper<Tridion.ContentManager.CoreService.Client.ItemType>.Parse(ItemTypeId, true);
 }
开发者ID:Guzzter,项目名称:TridionLegacyVbScriptReporter,代码行数:12,代码来源:ListItem.cs

示例15: From_XML

 public virtual void From_XML(System.Xml.Linq.XElement xml)
 {
     Source_Startup_Policy = Libvirt.Models.Concrete.Disk.Source_Startup_Policies.mandatory;
     if (xml != null)
     {
         var attr = xml.Attribute("startupPolicy");
         if (attr != null)
         {
             var b = Libvirt.Models.Concrete.Disk.Source_Startup_Policies.mandatory;
             Enum.TryParse(attr.Value, true, out b);
             Source_Startup_Policy = b;
         }
     }
 }
开发者ID:smasherprog,项目名称:Libvirt_WebManager,代码行数:14,代码来源:IDevice_Source.cs


注:本文中的System.Attribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。