public string GetPlayerName() { Console.WriteLine("Insert the name of the Player"); var nameOfPlayer = InputFilters.FilterStringInput(_userInput.GetLine()); return(nameOfPlayer); }
private void SubmitInput() { // get current input Input input = GetCurrentInput(); // update command history if (_submitHistory.Count == 0 || !_submitHistory.LastOrDefault().Equals(input.ToString().Trim())) { _submitHistory.Add(input.ToString().TrimEnd()); _submitHistoryIndex = _submitHistory.Count; } Out.Standard.WriteLine(); // resolve command CommandResolver resolver = new CommandResolver(input, Commands); if (resolver.HasErrors) // if resolution failed with errors, output errors here { foreach (var err in resolver.Errors) { Out.Error.WriteLine(err); } CommandExecutionComplete(null); } else { var cmd = new CommandActivator().Create(resolver, this); InputFilters.SetFilterMode(FilterMode.Execution); _invoker.Invoke(cmd, false, CommandExecutionComplete); } }
public virtual void Render(ITextureCache cache) { if (Updated) { return; } Updated = true; foreach (var filter in InputFilters) { filter.Render(cache); } var inputTextures = InputFilters.Select(f => f.OutputTexture); OutputTexture = cache.GetTexture(OutputSize); Render(inputTextures); foreach (var filter in InputFilters) { if (filter.LastDependentIndex <= FilterIndex) { filter.Reset(cache); } } }
public void Render() { if (Updated) { return; } Updated = true; foreach (var filter in InputFilters) { filter.Render(); } var inputTextures = InputFilters .Select(f => f.OutputTexture) .ToList(); OutputTarget = TexturePool.GetTexture(OutputSize, OutputFormat); Render(inputTextures); foreach (var filter in InputFilters) { if (filter.LastDependentIndex <= FilterIndex) { filter.Reset(); } } }
public void Render() { if (m_Updated) { return; } m_Updated = true; m_Output = Output; foreach (var filter in InputFilters) { filter.Render(); } var inputs = InputFilters .Select(f => f.Output) .ToList(); Output.Allocate(); Render(inputs); foreach (var filter in InputFilters.Where(filter => filter.LastDependentIndex <= m_FilterIndex)) { filter.Reset(); } }
public void FilterStringInput_EmptyString_ExpectEmptyString() { var sourceString = string.Empty; var resultString = InputFilters.FilterStringInput(sourceString); Assert.AreEqual(sourceString, resultString); }
static void Main(string[] args) { Parser.Default.ParseArguments <CommandLineOptions>(args) .WithParsed(o => { var files = Directory.GetFiles(o.InputDir.Trim(), "*.cs", SearchOption.AllDirectories); StringBuilder sb = new StringBuilder(OutputText); foreach (var f in files.Where(f => !InputFilters.Any(fp => f.Contains(fp, System.StringComparison.OrdinalIgnoreCase)))) { var nameSpaces = GetNamespaceNodes(f); if (AddPreprocStatements(f)) { var ppn = GetPreProcName(f); sb.AppendLine($"#if (!BEES_OPTIN && !BEES_OPTOUT_{ppn}) || (BEES_OPTIN && BEES_OPTIN_{ppn})") .AppendLine(); } foreach (var ns in nameSpaces) { sb.Append(ns.ToString()) .AppendLine() .AppendLine(); } if (AddPreprocStatements(f)) { sb.AppendLine("#endif") .AppendLine(); } } var dir = Path.GetDirectoryName(o.OutputFile); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } // Add access Modifiers sb.Replace("public class ", string.Format(AcceesModPreprocA1, "class")); sb.Replace("public struct ", string.Format(AcceesModPreprocA1, "struct")); sb.Replace("public sealed class ", string.Format(AcceesModPreprocA1, "sealed class")); sb.Replace("public static class ", string.Format(AcceesModPreprocA1, "static class")); sb.Replace("public interface ", string.Format(AcceesModPreprocA1, "interface")); sb.Replace("public enum ", string.Format(AcceesModPreprocA1, "enum")); File.WriteAllText(o.OutputFile, sb.ToString(), Encoding.UTF8); if (o.Template) { sb.Replace("namespace BeeSharp", "namespace $rootnamespace$") .Replace("using BeeSharp", "using $rootnamespace$"); File.WriteAllText($"{o.OutputFile}.pp", sb.ToString(), Encoding.UTF8); } }); }
public void FilterStringInput_ContainsSpecialCaracters_ExpectStringWithAlfanumericCharacters() { var sourceString = "abc09**"; var expectedResult = "abc09"; var resultString = InputFilters.FilterStringInput(sourceString); Assert.AreEqual(expectedResult, resultString); }
private void CommandExecutionComplete(CommandInvokerResponse result) { if (InvokeRequired) { Invoke((MethodInvoker) delegate { CommandExecutionComplete(result); }); } else { InputFilters.SetFilterMode(FilterMode.Standard); WritePrompt(); } }
public IFilter <TOutput> Compile() { if (m_CompilationResult != null) { return(m_CompilationResult); } m_OriginalInputFilters = InputFilters; InputFilters = InputFilters .Select(x => x.Compile()) .ToArray(); m_CompilationResult = Optimize(); return(m_CompilationResult); }
protected Filter(TOutput output, params IFilter <TInput>[] inputFilters) { if (inputFilters == null || inputFilters.Any(f => f == null)) { throw new ArgumentNullException("inputFilters"); } m_Initialized = false; m_CompilationResult = null; m_InputFilters = inputFilters; m_Output = output; m_ProcessData = new ProcessData(); ProcessData.AddInputs(InputFilters.Select(f => f.ProcessData)); }
protected void Disposing(bool dispose) { if (dispose & !disposed) { disposed = true; try { InputFilters.Clear(); OutputFilters.Clear(); InputChannel.Dispose(); OutputChannel.Dispose(); } catch (Exception ex) { logger?.LogError(ex, "Fault disposing vrtu pipeline."); } } }
protected PinFilter() : base(new FilterPin()) { Pin = (FilterPin)InputFilters.First(); }