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


C# Enumeration类代码示例

本文整理汇总了C#中Enumeration的典型用法代码示例。如果您正苦于以下问题:C# Enumeration类的具体用法?C# Enumeration怎么用?C# Enumeration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: VisitEnumDecl

        public override bool VisitEnumDecl(Enumeration @enum)
        {
            if (!VisitDeclaration(@enum))
                return false;

            if ([email protected])
                goto Out;

            if (@enum.CompleteDeclaration != null)
                goto Out;

            @enum.CompleteDeclaration =
                AstContext.FindCompleteEnum(@enum.QualifiedName);

            if (@enum.CompleteDeclaration == null)
            {
                @enum.GenerationKind = GenerationKind.Internal;
                Driver.Diagnostics.EmitWarning(DiagnosticId.UnresolvedDeclaration,
                    "Unresolved declaration: {0}", @enum.Name);
            }

            Out:

            return base.VisitEnumDecl(@enum);
        }
开发者ID:corefan,项目名称:CppSharp,代码行数:25,代码来源:ResolveIncompleteDeclsPass.cs

示例2: StateTileElement

 public StateTileElement(Enumeration.StateTile state, Enumeration.PriorityState priority__1, Enumeration.SequenceReverse reverse__2)
 {
     _state = state;
     Priority = priority__1;
     Reverse = reverse__2;
     OffSet = Vector2.Zero;
 }
开发者ID:salvadorc17,项目名称:Prince-Monogame,代码行数:7,代码来源:StateTileElement.cs

示例3: LogMessage

        public bool LogMessage(Enumeration.LoggingPriority priority, string transactionReference, Exception exception)
        {
            try
            {
                StringBuilder s = new StringBuilder();
                s.AppendFormat("Exception: {0} |", String.IsNullOrEmpty(exception.Message) ? "NONE" : exception.Message);
                if (exception.InnerException != null)
                {
                    s.AppendFormat("Inner Exception Message: {0} |", String.IsNullOrEmpty(exception.InnerException.Message) ? "NONE" : exception.InnerException.Message);
                    s.AppendFormat("Inner Exception Source: {0} |", String.IsNullOrEmpty(exception.InnerException.Source) ? "NONE" : exception.InnerException.Source);
                }
                s.AppendFormat("Exception Source: {0} |", String.IsNullOrEmpty(exception.Source) ? "NONE" : exception.Source);
                s.AppendFormat("Exception Stack Trace: {0} ", String.IsNullOrEmpty(exception.StackTrace) ? "NONE" : exception.StackTrace);

                LoggingRequest lsmr = new LoggingRequest
                {
                    TransactionReference = transactionReference,
                    LoggingPriority = priority,
                    Message = s.ToString(),
                    TimeStamp = DateTime.Now
                };

                //Call the Repo and insert the data (LoggingServiceRequest)

                return true;
            }
            catch
            {
                // do nothing

                return false;
            }
        }
开发者ID:ELEN7045-Group1,项目名称:group-project,代码行数:33,代码来源:Logging.cs

示例4: GetActionPositionRun

        static string GetActionPositionRun(Hands[] hands, int position, int run, Enumeration.Street street)
        {
            var user = hands.Single(x => x.Position == position).User;
            string action;
            switch (street)
            {
                case Enumeration.Street.Blind:
                    action = hands.Single(x => x.Position == position).ActionBlind;
                    break;
                case Enumeration.Street.Preflop:
                    action = hands.Single(x => x.Position == position).ActionPreflop;
                    break;
                case Enumeration.Street.Flop:
                    action = hands.Single(x => x.Position == position).ActionFlop;
                    break;
                case Enumeration.Street.Turn:
                    action = hands.Single(x => x.Position == position).ActionTurn;
                    break;
                case Enumeration.Street.River:
                    action = hands.Single(x => x.Position == position).ActionRiver;
                    break;
                default:
                    throw new ArgumentException("this street does not exist", street.ToString());
            }

            if (action == string.Empty)
                return string.Empty;

            if (action.Split(',').Count() > run)
                return user + " " + action.Split(',')[run];

            return string.Empty;
        }
开发者ID:daaaasdev,项目名称:trackerparser,代码行数:33,代码来源:Program.cs

