public void TheIsSwitchMethod(char shortName, string longName, string actualSwitch, bool expectedValue) { var optionDefinition = new OptionDefinition { ShortName = shortName, LongName = longName }; Assert.AreEqual(expectedValue, optionDefinition.IsSwitch(actualSwitch)); }
public void TheGetSwitchDisplayMethod(char shortName, string longName, string displayName, string expectedString) { var optionDefinition = new OptionDefinition { ShortName = shortName, LongName = longName, DisplayName = displayName }; var actual = optionDefinition.GetSwitchDisplay(); Assert.AreEqual(expectedString, actual); }
public void Parse_Option_Single_OneArgument() { var definition = new OptionDefinition("option1", maxArguments: 1); var parser = new ArgumentParser("/", StringComparer.OrdinalIgnoreCase); parser.OptionsDefinitions.Add(definition); var arguments = parser.Parse(new[] { "/option1", "value1" }, requireDefinition: true); Assert.IsNotNull(arguments); Assert.AreEqual(1, arguments.Count()); Assert.AreEqual(ArgumentKind.Option, arguments.First().Kind); Assert.AreEqual(definition, arguments.First().Definition); Assert.AreEqual(1, arguments.First().Values.Count()); Assert.AreEqual("value1", arguments.First().Values[0]); }
public void InitializeSimple(StaticString subCategory) { this.OptionDefinition = null; this.client = null; this.DropList.AgeTransform.Visible = false; this.Toggle.AgeTransform.Visible = false; this.TextField.AgeTransform.Visible = false; this.Unavailable.Visible = false; this.Title.Text = "%" + subCategory + "Title"; AgeTooltip ageTooltip = this.Title.AgeTransform.AgeTooltip; if (ageTooltip != null) { ageTooltip.Content = "%" + subCategory + "Description"; } }
public void Unpin(OptionDefinition obj) { if (!_pinnedObjects.ContainsKey(obj)) { return; } var control = _pinnedObjects[obj]; _pinnedObjects.Remove(obj); _controlList.Remove(control); Destroy(control.CachedGameObject); OnPinnedStateChanged(obj, false); }
public static void Init(CommandLineApplication command) { command.Description = "Compare PR artifact sizes to reference and post differences"; // GET https://msasg.visualstudio.com/Skyman/_apis/build/builds/26886480/timeline/{timelineId}?api-version=5.0 var requiredOptions = new OptionDefinition[] { OptionDefinition.Url, OptionDefinition.AccessToken, OptionDefinition.FindFailures.BuildId, }; command.AddOptions(requiredOptions); var localCommand = new PrintBuildGanttChart(command, requiredOptions); command.OnExecute(async() => await localCommand.RunAsync()); }
public static void Init(CommandLineApplication command) { command.Description = "Downloads a specified artifact from a pipeline build"; var requiredOptions = new OptionDefinition[] { OptionDefinition.Url, OptionDefinition.AccessToken, OptionDefinition.GetArtifacts.Artifact, OptionDefinition.GetArtifacts.BuildId, OptionDefinition.GetArtifacts.Output, }; command.AddOptions(requiredOptions); var localCommand = new GetArtifactCommand(command, requiredOptions); command.OnExecute(async() => await localCommand.RunAsync()); }
public void Pin(OptionDefinition obj, int order) { if (_uiRoot == null) { Load(); } var control = OptionControlFactory.CreateControl(obj, null); control.CachedTransform.SetParent(_uiRoot.Container, false); if (order >= 0) { control.CachedTransform.SetSiblingIndex(order); } _pinnedObjects.Add(obj, control); _controlList.Add(control); }
void OnGUI_AnyInteger(OptionDefinition op) { NumberControl.ValueRange range; if (!NumberControl.ValueRanges.TryGetValue(op.Property.PropertyType, out range)) { Debug.LogError("Unknown integer type: " + op.Property.PropertyType); return; } var userRange = op.Property.GetAttribute <SROptions.NumberRangeAttribute>(); EditorGUI.BeginChangeCheck(); var oldValue = (long)Convert.ChangeType(op.Property.GetValue(), typeof(long)); var newValue = EditorGUILayout.LongField(op.Name, oldValue); if (newValue > range.MaxValue) { newValue = (long)range.MaxValue; } else if (newValue < range.MinValue) { newValue = (long)range.MinValue; } if (userRange != null) { if (newValue > userRange.Max) { newValue = (long)userRange.Max; } else if (newValue < userRange.Min) { newValue = (long)userRange.Min; } } if (EditorGUI.EndChangeCheck()) { op.Property.SetValue(Convert.ChangeType(newValue, op.Property.PropertyType)); } }
private void OptionsContainerOnOptionRemoved(IOptionContainer container, OptionDefinition optionDefinition) { List <OptionDefinition> options; if (!_optionContainerLookup.TryGetValue(container, out options)) { Debug.LogWarning("[SRDebugger] Received event from unknown option container."); return; } if (options.Remove(optionDefinition)) { _options.Remove(optionDefinition); OnOptionsUpdated(); } else { Debug.LogWarning("[SRDebugger] Received option removed event from option container, but option does not exist."); } }
private void OptionsContainerOnOptionAdded(IOptionContainer container, OptionDefinition optionDefinition) { List <OptionDefinition> options; if (!_optionContainerLookup.TryGetValue(container, out options)) { Debug.LogWarning("[SRDebugger] Received event from unknown option container."); return; } if (options.Contains(optionDefinition)) { Debug.LogWarning("[SRDebugger] Received option added event from option container, but option has already been added."); return; } options.Add(optionDefinition); _options.Add(optionDefinition); OnOptionsUpdated(); }
private void OnChangeStandardOption(object[] optionAndItem) { Diagnostics.Assert(optionAndItem.Length == 2); OptionDefinition optionDefinition = optionAndItem[0] as OptionDefinition; Diagnostics.Assert(optionDefinition != null); OptionDefinition.ItemDefinition itemDefinition = optionAndItem[1] as OptionDefinition.ItemDefinition; Diagnostics.Assert(itemDefinition != null); if (itemDefinition.Name != this.optionValuesByName[optionDefinition.Name]) { this.AdvancedDataChanged = true; this.optionValuesByName[optionDefinition.Name] = itemDefinition.Name; if (itemDefinition.OptionDefinitionConstraints != null) { foreach (OptionDefinitionConstraint optionDefinitionConstraint in from element in itemDefinition.OptionDefinitionConstraints where element.Type == OptionDefinitionConstraintType.Control select element) { string x; if (optionDefinitionConstraint.Keys != null && optionDefinitionConstraint.Keys.Length != 0 && this.optionValuesByName.TryGetValue(optionDefinitionConstraint.OptionName, out x)) { if (!optionDefinitionConstraint.Keys.Select((OptionDefinitionConstraint.Key key) => key.Name).Contains(x)) { this.optionValuesByName[optionDefinitionConstraint.OptionName] = optionDefinitionConstraint.Keys[0].Name; } } } } Diagnostics.Assert(this.OptionDefinitions != null); OptionDefinition optionDefinition2; if (this.OptionDefinitions.TryGetValue(optionDefinition.SubCategory, out optionDefinition2) && optionDefinition2.Name != optionDefinition.Name && optionDefinition2.ItemDefinitions != null) { if ((from item in optionDefinition2.ItemDefinitions select item.Name).Contains("Custom") && this.optionValuesByName.ContainsKey(optionDefinition.SubCategory)) { this.optionValuesByName[optionDefinition.SubCategory] = "Custom"; } } base.NeedRefresh = true; } }
private void SetViewModel() { EquityOption option = OptionDefinition.GetOption(); (OptionPricingData pricingData, bool fixedData) = MarketDataDefinition.GetMarketData(); var strategies = new List <HedgingStrategy>() { new HedgingStrategy(new DeltaHedgedPortfolio(option, 1), "Delta hedging"), new HedgingStrategy(new StopLossPortfolio(option, 1), "Stop-loss hedging") }; if (fixedData) { ViewModel.PlotDailyPnL(new DateTime(2020, 1, 1), pricingData, strategies, Seed); } else { ViewModel.PlotDailyPnL(new DateTime(2020, 1, 1), pricingData, strategies); } }
/// <summary> /// Gets an array of options states formatted by <see cref="FormatOptionState"/>. /// </summary> /// <param name="extension">An extension which options to retrieve.</param> /// <param name="result">A dictionary where to add options.</param> /// <returns>An array of option states.</returns> /// <remarks>Options already contained in <paramref name="result"/> are overwritten.</remarks> internal static IDictionary GetAllOptionStates(string extension, IDictionary result) { Debug.Assert(result != null); LocalConfiguration local = Configuration.Local; LocalConfiguration @default = Configuration.DefaultLocal; foreach (KeyValuePair <string, OptionDefinition> entry in options) { string name = entry.Key; OptionDefinition def = entry.Value; // skips configuration which don't belong to the specified extension: if ((extension == null || extension == def.Extension)) { if ((def.Flags & IniFlags.Supported) == 0) { result[name] = FormatOptionState( def.Flags, "Not Supported", "Not Supported"); } else if ((def.Flags & IniFlags.Http) != 0 && System.Web.HttpContext.Current == null) { result[name] = FormatOptionState( def.Flags, "Http Context Required", "Http Context Required"); } else { result[name] = FormatOptionState( def.Flags, def.Gsr(@default, name, null, IniAction.Get), def.Gsr(local, name, null, IniAction.Get)); } } } return(result); }
void OnGUI_Float(OptionDefinition op) { var range = op.Property.GetAttribute <SROptions.NumberRangeAttribute>(); float newValue; EditorGUI.BeginChangeCheck(); if (range != null) { newValue = EditorGUILayout.Slider(op.Name, (float)op.Property.GetValue(), (float)range.Min, (float)range.Max); } else { newValue = EditorGUILayout.FloatField(op.Name, (float)op.Property.GetValue()); } if (EditorGUI.EndChangeCheck()) { op.Property.SetValue(Convert.ChangeType(newValue, op.Property.PropertyType)); } }
public static void Init(CommandLineApplication command) { command.Description = "Compare PR artifact sizes to reference and post differences"; var requiredOptions = new OptionDefinition[] { OptionDefinition.Url, OptionDefinition.AccessToken, OptionDefinition.PrintPullRequestSizeChanges.NamedArtifactPaths, OptionDefinition.PrintPullRequestSizeChanges.PipelineId, OptionDefinition.PrintPullRequestSizeChanges.PullRequestCount, OptionDefinition.PrintPullRequestSizeChanges.ReferenceBranch, OptionDefinition.PrintPullRequestSizeChanges.ReferenceBuildCount, OptionDefinition.PrintPullRequestSizeChanges.RepositoryId, }; command.AddOptions(requiredOptions); var localCommand = new CheckPRSizeCommand(command, requiredOptions); command.OnExecute(async() => await localCommand.RunAsync()); }
public static void Init(CommandLineApplication command) { command.Description = "For the latest builds of specified branches, print sizes of provided artifacts"; var requiredOptions = new OptionDefinition[] { OptionDefinition.Url, OptionDefinition.AccessToken, OptionDefinition.PrintBranchSizes.PipelineId, OptionDefinition.PrintBranchSizes.BranchNames, OptionDefinition.PrintBranchSizes.ArtifactDefinitions, }; var extraOptions = new OptionDefinition[] { OptionDefinition.PrintBranchSizes.BranchPrefix, }; command.AddOptions(requiredOptions, extraOptions); var localCommand = new PrintBranchSizesCommand(command, requiredOptions); command.OnExecute(async() => await localCommand.RunAsync()); }
public static void Init(CommandLineApplication command) { command.Description = "Compare PR artifact sizes to reference and post differences"; var requiredOptions = new OptionDefinition[] { OptionDefinition.Url, OptionDefinition.AccessToken, OptionDefinition.UpdateTestFailureBugs.PipelineId, OptionDefinition.UpdateTestFailureBugs.Branch, OptionDefinition.UpdateTestFailureBugs.QueryId, OptionDefinition.UpdateTestFailureBugs.BugAreaPath, OptionDefinition.UpdateTestFailureBugs.BugIterationPath, OptionDefinition.UpdateTestFailureBugs.BugTag, OptionDefinition.UpdateTestFailureBugs.AutoFileThreshold, }; command.AddOptions(requiredOptions); var localCommand = new QueryBugCommand(command, requiredOptions); command.OnExecute(async() => await localCommand.RunAsync()); }
public void MyTestInitialize() { db = new OptionStorage(); IOptionDefinitionBuilder versionODB = new OptionDefinition.Builder(db); OptionDefinition versionOption = versionODB .AddShortName('v') .AddLongName("version") .HelpText("Print version information.") .Mandatory(true) .SetArgumentPresence(ArgumentPresence.None) .ValueParser(null) .Build(); IOptionDefinitionBuilder lengthODB = new OptionDefinition.Builder(db); OptionDefinition lengthOption = lengthODB .AddLongName("length") .HelpText("Calculates magic length.") .Mandatory(true) .SetArgumentPresence(ArgumentPresence.Mandatory) .ValueParser(new IntegerParser(0, Int32.MaxValue)) .Build(); IOptionDefinitionBuilder outputFormatOB = new OptionDefinition.Builder(db); IOptionDefinitionBuilder portabilityOB = new OptionDefinition.Builder(db); IOptionDefinitionBuilder fileOutputOB = new OptionDefinition.Builder(db); IOptionDefinitionBuilder appendOB = new OptionDefinition.Builder(db); IOptionDefinitionBuilder verboseOB = new OptionDefinition.Builder(db); IOptionDefinitionBuilder helpOptionBuilder = new OptionDefinition.Builder(db); outputFormatOB.AddLongName("format").AddShortName('f').HelpText("Specify output, format...").Build(); portabilityOB.AddLongName("portability").AddShortName('p').HelpText("Use the portable output format").SetArgumentPresence(ArgumentPresence.Mandatory).ValueParser(new StringParser()).Build(); fileOutputOB.AddLongName("output").AddShortName('o').HelpText("Do not send the results to stderr, ...").SetArgumentPresence(ArgumentPresence.Mandatory).ValueParser(new StringParser()).Build(); appendOB.AddLongName("append").AddShortName('a').HelpText("(Used together with -o.) Do not overwrite but append").SetArgumentPresence(ArgumentPresence.None).ValueParser(null).Build(); verboseOB.AddLongName("verbose").HelpText("Give very verbose output...").Build(); helpOptionBuilder.AddLongName("help").HelpText("Print a usage message...").Build(); new OptionDefinition.Builder(db).AddShortName('s').Build(); }
protected override IEnumerator OnShow(params object[] parameters) { yield return(base.OnShow(parameters)); this.readOnly = false; if (parameters != null) { if (parameters.Length != 0) { this.category = (parameters[0] as string); } if (parameters.Length > 1) { string text = parameters[1] as string; if (text != null && text == "readonly") { this.readOnly = true; } } } if (string.IsNullOrEmpty(this.category)) { yield break; } ISessionService service = Services.GetService <ISessionService>(); Diagnostics.Assert(service != null); this.Session = (service.Session as global::Session); if (this.Session == null) { yield break; } this.OptionDefinitions = new Dictionary <StaticString, OptionDefinition>(); if (this.category == "Game") { using (IEnumerator <OptionDefinition> enumerator = Databases.GetDatabase <OptionDefinition>(true).GetEnumerator()) { while (enumerator.MoveNext()) { OptionDefinition optionDefinition4 = enumerator.Current; if (optionDefinition4.Category == this.category && !this.OptionDefinitions.ContainsKey(optionDefinition4.Name)) { this.OptionDefinitions.Add(optionDefinition4.Name, optionDefinition4); } } goto IL_249; } } if (this.category == "World") { foreach (OptionDefinition optionDefinition2 in Databases.GetDatabase <WorldGeneratorOptionDefinition>(true)) { if (optionDefinition2.Category == this.category && !this.OptionDefinitions.ContainsKey(optionDefinition2.Name)) { this.OptionDefinitions.Add(optionDefinition2.Name, optionDefinition2); } } foreach (OptionDefinition optionDefinition3 in Databases.GetDatabase <OptionDefinition>(true)) { if (optionDefinition3.Category == "Game" && !this.OptionDefinitions.ContainsKey(optionDefinition3.Name)) { this.OptionDefinitions.Add(optionDefinition3.Name, optionDefinition3); } } } IL_249: if (this.OptionDefinitions != null) { this.filteredOptionDefinitions = from optionDefinition in this.OptionDefinitions.Values where optionDefinition.Category == this.category && optionDefinition.IsAdvanced select optionDefinition; this.BuildOptionValuesByNames(); this.BuildSettingsBySubCategory(); this.SettingsGroupsContainer.DestroyAllChildren(); int num = 0; if (AgeUtils.HighDefinition && this.category == "Game") { int num2 = 1986; this.SettingsGroupsContainer.HorizontalSpacing = 9f; if (Screen.width < num2) { this.SettingsGroupsContainer.HorizontalSpacing = -3f; num2 -= 48; } float num3 = ((float)Screen.width - (float)num2) / 2f; this.SettingsGroupsContainer.HorizontalMargin = -this.SettingsGroupsContainer.X + num3; } else if (AgeUtils.HighDefinition) { this.SettingsGroupsContainer.HorizontalMargin = 0f; this.SettingsGroupsContainer.HorizontalSpacing = 9f; } else if (!AgeUtils.HighDefinition && this.category == "Game") { int num4 = 1324; this.SettingsGroupsContainer.HorizontalSpacing = 6f; if (Screen.width < num4) { this.SettingsGroupsContainer.HorizontalSpacing = -2f; num4 -= 32; } float num5 = ((float)Screen.width - (float)num4) / 2f; this.SettingsGroupsContainer.HorizontalMargin = -this.SettingsGroupsContainer.X + num5; } else { this.SettingsGroupsContainer.HorizontalMargin = 0f; this.SettingsGroupsContainer.HorizontalSpacing = 6f; } float num6 = this.SettingsGroupsContainer.HorizontalMargin; using (Dictionary <string, List <OptionDefinition> > .Enumerator enumerator4 = this.settingsBySubCategory.GetEnumerator()) { while (enumerator4.MoveNext()) { KeyValuePair <string, List <OptionDefinition> > reference = enumerator4.Current; string text2 = "SettingsGroup" + reference.Key; AgeTransform ageTransform = this.SettingsGroupsContainer.InstanciateChild(this.SettingsGroupPrefab, text2); Diagnostics.Assert(ageTransform != null, "Failed to instanciate the {0} with prefab {1}", new object[] { text2, this.SettingsGroupPrefab.name }); ageTransform.X = num6; num6 += ageTransform.Width + this.SettingsGroupsContainer.HorizontalSpacing; this.setupAdvancedOptionsDelegate(ageTransform, reference, num); num++; if (num == 5) { AgeControlDropList[] componentsInChildren = ageTransform.GetComponentsInChildren <AgeControlDropList>(true); for (int i = 0; i < componentsInChildren.Length; i++) { AgeTooltip[] componentsInChildren2 = componentsInChildren[i].GetComponentsInChildren <AgeTooltip>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].AnchorMode = AgeTooltipAnchorMode.LEFT_CENTER; } } } } goto IL_515; } } this.filteredOptionDefinitions = null; this.BuildOptionValuesByNames(); this.BuildSettingsBySubCategory(); this.SettingsGroupsContainer.DestroyAllChildren(); IL_515: this.AdvancedDataChanged = false; base.NeedRefresh = true; this.RefreshButtons(); yield break; }
/// <summary> /// Generates an option type /// </summary> /// <param name="emitter">The emitter to write to</param> /// <param name="typeName">The name of the type</param> /// <param name="def">The option definition</param> /// <param name="root">True if this is the root type, false otherwise</param> private void _generateOptionType(CSharpEmitter emitter, string typeName, string fieldName, OptionDefinition def, bool root) { if (root) { typeName = _getDefinitionName(typeName, fieldName, def); var elementTypeName = _getDefinitionName(null, "element", def); using (var wrapper = _generateWrapperType(emitter, typeName, elementTypeName)) { if (root) { _generateDefinition(wrapper, null, "element", def.ElementType); } } } if (!root) { _generateDefinition(emitter, null, fieldName, def.ElementType); } }
static void Main(string[] args) { if (args.Length == 0) { Console.Error.WriteLine("Type `QaryanCLI -h` for help"); Console.Error.WriteLine("If you meant input from stdin and output to soundcard, use `QaryanCLI -`"); return; } OptionResultsDictionary opts = new OptionResultsDictionary(); OptionDefinition[] optdefs = new OptionDefinition[] { new OptionDefinition("help", OptValType.Flag, typeof(string), "General options", "Show this help message", new char[] { 'h', '?' }, new string[] { "help" }), new OptionDefinition("verbose", OptValType.IncrementalFlag, typeof(IntPtr), "General options", "Verbose output", new char[] { 'v' }, new string[] { "verbose" }), new OptionDefinition("voice", OptValType.ValueReq, typeof(string), "Voice options", "Use the specified voice", new char[] { 'V' }, new string[] { "voice" }), new OptionDefinition("list-voices", OptValType.Flag, typeof(string), "Voice options", "List the available voices", new char[] { 'l' }, new string[] { "list-voices" }), new OptionDefinition("pho", OptValType.ValueOpt, typeof(string), "Output options", "Write phonetic information to the specified file ('-' for stdout, the default)", new char[] { 'P' }, new string[] { "pho" }), new OptionDefinition("out", OptValType.ValueOpt, typeof(string), "Output options", "Write audio to the specified file ('-' for stdout, the default)", new char[] { 'o' }, new string[] { "out", "audio" }), new OptionDefinition("raw", OptValType.Flag, typeof(string), "Output options", "Output raw audio data instead of WAV", new char[] { 'R' }, new string[] { "raw" }) }; CommandLine.OptParse.Parser optp = ParserFactory.BuildParser(optdefs, opts); string[] arguments = optp.Parse(OptStyle.Unix, UnixShortOption.CollapseShort, DupOptHandleType.Allow, UnknownOptHandleType.NoAction, true, args); if (opts["help"] != null) { Assembly asm = Assembly.GetEntryAssembly(); // string s = (asm.ManifestModule.GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0] as AssemblyProductAttribute).Product; //s+= " " + (asm.ManifestModule.GetCustomAttributes(typeof(AssemblyVersionAttribute), true)[0] as AssemblyVersionAttribute).Version; UsageBuilder usage = new UsageBuilder(); usage.GroupOptionsByCategory = true; // usage.BeginSection(s); // usage.EndSection(); usage.BeginSection("Usage"); usage.AddParagraph(Path.GetFileName(asm.CodeBase) + " [options] [infile] [-P phofile] [-o outfile]"); usage.EndSection(); usage.BeginSection("Description"); usage.AddParagraph("Bare-bones command line interface to the Qaryan text-to-speech engine."); usage.EndSection(); usage.BeginSection("Options"); usage.AddOptions(optdefs); usage.EndSection(); usage.BeginSection("Environment Variables"); usage.AddParagraph("Setting the following variables is not required, but might help if the defaults don't work as expected."); usage.BeginList(ListType.Unordered); usage.AddListItem("MBROLA holds the path to the MBROLA executable."); usage.AddListItem("MBROLA_DATABASE_DIR holds the path where MBROLA databases may be found."); usage.AddListItem("QARYAN_ROOT holds the path where shared Qaryan files may be found."); usage.EndList(); usage.EndSection(); usage.ToText(Console.Error, OptStyle.Unix, true); return; } string qaryanpath = System.Environment.GetEnvironmentVariable("QARYAN_ROOT"); if (qaryanpath != null) { FileBindings.EnginePath = qaryanpath; } if (opts["list-voices"] != null) { string dir = FileBindings.VoicePath; Console.Error.WriteLine("Available voices:"); foreach (string file in Directory.GetFiles(dir + "/", "*.xml")) { Voice voice = new Voice(); voice.Load(file); if (voice.BackendSupported) { Console.Error.WriteLine("{2} voice {0} ({1})", Path.GetFileNameWithoutExtension(file), voice.DisplayName, voice.BackendName); } voice = null; } return; } //MBROLA.Mbrola.Binding = MBROLA.MbrolaBinding.Standalone; Console.InputEncoding = Encoding.UTF8; TextReaderCharProducer prod = new TextReaderCharProducer(); prod.ItemProduced += new ProduceEventHandler <char>(prod_ItemProduced); QaryanEngine myEngine = new QaryanEngine(); TextReader textSrc = Console.In; foreach (string argument in arguments) { if (File.Exists(argument)) { textSrc = File.OpenText(argument); break; } } DelegateConsumer <MBROLAElement> cons = new DelegateConsumer <MBROLAElement>(); cons.ItemConsumed += new ConsumeEventHandler <MBROLAElement>(cons_ItemConsumed); if (opts["verbose"] != null) { if (opts["verbose"].NumDefinitions > 2) { LogFilter = LogLevel.All; } else if (opts["verbose"].NumDefinitions > 1) { LogFilter = LogLevel.All ^ LogLevel.Debug; } else { LogFilter = LogLevel.All ^ (LogLevel.Debug | LogLevel.Info); } } else { LogFilter = LogLevel.All ^ (LogLevel.Debug | LogLevel.Info | LogLevel.MajorInfo); } myEngine.LogLine += OnLogLine; string voiceName = "mbrola-hb2"; if (opts["voice"] != null) { voiceName = opts["voice"].Value as string; } Voice myVoice; myVoice = new Voice(); myVoice.Load(Path.Combine(FileBindings.VoicePath, voiceName + ".xml")); myEngine.Voice = myVoice; if (opts["pho"] != null) { if ((opts["pho"].Value as string == "-") || (opts["pho"].Value == null)) { (myEngine.Backend as MbrolaBackend).Translator.ItemProduced += delegate(Producer <MBROLAElement> sender, ItemEventArgs <MBROLAElement> e) { Console.Write(e.Item); } } ; else { StreamWriter sw = File.CreateText(opts["pho"].Value as string); (myEngine.Backend as MbrolaBackend).Translator.ItemProduced += delegate(Producer <MBROLAElement> sender, ItemEventArgs <MBROLAElement> e) { sw.Write(e.Item); }; (myEngine.Backend as MbrolaBackend).Translator.DoneProducing += delegate(object sender, EventArgs e) { sw.Close(); }; } } if (opts["out"] != null) { if ((opts["out"].Value as string == "-") || (opts["out"].Value == null)) { if (opts["raw"] == null) { myEngine.SpeakToWavStream(textSrc, Console.OpenStandardOutput()); } else { myEngine.SpeakToRawStream(textSrc, Console.OpenStandardOutput()); } } else { if (opts["raw"] == null) { myEngine.SpeakToWavFile(textSrc, opts["out"].Value as string); } else { myEngine.SpeakToRawFile(textSrc, opts["out"].Value as string); } } } else { myEngine.Speak(textSrc); } /*} * else * { * myEngine.SpeakToNull(textSrc); * }*/ }
public bool HasPinned(OptionDefinition option) { return(_pinnedObjects.ContainsKey(option)); }
void OnGUI_Unsupported(OptionDefinition op) { EditorGUILayout.PrefixLabel(op.Name); EditorGUILayout.LabelField("Unsupported Type: {0}".Fmt(op.Property.PropertyType)); }
private void ContainerOnOptionRemoved(OptionDefinition obj) { _service.OptionsContainerOnOptionRemoved(_container, obj); }
public void OnDependencyChanged(OptionDefinition optionDefinition, OptionDefinition.ItemDefinition optionItemDefinition) { Diagnostics.Assert(optionDefinition.Name == this.OptionDefinition.EnableOn); this.AgeTransform.Enable = (optionItemDefinition.Name == "True"); }
private void InitialiseControls() { OptionDefinition.SetOption(OptionType.EuropeanCall, 60, DateTime.Now); MarketDataDefinition.SetMarketData(new OptionPricingData(60, 0.2, 0.04, 0.02), false); }