本文整理汇总了C#中Options类的典型用法代码示例。如果您正苦于以下问题:C# Options类的具体用法?C# Options怎么用?C# Options使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Options类属于命名空间,在下文中一共展示了Options类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(string[] args)
{
Options options = new Options(args);
int threadsCount = options.ThreadsCount > 0
? options.ThreadsCount
: Environment.ProcessorCount;
_loopsPerThread = options.MegaLoops * 1000000L;
if (threadsCount == 1)
{
Burn();
}
else
{
_loopsPerThread /= threadsCount;
_gateEvent = new ManualResetEvent(false);
Thread[] threads = new Thread[threadsCount];
for (int i = 0; i < threadsCount; i++)
{
var thread = new Thread(Burn);
thread.IsBackground = true;
thread.Start();
threads[i] = thread;
}
_gateEvent.Set();
foreach (var thread in threads)
thread.Join();
}
}
开发者ID:dmitry-ra,项目名称:benchmarks,代码行数:32,代码来源:CpuBurn.cs
示例2: TestNoInternal
public void TestNoInternal()
{
PolicyTemplate template = new PolicyTemplate();
template.Load(policyFile);
Options options = new Options(pdfExternal);
SortedList<int, IAction> internalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
SortedList<int, IAction> externalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];
Assert.AreEqual(1, internalActions.Count);
Assert.AreEqual(1, externalActions.Count);
PdfPolicy pdfPolicy = new PdfPolicy(template, options);
pdfPolicy.Apply();
string runtimePolicy = System.IO.Path.GetTempFileName();
string myPolicy = System.IO.Path.GetTempFileName();
template.Save(myPolicy, runtimePolicy);
PolicyTemplate modifedTemplate = new PolicyTemplate();
modifedTemplate.Load(myPolicy);
internalActions = modifedTemplate[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
externalActions = modifedTemplate[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];
Assert.AreEqual(0, internalActions.Count);
Assert.AreEqual(1, externalActions.Count);
modifedTemplate.Close();
System.IO.File.Delete(runtimePolicy);
System.IO.File.Delete(myPolicy);
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:34,代码来源:TestPdfPolicy.cs
示例3: TestDayOfWeekModifierWithSundayStartOne
public void TestDayOfWeekModifierWithSundayStartOne()
{
Options options = new Options();
options.DayOfWeekStartIndexZero = false;
Assert.AreEqual("在 12:23 PM, 在 第二个星期日 每月", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options));
}
开发者ID:Takaloy,项目名称:cron-expression-descriptor,代码行数:7,代码来源:TestFormats.zh-cn.cs
示例4: WriteClasses
public void WriteClasses(List<string> classes, Options options)
{
WriteLine("[JsType(JsMode.Json)]");
Bracket((options.AccessInternal ? "internal" : "public") + " static class Classes");
if (options.MinimizeNames)
WriteLine("#if DEBUG");
foreach (string c in classes)
{
string cc = Name.ToCamelCase(c);
WriteLine("public const string " + cc + " = \"" + c + "\";");
}
if (options.MinimizeNames)
{
WriteLine("#else");
foreach (string c in classes)
{
string cc = Name.ToCamelCase(c);
string co = ob.ObfuscateClass(c);
WriteLine("public const string " + cc + " = \"" + co + "\";");
}
WriteLine("#endif");
}
EndBracket();
}
开发者ID:hultqvist,项目名称:WebTools,代码行数:25,代码来源:CSharpSaver.cs
示例5: Builder
public Builder(Options options, AppLocations appLocations, IBuilderEvent builderEvent)
: base(options, appLocations)
{
Counters = new List<string>();
traceListener = new BuilderEventListener(this);
BuilderEvent = builderEvent;
}
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:7,代码来源:Builder.cs
示例6: JsGlobal
public JsGlobal(ExecutionVisitor visitor, Options options)
{
this.Options = options;
this.Visitor = visitor;
this["null"] = JsNull.Instance;
#region Global Classes
this["Object"] = ObjectClass = new JsObjectConstructor(this);
this["Function"] = FunctionClass = new JsFunctionConstructor(this);
this["Array"] = ArrayClass = new JsArrayConstructor(this);
this["Boolean"] = BooleanClass = new JsBooleanConstructor(this);
this["Date"] = DateClass = new JsDateConstructor(this);
this["Error"] = ErrorClass = new JsErrorConstructor(this, "Error");
this["EvalError"] = EvalErrorClass = new JsErrorConstructor(this, "EvalError");
this["RangeError"] = RangeErrorClass = new JsErrorConstructor(this, "RangeError");
this["ReferenceError"] = ReferenceErrorClass = new JsErrorConstructor(this, "ReferenceError");
this["SyntaxError"] = SyntaxErrorClass = new JsErrorConstructor(this, "SyntaxError");
this["TypeError"] = TypeErrorClass = new JsErrorConstructor(this, "TypeError");
this["URIError"] = URIErrorClass = new JsErrorConstructor(this, "URIError");
this["Number"] = NumberClass = new JsNumberConstructor(this);
this["RegExp"] = RegExpClass = new JsRegExpConstructor(this);
this["String"] = StringClass = new JsStringConstructor(this);
this["Math"] = MathClass = new JsMathConstructor(this);
this.Prototype = ObjectClass.Prototype;
#endregion
MathClass.Prototype = ObjectClass.Prototype;
foreach (JsInstance c in this.GetValues())
{
if (c is JsConstructor)
{
((JsConstructor)c).InitPrototype(this);
}
}
#region Global Properties
this["NaN"] = NumberClass["NaN"]; // 15.1.1.1
this["Infinity"] = NumberClass["POSITIVE_INFINITY"]; // // 15.1.1.2
this["undefined"] = JsUndefined.Instance; // 15.1.1.3
this[JsInstance.THIS] = this;
#endregion
#region Global Functions
this["eval"] = new JsFunctionWrapper(Eval); // 15.1.2.1
this["parseInt"] = new JsFunctionWrapper(ParseInt); // 15.1.2.2
this["parseFloat"] = new JsFunctionWrapper(ParseFloat); // 15.1.2.3
this["isNaN"] = new JsFunctionWrapper(IsNaN);
this["isFinite"] = new JsFunctionWrapper(isFinite);
this["decodeURI"] = new JsFunctionWrapper(DecodeURI);
this["encodeURI"] = new JsFunctionWrapper(EncodeURI);
this["decodeURIComponent"] = new JsFunctionWrapper(DecodeURIComponent);
this["encodeURIComponent"] = new JsFunctionWrapper(EncodeURIComponent);
#endregion
}
开发者ID:Fedorm,项目名称:core-master,代码行数:60,代码来源:JsGlobal.cs
示例7: Main
static int Main( string[] args )
{
var options = new Options();
var parser = new CommandLine.Parser( with => with.HelpWriter = Console.Error );
if ( parser.ParseArgumentsStrict( args, options, () => Environment.Exit( -2 ) ) )
{
if ( string.IsNullOrEmpty( options.PathToRockWeb ) )
{
string removeString = "Dev Tools\\Applications";
string currentDirectory = System.Reflection.Assembly.GetExecutingAssembly().Location;
int index = currentDirectory.IndexOf( removeString );
string rockDirectory = ( index < 0 )
? currentDirectory
: currentDirectory.Substring( 0, index );
options.PathToRockWeb = Path.Combine( rockDirectory, "RockWeb" );
}
if ( !Directory.Exists( options.PathToRockWeb ) )
{
Console.WriteLine( "Error: unable to find directory: " + options.PathToRockWeb );
return -1;
}
Run( options );
}
return 0;
}
开发者ID:jondhinkle,项目名称:Rock,代码行数:31,代码来源:Program.cs
示例8: Main
static void Main(string[] args)
{
var options = new Options();
var parser = new CommandLineParser(new CommandLineParserSettings(Console.Error));
try
{
if (!parser.ParseArguments(args, options))
{
Console.Read();
Environment.Exit(0);
}
}
catch (Exception ex)
{
errorPrompt("When parsing command line arguments an exception occurred:\n{0}", ex.Message);
}
if (options.writeMode)
{
writeDataMatrix(options);
Console.Read();
Environment.Exit(0);
}
if (options.readMode)
{
readDataMatrix(options);
Console.Read();
Environment.Exit(0);
}
}
开发者ID:kdl00,项目名称:DatamatrixTool,代码行数:31,代码来源:Program.cs
示例9: ParsingInfo
private ParsingInfo(Options options, char initiator, char terminator, Func<string, Quantifier, IElement> parseToken)
{
this.options = options;
this.initiator = initiator;
this.terminator = terminator;
this.parseToken = parseToken;
}
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:ParsingInfo.cs
示例10: Script
/// <summary>
/// Инициализирует объект типа Script и преобрзует код сценария во внутреннее представление.
/// </summary>
/// <param name="code">Код скрипта на языке JavaScript.</param>
/// <param name="parentContext">Родительский контекст для контекста выполнения сценария.</param>
/// <param name="messageCallback">Делегат обратного вызова, используемый для вывода сообщений компилятора</param>
public Script(string code, Context parentContext, CompilerMessageCallback messageCallback, Options options)
{
if (code == null)
throw new ArgumentNullException();
Code = code;
int i = 0;
root = CodeBlock.Parse(new ParsingState(Tools.RemoveComments(code, 0), Code, messageCallback), ref i).Statement;
if (i < code.Length)
throw new System.ArgumentException("Invalid char");
CompilerMessageCallback icallback = messageCallback != null ? (level, cord, message) =>
{
messageCallback(level, CodeCoordinates.FromTextPosition(code, cord.Column, cord.Length), message);
} : null as CompilerMessageCallback;
var stat = new FunctionStatistics();
Parser.Build(ref root, 0, new System.Collections.Generic.Dictionary<string, VariableDescriptor>(), _BuildState.None, icallback, stat, options);
var body = root as CodeBlock;
Context = new Context(parentContext ?? NiL.JS.Core.Context.globalContext, true, pseudoCaller);
Context.thisBind = new GlobalObject(Context);
Context.variables = (root as CodeBlock).variables;
Context.strict = (root as CodeBlock).strict;
for (i = body.localVariables.Length; i-- > 0; )
{
var f = Context.DefineVariable(body.localVariables[i].name);
body.localVariables[i].cacheRes = f;
body.localVariables[i].cacheContext = Context;
if (body.localVariables[i].Inititalizator != null)
f.Assign(body.localVariables[i].Inititalizator.Evaluate(Context));
if (body.localVariables[i].isReadOnly)
body.localVariables[i].cacheRes.attributes |= JSObjectAttributesInternal.ReadOnly;
body.localVariables[i].captured |= stat.ContainsEval;
}
var bd = body as CodeNode;
body.Optimize(ref bd, null, icallback, options, stat);
}
开发者ID:modulexcite,项目名称:NiL.JS,代码行数:40,代码来源:Script.cs
示例11: Save
/// <summary>
/// Save user settings for grammar and spelling checking.
/// </summary>
/// <param name="addin">A reference to the <code>XWikiAddin</code>.</param>
public static void Save(ref XWord2003AddIn addin)
{
wordOptions = addin.Application.Options;
checkGrammarAsYouType = wordOptions.CheckGrammarAsYouType;
checkGrammarWithSpelling = wordOptions.CheckGrammarWithSpelling;
checkSpellingAsYouType = wordOptions.CheckSpellingAsYouType;
}
开发者ID:feaf,项目名称:sandbox,代码行数:11,代码来源:GrammarAndSpellingSettings.cs
示例12: Main
static int Main(string[] args)
{
_options = new Options();
CommandLineParser parser = new CommandLineParser(_options);
parser.Parse();
if (_options.Help)
{
Console.WriteLine(parser.UsageInfo.ToString(78, false));
return 0;
}
if (parser.HasErrors)
{
Console.WriteLine(parser.UsageInfo.ToString(78, true));
return -1;
}
if(_options.Test)
Test();
if (_options.TestString != null)
TestString();
else
RunDec0de();
return 0;
}
开发者ID:bixiu,项目名称:DEC0DE-forensics,代码行数:27,代码来源:Program.cs
示例13: Main
static void Main(string[] args)
{
var options = new Options();
if (Parser.Default.ParseArguments(args, options))
{
if (!options.ConsoleIn && options.InputFile == null
|| !options.ConsoleOut && options.OutputFile == null)
{
Console.WriteLine(options.GetUsage());
return;
}
// consume Options instance properties
var inReader = options.ConsoleIn
? Console.In
: new StreamReader(options.InputFile);
using (var outWriter = options.ConsoleIn
? Console.Out
: new StreamWriter(options.OutputFile)
)
{
var xml = inReader.ReadToEnd();
var doc = XDocument.Parse(xml);
var md = doc.Root.ToMarkDown();
outWriter.Write(md);
outWriter.Close();
}
}
else
{
// Display the default usage information
Console.WriteLine(options.GetUsage());
}
}
开发者ID:tynorton,项目名称:XmlCommentMarkDownGenerator,代码行数:33,代码来源:Program.cs
示例14: Process
private int Process(CommandType command)
{
var options = new Options { DatabaseUrl = DatabaseUrl.Text, BaseDirectory = BaseDirectory.Text, Command = command };
var directoryPath = !string.IsNullOrWhiteSpace(options.BaseDirectory) ? options.BaseDirectory : Environment.CurrentDirectory;
var baseDirectory = new DirectoryInfo(directoryPath);
if (!baseDirectory.Exists)
{
MessageBox.Show(@"Provided directory {0} does not exist.", options.BaseDirectory);
return IncorrectOptionsReturnCode;
}
var password = Environment.GetEnvironmentVariable(PasswordEnvVar);
var url = new Lazy<Uri>(() => ParseDatabaseUrl(options));
try
{
ExecuteCommand(options.Command, baseDirectory, url, password);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return UnknownErrorReturnCode;
}
return OkReturnCode;
}
开发者ID:artikh,项目名称:CouchDude.SchemeManager,代码行数:28,代码来源:MainForm.cs
示例15: PoResourceReader
public PoResourceReader(Stream stream, Options aOptions)
{
data = new Dictionary<string, PoItem>();
s = stream;
options = aOptions;
Load();
}
开发者ID:austhomp,项目名称:resgenEx,代码行数:7,代码来源:PoResourceReader.cs
示例16: Main
private static void Main(string[] args)
{
var options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
if (options.CsvHeaders)
{
Console.WriteLine("Type,File name");
}
foreach (string fileName in options.FileNames)
{
Console.WriteLine(new FileProperties(fileName).ToCsvLine());
}
if (options.Interactive)
{
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
else
{
options.GetUsage();
}
}
开发者ID:JohnBillington,项目名称:ReadBinaryType,代码行数:26,代码来源:Program.cs
示例17: InflectEnumName
private string InflectEnumName(string input, Options options)
{
string[] parts = input.Substring(options.Prefix.Length + 1).Split('_');
string[] temp = new string[parts.Length];
for (int i = 0; i < parts.Length; i++)
{
if (parts[i].Length > 0)
{
int capitalizeLength = 1;
if (parts[i].Length > 1 && char.IsDigit(parts[i][0]))
capitalizeLength = 2;
temp[i] = parts[i].Substring(0, capitalizeLength).ToUpper() + parts[i].Substring(capitalizeLength).ToLower();
}
}
string name = string.Join(string.Empty, temp);
if (char.IsDigit(name[0]))
name = "_" + name;
return name;
}
开发者ID:smack0007,项目名称:GLDotNet,代码行数:25,代码来源:DotNetTranslator.cs
示例18: LoadCompressor
private static ICompression LoadCompressor(string compressor, string file, Options options)
{
var tmp = DynamicLoader.CompressionLoader.GetModule(compressor, file, options.RawOptions);
if (tmp == null)
throw new Exception(string.Format("Unable to create {0} decompressor on file {1}", compressor, file));
return tmp;
}
开发者ID:AlexFRAN,项目名称:duplicati,代码行数:7,代码来源:VolumeReaderBase.cs
示例19: TranslateEnumGroups
private void TranslateEnumGroups(XmlSpecData spec, DotNetApiData api, Options options)
{
foreach (var specEnumGroup in spec.EnumGroups.Where(x => options.EnumGroupFilter(x.Name)))
{
var enumGroupData = new DotNetEnumGroupData()
{
Name = specEnumGroup.Name,
};
foreach (var enumName in specEnumGroup.Enums.Distinct())
{
var xmlEnumData = spec.Enums.SingleOrDefault(x => x.Name == enumName);
if (xmlEnumData == null || !options.EnumFilter(xmlEnumData))
continue;
var enumData = api.Enums.SingleOrDefault(x => x.OriginalName == enumName);
if (enumData == null)
continue;
enumGroupData.Enums.Add(enumData);
if (spec.Enums.Single(x => x.Name == enumName).Type == "bitmask")
enumGroupData.IsFlags = true;
}
api.EnumGroups.Add(enumGroupData);
}
}
开发者ID:smack0007,项目名称:GLDotNet,代码行数:30,代码来源:DotNetTranslator.cs
示例20: Core
public Core(IRequestExecuter requestExecuter, ICoreRequestGenerator requestGenerator, Options options)
{
OAuth2 = new OAuth2(requestExecuter, requestGenerator.OAuth2, options);
Accounts = new Accounts(requestExecuter, requestGenerator.Accounts);
Metadata = new Metadata(requestExecuter, requestGenerator.Metadata, options);
FileOperations = new FileOperations(requestExecuter, requestGenerator.FileOperations, options);
}
开发者ID:darocha,项目名称:DropboxRestAPI,代码行数:7,代码来源:Core.cs
注:本文中的Options类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论