本文整理汇总了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);
}
示例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;
}
示例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;
}
}
示例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;
}
示例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());
}
示例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;
}
示例7: Template
public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Enumeration e)
: base(_host)
{
this.ctx = ctx;
this.e = e;
}
示例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;
}
示例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;
}
示例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;
//}
}
示例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);
}
}
示例12: StateElement
public StateElement(Enumeration.State state)
{
_state = state;
_priorityState = Enumeration.PriorityState.Normal;
_reverse = Enumeration.SequenceReverse.Normal;
_offset = Vector2.Zero;
}
示例13: VisitEnumDecl
public override bool VisitEnumDecl(Enumeration @enum)
{
if (!base.VisitEnumDecl(@enum))
return false;
CheckEnumName(@enum);
return true;
}
示例14: VisitEnumItem
public override bool VisitEnumItem(Enumeration.Item item)
{
if (!base.VisitEnumItem(item))
return false;
item.Name = CheckName(item.Name);
return true;
}
示例15: VisitEnumDecl
public override bool VisitEnumDecl(Enumeration @enum)
{
if (!this.AlreadyVisited(@enum) && @enum.IsGenerated)
{
this.documentation.DocumentEnum(@enum);
}
return base.VisitEnumDecl(@enum);
}