public static string PembacaanBilangan(string value) { AbstractProcessor processor = new DefaultProcessor(); string name = processor.getName(value); return(refinement(name)); }
public Crawler() { Downloader = new BaseDownloader(); Schduler = new DefaultSchduler(); Processor = new DefaultProcessor(); inst = this; }
/// <summary> /// Handles incomming notification from given channel. /// Internal collection of processors is looked for the best matching one and this one will get right to proceed with notifiation. /// </summary> public bool Handle(string channel, object data) { if (string.IsNullOrEmpty(channel)) { throw new ArgumentNullException("channel"); } var segments = channel.Split('/'); foreach (var processor in _processors) { if (processor.Matches(channel, segments)) { processor.Notify(channel, segments, data); return(true); } } if (DefaultProcessor != null) { DefaultProcessor.Notify(channel, segments, data); } return(false); }
/* m */ // public override void Render(Config config) { EditorGUILayout.LabelField("Test string:"); _text = EditorGUILayout.TextArea(_text, GUILayout.Height(400)); _result = EditorGUILayout.TextArea(_result, GUILayout.Height(400)); if (GUILayout.Button("Test")) { //var parser = new RootParser(_text, new WhiteSpaceParser(), new SingleLineCommentsParser(), new MultilineCommentsParser()); //var enumarator = parser.TryMatch(0); //while (enumarator.MoveNext()) //{ //} //var sdaiofj = (CurlyBracketsNode)HybridParser.Parse(_text); //_result = processCurly(sdaiofj, _text, _text); var sdaiofj = RecursiveParserV2.Parse(_text); _result = sdaiofj.Debug(_text); //_result = sb.ToString(); //sb.Clear(); } if (GUILayout.Button("Test files enumeration")) { var enumerator = FilesEnumratator.EnumerateFilesInProject(config); var i = 0; var listOfFiles = new List <string>(); while (enumerator.MoveNext()) { Debug.LogError($"enumerator file = {enumerator.Current}"); listOfFiles.Add(enumerator.Current); i++; } Debug.LogError($"i = {i}"); var processor = new DefaultProcessor(); var listOfFailedParsing = new List <(string file, string error)>(); for (i = 0; i < listOfFiles.Count; i++) { EditorUtility.DisplayProgressBar("Simple Progress Bar", listOfFiles[i], i / (float)listOfFiles.Count); var text = File.ReadAllText(listOfFiles[i]); //try //{ var parsedText = RecursiveParserV2.Parse(text); var processedText = parsedText.Process(processor, text); File.WriteAllText(listOfFiles[i], processedText); //} //catch (Exception e) //{ // listOfFailedParsing.Add((text, e.Message)); //} } EditorUtility.ClearProgressBar(); Debug.Log($"listOfFailedParsing.Count = {listOfFailedParsing.Count}"); } }
public static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Argument Error"); return; } string pointsPath = args[0]; List <Coord>[] eyePoints = ReadPoints(pointsPath); IProcessor processor = new DefaultProcessor(); DateTime startTime = DateTime.Now; ProcessResult result = processor.Process(eyePoints[0]); WriteResult(result); Console.WriteLine("======"); result = processor.Process(eyePoints[1]); DateTime endTime = DateTime.Now; WriteResult(result); Console.WriteLine((endTime - startTime).TotalMilliseconds); }
static void Main(string[] args) { AbstractProcessor processor = new DefaultProcessor(); string name = spell("1531010"); Console.WriteLine(name); Console.ReadKey(true); }
public void ApplyCmdProcessUnits(string Context) { OperatorAuthentication.AuthedAction(Context, () => { var processor = new DefaultProcessor(); processor.Init(CmdOutprocessUnits.ToArray()); Output.SetCoreStream(Context, processor); }, false, true, PermissionID.RTApplyCmdProcessUnits, PermissionID.RuntimeAll); }
IProcessor Create(ProcessingType type) { IProcessor processor = null; // switch statement or perhaps indivual factory implementations for each processor type. // pick your poison switch (type) { case ProcessingType.Default: processor = new DefaultProcessor(); break; ...etc. }
public void ShouldProcessMessage() { var request = Message.CreateBuilder() .SetMessageId(20) .SetMessageType(Message.Types.MessageType.ExecuteStep) .Build(); var response = new DefaultProcessor().Process(request); var executionStatusResponse = response.ExecutionStatusResponse; Assert.AreEqual(response.MessageId, 20); Assert.AreEqual(response.MessageType, Message.Types.MessageType.ExecutionStatusResponse); Assert.AreEqual(executionStatusResponse.ExecutionResult.ExecutionTime, 0); }
public void ShouldProcessMessage() { var request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecuteStep }; var response = new DefaultProcessor().Process(request); var executionStatusResponse = response.ExecutionStatusResponse; Assert.AreEqual(response.MessageId, 20); Assert.AreEqual(response.MessageType, Message.Types.MessageType.ExecutionStatusResponse); Assert.AreEqual(executionStatusResponse.ExecutionResult.ExecutionTime, 0); }
public static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("Argument Error"); return; } string patternPath = args[0]; string pointsPath = args[1]; bool useDefault = bool.Parse(args[2]); PatternArguments pattern = PatternArguments.ReadFromFile(patternPath); List <Coord>[] eyePoints = ReadPoints(pointsPath); IProcessor processor; if (useDefault) { processor = new DefaultProcessor(); } else { processor = new TimeTagSensitiveProcessor(); } DateTime startTime = DateTime.Now; ProcessResult result = processor.Process(eyePoints[0], pattern); double cost = GetMatchCost(result); WriteResult(result); Console.WriteLine(cost); Console.WriteLine("======"); result = processor.Process(eyePoints[1], pattern); cost = GetMatchCost(result); DateTime endTime = DateTime.Now; WriteResult(result); Console.WriteLine(cost); Console.WriteLine((endTime - startTime).TotalMilliseconds); Console.WriteLine(); foreach (Coord coord in result.CoordPredictions) { Console.WriteLine("{0}, {1}", coord.X, coord.Y); } }
protected override void HandleCore() { bool debug = AccessorContext.DefaultContext.Get <bool>("debug"); Processor processor = null; if (!debug) { processor = new DefaultProcessor(); } else { processor = new DebugProcessor(); } processor.Process(); //System.Threading.Tasks.Task.WaitAll(new System.Threading.Tasks.Task[] { task }); }
// Methods /// <summary> /// Initializes a new instance of the <see cref="PreprocessorEnvironment" /> class. /// </summary> /// <param name="settings">The settings.</param> /// <param name="inputFilePath">The input_file_path.</param> /// <param name="resolver">The resolver.</param> /// <remarks></remarks> public PreprocessorEnvironment(PreprocessorSettings settings, Uri inputFilePath, XmlUrlResolver resolver) { _Settings = settings; _DefaultNodeProcessor = new DefaultProcessor(this); // Bottom-most stack frame _define_stack.Push(new Dictionary <string, SymbolicDef>()); // Record the input file as the outer-most "include" _include_stack.Push(inputFilePath); _fileset[inputFilePath] = true; _resolver = resolver; if (_Settings.InitialDefinitions != null) { foreach (var pair in _Settings.InitialDefinitions) { _DefineTextSymbol(pair.Key, pair.Value, false); } } }
public static string spell(string value) { AbstractProcessor processor = new DefaultProcessor(); value = processor.getName(value); string indoRefinement = null; if (!value.Contains("-satu ratus")) { indoRefinement = value.Replace("satu ratus", "seratus"); } if (!value.Contains("-satu ribu")) { indoRefinement = indoRefinement.Replace("satu ribu", "seribu"); } indoRefinement = indoRefinement.Replace("-", " "); return(indoRefinement); }
public static void RunJob(DefaultProcessor csvProcessor) { var fileFolderPath = csvProcessor.UriInformation.ComponentPath; var maxThreadCount = csvProcessor.UriInformation.GetUriProperty("threadCount", 3); var initialDelay = csvProcessor.UriInformation.GetUriProperty("initialDelay", 1000); var pathToCsv = csvProcessor.UriInformation.GetUriProperty<string>("pathToCsv"); var csvFileExt = csvProcessor.UriInformation.GetUriProperty<string>("csvFileExt"); var createDirectory = csvProcessor.UriInformation.GetUriProperty<bool>("createDirectory"); var deleteIfErrorFound = csvProcessor.UriInformation.GetUriProperty<bool>("deleteIfErrorFound"); if (!Directory.Exists(pathToCsv)) Directory.CreateDirectory(pathToCsv); var firstFile = Directory.GetFiles(pathToCsv, "*.csv").FirstOrDefault(); if (firstFile == null) { return; } var filedata = File.ReadAllText(firstFile); var dao = CsvDao.ParseFromString(filedata); if (dao == null) { if (deleteIfErrorFound) File.Delete(firstFile); Thread.Sleep(1000); return; } var exchange = new Exchange(csvProcessor.Route) { InMessage = { Body = dao.OriginalCsvData } }; csvProcessor.Process(exchange); }
public async Task <ActionResult> Index(string path) { if (path == null) { return(View()); } path = HttpUtility.UrlDecode(path); HttpClientWrapper httpClient = new HttpClientWrapper(); string contentType = string.Empty; if (!path.StartsWith("http://") && !path.StartsWith("https://")) { path = "http://" + path; } try { using (HttpResponseMessage response = await httpClient.GetHeadersAsync(path)) { if (response.StatusCode != HttpStatusCode.OK) { return(new HttpStatusCodeResult(response.StatusCode)); } contentType = response.Content.Headers.ContentType.MediaType; } } catch { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (contentType.Contains("html")) { HtmlProcessor processor = new HtmlProcessor(); string contentHtml = await processor.RunAsync(path, "/?path="); ViewBag.Content = contentHtml; return(View("Index")); } else { MemoryStream contentStream; if (contentType.Contains("image")) { return(Redirect(string.Format("/Image/?path={0}", path))); } else { DefaultProcessor processor = new DefaultProcessor(); contentStream = await processor.RunAsync(path); contentStream.Position = 0; return(File(contentStream, contentType)); } } }
public ProcessorFactory() { _handlers = new List <IHttpHandler>(); _defaultProcessor = new DefaultProcessor(); }
public static void SetCoreStream(string AuthContext, DefaultProcessor stream) { OperatorAuthentication.AuthedAction(AuthContext, () => { CoreStream.Processor = stream; }, false, true, PermissionID.RTApplyCmdProcessUnits, PermissionID.RuntimeAll); }