本文整理汇总了C#中Flag类的典型用法代码示例。如果您正苦于以下问题:C# Flag类的具体用法?C# Flag怎么用?C# Flag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Flag类属于命名空间,在下文中一共展示了Flag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlagData
public string FlagData(Flag flag)
{
string data = "";
if (FlagUsed(flag))
data = (string)flagUsed[flag];
return data;
}
示例2: TestCustomFlag2
public void TestCustomFlag2()
{
var flags = new Flag<TESTENUM>(TESTENUM._1, TESTENUM._3);
Assert.AreEqual(false, flags[TESTENUM._2]);
Assert.AreEqual(true, flags[TESTENUM._3]);
}
示例3: SingleBarrierOption
public SingleBarrierOption(Flag flag, SingleBarrierFlag barrierFlag, double s, double x, double k, double h, double r, double b, double t, double sigma)
: base(flag, s, x, r, b, t, sigma)
{
this.h = h;
this.k = k;
this.barrierFlag = barrierFlag;
}
示例4: AddFlag
// FLAGS
// clearing: Removing rubble and preparing to build. Lots must be cleared before building.
void AddFlag(string flag, int duration)
{
Flag f = new Flag ();
f.name = flag;
f.duration = duration;
flags.Add (f);
}
示例5: Account
public Account()
{
Competnces = new Flag<COMPETENCE>();
Guid = Guid.NewGuid();
Name = Id.ToString();
Password = Id.ToString();
}
示例6: GapOption
/// <summary>
/// Creates a new instance of GapOption
/// </summary>
/// <param name="flag">Call/Put flag</param>
/// <param name="s">Asset price</param>
/// <param name="x">Strike price</param>
/// <param name="x">Strike price 2</param>
/// <param name="r">Risk-free interest rate</param>
/// <param name="b">Yield</param>
/// <param name="t">Time to expiry in years</param>
/// <param name="sigma">Asset volatility</param>
public GapOption(Flag flag, double s, double x1, double x2, double r, double b, double t, double sigma)
: base(flag, s, x1, r, b, t, sigma)
{
this.x2 = x2;
d1 = (Math.Log(s / x) + (r - b + (0.5 * Math.Pow(sigma, 2))) * t) / (sigma * Math.Sqrt(t));
d2 = d1 - sigma * Math.Sqrt(t);
}
示例7: YNode
public YNode(int depth,object key,object o,int rf,Flag flags) {
Depth=depth;
Key=key;
O=o;
Ref=rf;
Flags=flags;
}
示例8: executeAnimation
public void executeAnimation(Flag.Face.FlagFaceState f)
{
switch (f) {
case Flag.Face.FlagFaceState.STATE_BLINK:
animator.SetTrigger("blink");
break;
case Flag.Face.FlagFaceState.STATE_ATTACK:
animator.SetTrigger("attack");
break;
case Flag.Face.FlagFaceState.STATE_CHARGE:
animator.SetTrigger("charge");
break;
case Flag.Face.FlagFaceState.STATE_DANGER:
animator.SetTrigger("danger");
break;
case Flag.Face.FlagFaceState.STATE_HIT:
animator.SetTrigger("hit");
break;
case Flag.Face.FlagFaceState.STATE_TELL:
animator.SetTrigger("tell");
break;
default:
break;
}
}
示例9: getRssData
private string[,] getRssData(string channel)
{
Console.WriteLine("LOADING FEED... Please wait.");
XmlNodeList items;
try
{
WebRequest request = WebRequest.Create(channel);
WebResponse responce = request.GetResponse();
Stream rssStream = responce.GetResponseStream();
XmlDocument rssDoc = new XmlDocument();
rssDoc.Load(rssStream);
items = rssDoc.SelectNodes("rss/channel/item");
}
catch (UriFormatException)
{
Console.Clear();
Console.WriteLine("\n");
Console.WriteLine($"Error: {channel} doesn't seem to be a valid feed URL. Exiting.");
Thread.Sleep(1500);
Console.Clear();
Flag flag = new Flag("-help");
flag.Do();
return null;
}
catch (Exception ex)
{
Console.Clear();
Console.WriteLine("\n");
Console.WriteLine($"Cannot load feed. Why? {ex.Message}");
Thread.Sleep(1500);
Console.Clear();
Flag flag = new Flag("-help");
flag.Do();
return null;
}
string[,] tempRssData = new string[items.Count, 3];
for (int i = 0; i < items.Count; i++)
{
XmlNode rssNode;
rssNode = items.Item(i).SelectSingleNode("title");
if (rssNode != null) tempRssData[i, 0] = rssNode.InnerText;
else tempRssData[i, 0] = "";
rssNode = items.Item(i).SelectSingleNode("description");
if (rssNode != null) tempRssData[i, 1] = rssNode.InnerText;
else tempRssData[i, 1] = "";
rssNode = items.Item(i).SelectSingleNode("link");
if (rssNode != null) tempRssData[i, 2] = rssNode.InnerText;
else tempRssData[i, 2] = "";
}
return tempRssData;
}
示例10: RunUntilFinish
/// <summary>
/// 异步调用函数并等待其完成 (有死锁风险)
/// </summary>
/// <param name="action">欲调用的函数</param>
public static void RunUntilFinish(Action action, Flag cancelFlag=null)
{
if (IsMainThread())
action();
else
RunUntilFinish(MakeCoroutineFromAction(action), cancelFlag);
}
示例11: ReadCoordinates
private static short[] ReadCoordinates(BinaryReader input, int pointCount, Flag[] flags, Flag isByte, Flag signOrSame)
{
var xs = new short[pointCount];
int x = 0;
for (int i = 0; i < pointCount; i++)
{
int dx;
if (flags[i].HasFlag(isByte))
{
var b = input.ReadByte();
dx = flags[i].HasFlag(signOrSame) ? b : -b;
}
else
{
if (flags[i].HasFlag(signOrSame))
{
dx = 0;
}
else
{
dx = input.ReadInt16();
}
}
x += dx;
xs[i] = (short)x; // TODO: overflow?
}
return xs;
}
示例12: CreateFlagsXML
public String CreateFlagsXML(Flag[] flags, String personID)
{
// Create the xml document
XmlDocument doc = new XmlDocument();// Create the XML Declaration, and append it to XML document
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
doc.AppendChild(dec);// Create the root element
XmlElement root = doc.CreateElement("UpdateFlags");
doc.AppendChild(root);
// Note that to set the text inside the element,
// you use .InnerText instead of .Value (which will throw an exception).
// You use SetAttribute to set attribute
foreach (Domain.Flag curFlag in flags)
{
if (curFlag != null)
{
XmlElement Flag = doc.CreateElement("Flag");
XmlElement FlagValue = doc.CreateElement("FlagValue");
XmlElement FlagNumber = doc.CreateElement("FlagNumber");
XmlElement Person_ID = doc.CreateElement("PersonID");
FlagValue.InnerText = curFlag.FlagValue;
FlagNumber.InnerText = curFlag.FlagNumber.ToString();
Person_ID.InnerText = personID;
Flag.AppendChild(FlagValue);
Flag.AppendChild(FlagNumber);
Flag.AppendChild(Person_ID);
root.AppendChild(Flag);
}
}
string xmlOutput = doc.OuterXml;
return xmlOutput;
}
示例13: Unpack
public void Unpack()
{
CommandId = (UInt16)(Buffer[1] | (((UInt16)Buffer[2]) << 8));
Flags = (Flag)Buffer[3];
PacketInterval = Buffer[4];
KeepAliveIntervalMs= (UInt16)(Buffer[5] | (((UInt16)Buffer[6]) << 8));
}
示例14: AddFlag
/**
* Adds a flag
*/
public static Flag AddFlag(string name, bool state = false)
{
Flag newFlag = new Flag(name, state);
GetInstance().flags.Add(newFlag);
return newFlag;
}
示例15: FlaggedUsersDetails
public FlaggedUsersDetails(FlaggedUsersViewModel viewModel, Flag flag)
{
InitializeComponent();
Icon = "badge.png";
viewModel.Flag = flag;
Title = flag.AlertLevel.ToString();
BindingContext = this.viewModel = viewModel;
}