示例5: Chomper

        public Chomper(RoomNew room, ContentManager Content, Enumeration.TileType tileType, Enumeration.StateTile state, Enumeration.TileType NextTileType__1)
        {
            base.room = room;

            nextTileType = NextTileType__1;
            System.Xml.Serialization.XmlSerializer ax = new System.Xml.Serialization.XmlSerializer(tileSequence.GetType());

            Stream txtReader = Microsoft.Xna.Framework.TitleContainer.OpenStream(PrinceOfPersiaGame.CONFIG_PATH_CONTENT + PrinceOfPersiaGame.CONFIG_PATH_SEQUENCES + tileType.ToString().ToUpper() + "_sequence.xml");

            tileSequence = (List<Sequence>)ax.Deserialize(txtReader);

            foreach (Sequence s in tileSequence)
            {
                s.Initialize(Content);
            }

            //Search in the sequence the right type
            //Sequence result = tileSequence.Find((Sequence s) => s.name.ToUpper() == state.ToString().ToUpper());
            Sequence result = tileSequence.Find((Sequence s) => s.name == state.ToString().ToUpper());

            if (result != null)
            {
                result.frames[0].SetTexture(Content.Load<Texture2D>(PrinceOfPersiaGame.CONFIG_TILES[0] + result.frames[0].value));

                collision = result.collision;
                Texture = result.frames[0].texture;
            }
            Type = tileType;

            //change statetile element
            tileState.Value().state = state;
            tileAnimation.PlayAnimation(tileSequence, tileState.Value());
        }
开发者ID:salvadorc17,项目名称:Prince-Monogame,代码行数:33,代码来源:Chomper.cs

示例6: IsFlagEnum

        static bool IsFlagEnum(Enumeration @enum)
        {
            // If the enumeration only has power of two values, assume it's
            // a flags enum.

            var isFlags = true;
            var hasBigRange = false;

            foreach (var item in @enum.Items)
            {
                var value = item.Value;

                if (value >= 4)
                    hasBigRange = true;

                if (value <= 1 || value.IsPowerOfTwo())
                    continue;

                isFlags = false;
            }

            // Only apply this heuristic if there are enough values to have a
            // reasonable chance that it really is a bitfield.

            return isFlags && hasBigRange;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:26,代码来源:CheckFlagEnumsPass.cs

示例7: Template

        public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Enumeration e)
            : base(_host)
        {
			this.ctx = ctx;
			this.e = e;

        }
开发者ID:daszat,项目名称:zetbox,代码行数:7,代码来源:Template.Designer.cs

示例8: GetServices

 public static Schema.KRPC.Services GetServices()
 {
     var services = new Schema.KRPC.Services ();
     foreach (var serviceSignature in Services.Instance.Signatures.Values) {
         var service = new Schema.KRPC.Service ();
         service.Name = serviceSignature.Name;
         foreach (var procedureSignature in serviceSignature.Procedures.Values) {
             var procedure = new Procedure ();
             procedure.Name = procedureSignature.Name;
             if (procedureSignature.HasReturnType)
             {
                 procedure.HasReturnType = true;
                 procedure.ReturnType = TypeUtils.GetTypeName (procedureSignature.ReturnType);
             }
             foreach (var parameterSignature in procedureSignature.Parameters) {
                 var parameter = new Parameter ();
                 parameter.Name = parameterSignature.Name;
                 parameter.Type = TypeUtils.GetTypeName (parameterSignature.Type);
                 if (parameterSignature.HasDefaultArgument)
                 {
                     parameter.HasDefaultArgument = true;
                     parameter.DefaultArgument = parameterSignature.DefaultArgument;
                 }
                 procedure.Parameters.Add (parameter);
             }
             foreach (var attribute in procedureSignature.Attributes) {
                 procedure.Attributes.Add (attribute);
             }
             if (procedureSignature.Documentation != "")
                 procedure.Documentation = procedureSignature.Documentation;
             service.Procedures.Add (procedure);
         }
         foreach (var clsSignature in serviceSignature.Classes.Values) {
             var cls = new Class ();
             cls.Name = clsSignature.Name;
             if (clsSignature.Documentation != "")
                 cls.Documentation = clsSignature.Documentation;
             service.Classes.Add (cls);
         }
         foreach (var enmSignature in serviceSignature.Enumerations.Values) {
             var enm = new Enumeration ();
             enm.Name = enmSignature.Name;
             if (enmSignature.Documentation != "")
                 enm.Documentation = enmSignature.Documentation;
             foreach (var enmValueSignature in enmSignature.Values) {
                 var enmValue = new EnumerationValue ();
                 enmValue.Name = enmValueSignature.Name;
                 enmValue.Value = enmValueSignature.Value;
                 if (enmValueSignature.Documentation != "")
                     enmValue.Documentation = enmValueSignature.Documentation;
                 enm.Values.Add (enmValue);
             }
             service.Enumerations.Add (enm);
         }
         if (serviceSignature.Documentation != "")
             service.Documentation = serviceSignature.Documentation;
         services.Services_.Add (service);
     }
     return services;
 }
开发者ID:artwhaley,项目名称:krpc,代码行数:60,代码来源:KRPC.cs

示例9: StatePlayerElement

 public StatePlayerElement(Enumeration.State state, Enumeration.PriorityState priority__1, Vector2 offSet__2)
 {
     _state = state;
     Priority = priority__1;
     Reverse = Enumeration.SequenceReverse.Normal;
     OffSet = offSet__2;
 }
