public void BasicCommandLine() { CommandLineGenerator generator = CreateGenerator(); string commandLine = generator.GenerateCommandLine(); Assert.Equal("/P /SSubstituteThis!_postfix SubstituteThis!AsWell /AtEndSubstitute\\ /I42_postfix /Xone /Xtwo /Xthree a.cs b.cs /Z7", commandLine); }
public override bool Execute() { if (!String.IsNullOrEmpty(TrackerLogDirectory)) { TrackFileAccess = true; } object rootObject = XamlServices.Load(new StreamReader(Xaml)); XamlTypes.ProjectSchemaDefinitions schemas = rootObject as XamlTypes.ProjectSchemaDefinitions; if (schemas != null) { foreach (XamlTypes.IProjectSchemaNode node in schemas.Nodes) { XamlTypes.Rule rule = node as XamlTypes.Rule; if (rule != null) { parseParameters(rule); CommandLineGenerator generator = new CommandLineGenerator(rule, parameterValues); generator.CommandLineTemplate = this.CommandLineTemplate; generator.AdditionalOptions = AdditionalOptions; CommandLine = generator.GenerateCommandLine(); return(base.Execute()); } } } return(false); }
private CommandLineGenerator CreateGenerator() { Rule rule = XamlReader.Parse(testXamlFile) as Rule; Dictionary <string, Object> switchValues = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); switchValues["Program"] = true; switchValues["Debug"] = false; switchValues["Subst"] = "SubstituteThis!"; switchValues["Subst2"] = "SubstituteThis!AsWell"; switchValues["Subst3"] = "Substitute\\"; switchValues["SubstInt"] = (int)42; switchValues["Strings"] = new string[] { "one", "two", "three" }; ITaskItem[] sources = new ITaskItem[] { new TaskItem("a.cs"), new TaskItem("b.cs") }; switchValues["Sources"] = sources; switchValues["DebugInformationFormat"] = "OldStyle"; switchValues["EmptyTest"] = "Empty"; CommandLineGenerator generator = new CommandLineGenerator(rule, switchValues); return(generator); }
public AutoEncodeWindow() { InitializeComponent(); calc = new BitrateCalculator(); logBuilder = new StringBuilder(); gen = new CommandLineGenerator(); sizeSelection.Items.AddRange(calc.getPredefinedOutputSizes()); }
public void CreatesAndDestroysTempFile() { var line = CommandLineGenerator.Generate("--file", "procedureExample.rcproc", "--procedure", "Test1", "--@a", "[1,2]", "--@b", "[3,4]", "--@key", "mykey"); Assert.IsTrue(File.Exists(line.TemporaryFile)); line.Dispose(); Assert.IsFalse(File.Exists(line.TemporaryFile)); }
public void GeneratesCommandLineForParameterlessProcedures() { using (var line = CommandLineGenerator.Generate("--file", "procedureExample.rcproc", "--procedure", "Test4")) { AssertMatch("^ --ldb --eval \\\"[_\\:\\\\A-Za-z0-9]+\\.tmp\\\" , $", line.CliArguments); Assert.IsTrue(line.CliArguments.Contains(line.TemporaryFile)); } }
public void GeneratesCommandLine2() { using (var line = CommandLineGenerator.Generate("--file", "procedureExample.rcproc", "--procedure", "Test2", "--@key1", "2", "--@somekeys", "[3,4]", "--@arg", "x", "--@someargv", "['hi this is', 'just, a test']")) { AssertMatch("^ --ldb --eval \\\"[_\\:\\\\A-Za-z0-9]+\\.tmp\\\" \\\"2\\\" \\\"3\\\" \\\"4\\\" , \\\"2\\\" \\\"x\\\" \\\"2\\\" \\\"hi this is\\\" \\\"just, a test\\\" $", line.CliArguments); Assert.IsTrue(line.CliArguments.Contains(line.TemporaryFile)); } }
public void GeneratesCommandLine() { using (var line = CommandLineGenerator.Generate("--file", "procedureExample.rcproc", "--procedure", "Test1", "--@a", "[1,2]", "--@b", "[3,4]", "--@key", "mykey")) { AssertMatch("^ --ldb --eval \\\"[_\\:\\\\A-Za-z0-9]+\\.tmp\\\" \\\"mykey\\\" , \\\"2\\\" \\\"1\\\" \\\"2\\\" \\\"2\\\" \\\"3\\\" \\\"4\\\" $", line.CliArguments); Assert.IsTrue(line.CliArguments.Contains(line.TemporaryFile)); } }
public void TemplateParametersAreCaseInsensitive() { CommandLineGenerator generator = CreateGenerator(); generator.CommandLineTemplate = "[sources]"; string commandLine = generator.GenerateCommandLine(); Assert.Equal("a.cs b.cs", commandLine); }
public void TemplatedCommandLine() { CommandLineGenerator generator = CreateGenerator(); generator.CommandLineTemplate = "[Sources] [Program]"; string commandLine = generator.GenerateCommandLine(); Assert.Equal("a.cs b.cs /P", commandLine); }
/// <summary> /// default constructor /// initializes all the GUI components, initializes the internal objects and makes a default selection for all the GUI dropdowns /// In addition, all the jobs and profiles are being loaded from the harddisk /// </summary> public MeGUIInfo() { this.codecs = new CodecManager(); this.gen = new CommandLineGenerator(); this.path = System.Windows.Forms.Application.StartupPath; this.jobs = new Dictionary <string, Job>(); this.skipJobs = new List <Job>(); this.logBuilder = new StringBuilder(); this.jobUtil = new JobUtil(this); this.settings = new MeGUISettings(); this.calc = new BitrateCalculator(); audioStreams = new AudioStream[2]; audioStreams[0].path = ""; audioStreams[0].output = ""; audioStreams[0].settings = null; audioStreams[1].path = ""; audioStreams[1].output = ""; audioStreams[1].settings = null; this.videoEncoderProvider = new VideoEncoderProvider(); this.audioEncoderProvider = new AudioEncoderProvider(); this.profileManager = new ProfileManager(this.path); this.profileManager.LoadProfiles(videoProfile, audioProfile); this.loadSettings(); this.loadJobs(); this.dialogManager = new DialogManager(this); #warning refactor menus int index = menuItem1.MenuItems.Count; foreach (IMuxing muxer in PackageSystem.MuxerProviders.Values) { MenuItem newMenuItem = new MenuItem(); newMenuItem.Text = muxer.Name; newMenuItem.Tag = muxer; newMenuItem.Index = index; index++; menuItem1.MenuItems.Add(newMenuItem); newMenuItem.Click += new System.EventHandler(this.mnuMuxer_Click); } index = mnuTools.MenuItems.Count; foreach (ITool tool in PackageSystem.Tools.Values) { MenuItem newMenuItem = new MenuItem(); newMenuItem.Text = tool.Name; newMenuItem.Tag = tool; newMenuItem.Index = index; index++; mnuTools.MenuItems.Add(newMenuItem); newMenuItem.Click += new System.EventHandler(this.mnuTool_Click); } //MessageBox.Show(String.Join("|", this.GetType().Assembly.GetManifestResourceNames())); using (TextReader r = new StreamReader(this.GetType().Assembly.GetManifestResourceStream("MeGUI.Changelog.txt"))) { mainForm.Changelog.Text = r.ReadToEnd(); } }
/// <summary> /// default constructor /// initializes all the GUI components, initializes the internal objects and makes a default selection for all the GUI dropdowns /// In addition, all the jobs and profiles are being loaded from the harddisk /// </summary> public MeGUIInfo() { this.codecs = new CodecManager(); this.gen = new CommandLineGenerator(); this.path = System.Windows.Forms.Application.StartupPath; this.jobs = new Dictionary<string, Job>(); this.skipJobs = new List<Job>(); this.logBuilder = new StringBuilder(); this.jobUtil = new JobUtil(this); this.settings = new MeGUISettings(); this.calc = new BitrateCalculator(); audioStreams = new AudioStream[2]; audioStreams[0].path = ""; audioStreams[0].output = ""; audioStreams[0].settings = null; audioStreams[1].path = ""; audioStreams[1].output = ""; audioStreams[1].settings = null; this.videoEncoderProvider = new VideoEncoderProvider(); this.audioEncoderProvider = new AudioEncoderProvider(); this.profileManager = new ProfileManager(this.path); this.profileManager.LoadProfiles(videoProfile, audioProfile); this.loadSettings(); this.loadJobs(); this.dialogManager = new DialogManager(this); int index = menuItem1.MenuItems.Count; foreach (IMuxing muxer in PackageSystem.MuxerProviders.Values) { MenuItem newMenuItem = new MenuItem(); newMenuItem.Text = muxer.Name; newMenuItem.Tag = muxer; newMenuItem.Index = index; index++; menuItem1.MenuItems.Add(newMenuItem); newMenuItem.Click += new System.EventHandler(this.mnuMuxer_Click); } index = mnuTools.MenuItems.Count; foreach (ITool tool in PackageSystem.Tools.Values) { MenuItem newMenuItem = new MenuItem(); newMenuItem.Text = tool.Name; newMenuItem.Tag = tool; newMenuItem.Index = index; index++; mnuTools.MenuItems.Add(newMenuItem); newMenuItem.Click += new System.EventHandler(this.mnuTool_Click); } //MessageBox.Show(String.Join("|", this.GetType().Assembly.GetManifestResourceNames())); using (TextReader r = new StreamReader(this.GetType().Assembly.GetManifestResourceStream("MeGUI.Changelog.txt"))) { mainForm.Changelog.Text = r.ReadToEnd(); } }
protected virtual MuxJob generateMuxJob() { MuxJob job = new MuxJob(); convertLanguagesToISO(); foreach (SubStream stream in audioStreams) { job.Settings.AudioStreams.Add(stream); } foreach (SubStream stream in subtitleStreams) { job.Settings.SubtitleStreams.Add(stream); } job.Settings.ChapterFile = this.chaptersInput.Text; job.Settings.VideoName = this.videoName.Text; job.Settings.VideoInput = this.videoInput.Text; job.Settings.MuxedOutput = muxedOutput.Text; job.Settings.MuxedInput = this.muxedInput.Text; job.Settings.PARX = base.parX; job.Settings.PARY = base.parY; if (string.IsNullOrEmpty(job.Settings.VideoInput)) { job.Input = job.Settings.MuxedInput; } else { job.Input = job.Settings.VideoInput; } job.Output = job.Settings.MuxedOutput; job.MuxType = muxer.MuxerType; job.ContainerType = cot; if ((!job.Settings.MuxedInput.Equals("") || !job.Settings.VideoInput.Equals("")) && !job.Settings.MuxedOutput.Equals("")) { if (this.muxFPS.SelectedIndex != -1) { job.Settings.Framerate = Double.Parse(muxFPS.Text); } if (this.muxFPS.SelectedIndex != -1 || !isFPSRequired()) { if (this.enableSplit.Checked && !splitSize.Text.Equals("")) { job.Settings.SplitSize = Int32.Parse(this.splitSize.Text) * 1024; } job.Commandline = CommandLineGenerator.generateMuxCommandline(job.Settings, job.MuxType, mainForm); } } return(job); }
/// <summary> /// tries to open the video source and gets the number of frames from it, or /// exits with an error /// </summary> /// <param name="videoSource">the AviSynth script</param> /// <param name="error">return parameter for all errors</param> /// <returns>true if the file could be opened, false if not</returns> protected bool getInputProperties(VideoJob job, out string error) { double f; int a, b; error = JobUtil.GetAllInputProperties(out numberOfFrames, out f, out hres, out vres, out a, out b, job.Input); darX = job.DARX; darY = job.DARY; if (job.Settings.UsesSAR) { int sarX, sarY; VideoUtil.findSAR(job.DARX, job.DARY, hres, vres, out sarX, out sarY); job.Commandline = CommandLineGenerator.generateVideoCommandline(job.Settings, job.Input, job.Output, sarX, sarY); } su.NbFramesTotal = numberOfFrames; return(error == null); }
public string GenCmdLine(string xaml) { object rootObject = XamlServices.Load(new StreamReader(xaml)); XamlTypes.ProjectSchemaDefinitions schemas = rootObject as XamlTypes.ProjectSchemaDefinitions; if (schemas != null) { foreach (XamlTypes.IProjectSchemaNode node in schemas.Nodes) { XamlTypes.Rule rule = node as XamlTypes.Rule; if (rule != null) { var parameterValues = parseParameters(rule); CommandLineGenerator generator = new CommandLineGenerator(rule, parameterValues); generator.CommandLineTemplate = this.CommandLineTemplate; generator.AdditionalOptions = AdditionalOptions; return(generator.GenerateCommandLine()); } } } return(null); }
protected override string getCommandline() { return(CommandLineGenerator.generateVideoCommandline(this.Settings, this.input, this.output, -1, -1)); }
public void FailOnNonExistentProcedure() { var line = CommandLineGenerator.Generate("--file", "procedureExample.rcproc", "--procedure", "Test3", "--@a", "[1,2]", "--@b", "[3,4]", "--@key", "mykey"); }
public void FailOnMissingParameters() { var line = CommandLineGenerator.Generate("--file", "procedureExample.rcproc", "--procedure", "Test1", "--@b", "[3,4]", "--@key", "mykey"); }
public void FailOnWrongFile() { var line = CommandLineGenerator.Generate("--file", "wrongFile.rcproc", "--procedure", "Test1", "--@b", "[3,4]", "--@key", "mykey"); }
public static void Main(string[] args) { var app = new CommandLineApplication(false) { Name = "Coalesce" }; app.HelpOption("-h|--help"); var dataContextClass = app.Option("-dc|--dataContext", "Data Context containing the classes to scaffold", CommandOptionType.SingleValue); var force = app.Option("-f|--force", "Use this option to overwrite existing files", CommandOptionType.SingleValue); var relativeFolderPath = app.Option("-outDir|--relativeFolderPath", "Specify the relative output folder path from project where the file needs to be generated, if not specified, file will be generated in the project folder", CommandOptionType.SingleValue); var onlyGenerateFiles = app.Option("-filesOnly|--onlyGenerateFiles", "Will only generate the file output and will not restore any of the packages", CommandOptionType.SingleValue); var validateOnly = app.Option("-vo|--validateOnly", "Validates the model but does not generate the models", CommandOptionType.SingleValue); var area = app.Option("-a|--area", "The area where the generated/scaffolded code should be placed", CommandOptionType.SingleValue); var module = app.Option("-m|--module", "The prefix to apply to the module name of the generated typescript files", CommandOptionType.SingleValue); var webProject = app.Option("-wp|--webproject", "Relative path to the web project; if empty will search up from current folder for first project.json", CommandOptionType.SingleValue); var dataProject = app.Option("-dp|--dataproject", "Relative path to the data project", CommandOptionType.SingleValue); var targetNamespace = app.Option("-ns|--namespace", "Target Namespace for the generated code", CommandOptionType.SingleValue); app.OnExecute(async() => { var model = new CommandLineGeneratorModel { DataContextClass = dataContextClass.Value() ?? "", Force = force.Value() != null && force.Value().ToLower() == "true", RelativeFolderPath = relativeFolderPath.Value() ?? "", OnlyGenerateFiles = onlyGenerateFiles.Value() != null && onlyGenerateFiles.Value().ToLower() == "true", ValidateOnly = validateOnly.Value() != null && validateOnly.Value().ToLower() == "true", AreaLocation = area.Value() ?? "", TypescriptModulePrefix = module.Value() ?? "", TargetNamespace = targetNamespace.Value() ?? "" }; // Find the web project ProjectContext webContext = DependencyProvider.ProjectContext(webProject.Value()); if (webContext == null) { throw new ArgumentException("Web project or target namespace was not found."); } // Find the data project ProjectContext dataContext = DependencyProvider.ProjectContext(dataProject.Value()); if (dataContext == null) { throw new ArgumentException("Data project was not found."); } Console.WriteLine(""); CommandLineGenerator generator = new CommandLineGenerator(webContext, dataContext); await generator.GenerateCode(model); return(0); }); try { app.Execute(args); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); if (ex.InnerException != null) { Console.WriteLine(ex.InnerException.Message); Console.WriteLine(ex.InnerException.StackTrace); } } }