开发者ID:salvadorc17,项目名称:Prince-Monogame,代码行数:7,代码来源:StatePlayerElement.cs

示例10: MainPage

        public MainPage()
        {
            this.InitializeComponent();

            HIDEnum = new Enumeration(this.NotifyUser);

            GetUagePageInfo();

            ////JObject o1 = JObject.Parse(File.ReadAllText(".\\usagepage.json"));
            //using (StreamReader file = File.OpenText(".\\usagepage.json"))
            //using(JsonTextReader reader = new JsonTextReader(file))
            //{
            //    JObject jObject = (JObject)JToken.ReadFrom(reader);
            //    var hidUsageClasses =
            //        from p in jObject["hidUsageClasses"]
            //        select new UsagePage ((string)p["PageName"],(ushort)p["PageID"] );
            //    UsagePages = hidUsageClasses.ToList<UsagePage>();

            //    var hidDeviceClasses =
            //        from p in jObject["hidDeviceClasses"]
            //        select new HidDeviceClass((string)p["UsageName"], (ushort)p["PageID"], (ushort)p["UsageID"]);
            //    HidDeviceClasses = hidDeviceClasses.ToList<HidDeviceClass>();

            //    cbDevType.DataContext = HidDeviceClasses;
            //}
        }
开发者ID:djaus2,项目名称:WindowsDevices,代码行数:26,代码来源:MainPage.xaml.cs

示例11: DocumentEnum

 public void DocumentEnum(Enumeration @enum)
 {
     string file = GetFileForDeclarationContext(@enum.Namespace);
     if (this.documentation.ContainsKey(file))
     {
         string typeDocs = this.documentation[file];
         const string enumDoc = @"enum {0}(\s*flags {1}::\w+\s+)?(?<docsStart>.*?)(\n){{3}}";
         string enumName = string.IsNullOrEmpty(@enum.Namespace.Name) ? @enum.Name : (@enum.Namespace.Name + "::" + @enum.Name);
         Match matchEnum = Regex.Match(typeDocs, string.Format(enumDoc, enumName, @enum.Namespace.Name),
                                       RegexOptions.Singleline | RegexOptions.ExplicitCapture);
         if (matchEnum.Success)
         {
             string doc = matchEnum.Groups["docsStart"].Value.Trim();
             if (!string.IsNullOrEmpty(doc))
             {
                 doc = Regex.Replace(doc,
                                     @"(The \S+ type is a typedef for QFlags<\S+>\. It stores an OR combination of \S+ values\.)",
                                     string.Empty);
                 doc = Regex.Replace(doc, @"ConstantValue(Description)?.*?(((\n){2})|$)", string.Empty,
                                     RegexOptions.Singleline | RegexOptions.ExplicitCapture).Trim();
                 @enum.Comment = new RawComment();
                 @enum.Comment.BriefText = doc;
             }
         }
     }
     foreach (Enumeration.Item item in @enum.Items)
     {
         this.DocumentEnumItem(@enum, item);
     }
 }
开发者ID:RodolpheFouquet,项目名称:QtSharp,代码行数:30,代码来源:Documentation.cs

示例12: StateElement

 public StateElement(Enumeration.State state)
 {
     _state = state;
     _priorityState = Enumeration.PriorityState.Normal;
     _reverse = Enumeration.SequenceReverse.Normal;
     _offset = Vector2.Zero;
 }
开发者ID:salvadorc17,项目名称:Prince-Monogame,代码行数:7,代码来源:StateElement.cs

示例13: VisitEnumDecl

        public override bool VisitEnumDecl(Enumeration @enum)
        {
            if (!base.VisitEnumDecl(@enum))
                return false;

            CheckEnumName(@enum);
            return true;
        }
开发者ID:ymlai87416,项目名称:CppSharp,代码行数:8,代码来源:CleanInvalidDeclNamesPass.cs

示例14: VisitEnumItem

        public override bool VisitEnumItem(Enumeration.Item item)
        {
            if (!base.VisitEnumItem(item))
                return false;

            item.Name = CheckName(item.Name);
            return true;
        }
开发者ID:acklinr,项目名称:CppSharp,代码行数:8,代码来源:CleanInvalidDeclNamesPass.cs

示例15: VisitEnumDecl

 public override bool VisitEnumDecl(Enumeration @enum)
 {
     if (!this.AlreadyVisited(@enum) && @enum.IsGenerated)
     {
         this.documentation.DocumentEnum(@enum);
     }
     return base.VisitEnumDecl(@enum);
 }
开发者ID:YekMX,项目名称:QtSharp,代码行数:8,代码来源:GetCommentsFromQtDocsPass.cs


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