public override ProcessingResult Process(FileInfo originalFile, MatchResultType matchResultType, string[] values, FileInfo[] generatedFiles, ProcessInput whatToProcess, CancellationToken token) { switch (m_Parameters.PathFormat) { case PathFormat.FullPath: m_CsvWriter.WriteField(originalFile.FullName); break; case PathFormat.NameThenDirectory: m_CsvWriter.WriteField(originalFile.Name); m_CsvWriter.WriteField(originalFile.DirectoryName); break; case PathFormat.DirectoryThenName: m_CsvWriter.WriteField(originalFile.DirectoryName); m_CsvWriter.WriteField(originalFile.Name); break; } m_CsvWriter.WriteField(matchResultType.ToString()); foreach (string value in values) { m_CsvWriter.WriteField(value); } m_CsvWriter.NextRecord(); return(new ProcessingResult(ProcessingResultType.Success, "Success", new FileInfo[] { originalFile })); }
static void Main(string[] args) { string path = "..\\..\\..\\Data\\Task8.json"; ProcessInput input = new ProcessInput(); input.PrintShipment(path); }
public override ProcessingResult Process(FileInfo file, MatchResultType matchResultType, string[] values, FileInfo[] generatedFiles, ProcessInput whatToProcess, CancellationToken token) { return(new ProcessingResult(ProcessingResultType.Success, "Success", new FileInfo[] { file })); }
static void Main(string[] args) { Console.WriteLine("Please enter the file name, for example: " + "test.txt"); var fileName = Console.ReadLine(); if (string.IsNullOrEmpty(fileName)) { Console.WriteLine("Please enter a valid file name, for example: " + "test.txt"); } //get File Path string filePath = Path.Combine(Directory.GetCurrentDirectory(), @"InputOutput\" + fileName); //Process if file exist if (File.Exists(filePath)) { var readLines = File.ReadAllLines(filePath); if (readLines != null) { //Process input ICalculator processInput = new ProcessInput(); var trips = processInput.Calculate(readLines); //Process Output ILineWriter processOutput = new ProcessOutput(fileName); processOutput.WriteOutput(trips); } else { Console.WriteLine("No records presents"); } } else { Console.WriteLine("No such file presents, please enter a valid file name"); } }
public void TestMethod1() { //First Test ProcessInput.InputProcessor(5); //Second Test ProcessInput.InputProcessor(13); }
//Called by Controller when an input is received public void OnInput(ProcessInput evt) { if (PlayerIndex != evt.PlayerIndex || GameManager.Instance.CurrentManagerState != ManagerState.Fighting) { return; } ((PlayerState)stateMachine.CurrentState).ProcessInput(evt.NewInput, evt.Value); }
public void Process_GetNumberOfMetatagOccurrence() { var fakeInputString = @"<!DOCTYPE html> <html> <head> <meta charset=""UTF-8""> <meta name=""description"" content=""This is meta description""> <meta name=""keywords"" content=""Meta,SEO,Analyser,Sitecore,Anything""> </head> <body> <p>This is content to test number of occurrences on the page of each word listed in meta tags. It is to test Sitecore SEO Analyser so that SEO works.</p> </body> </html> "; var fakeListObject = new List <OccurrenceModel>(); var fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "is"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "meta"; fakeObject.OccurrenceCount = 2; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "seo"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "analyser"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "sitecore"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "description"; fakeObject.OccurrenceCount = 0; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "anything"; fakeObject.OccurrenceCount = 0; fakeListObject.Add(fakeObject); var actualList = ProcessInput.GetNumberOfMetatagOccurrence(fakeInputString); Assert.IsTrue(fakeListObject.SequenceEqual(actualList, new OccurrenceModelComparer())); }
public override ProcessingResult Process(FileInfo originalFile, MatchResultType matchResultType, string[] values, FileInfo[] generatedFiles, ProcessInput whatToProcess, CancellationToken token) { StringBuilder message = new StringBuilder(); List <FileInfo> outputFiles = new List <FileInfo>(); ProcessingResultType resultType = ProcessingResultType.Success; foreach (IProcessor processor in Processors) { token.ThrowIfCancellationRequested(); try { ProcessInput what = whatToProcess; if (processor.InputFileSource == InputFileSource.OriginalFile) { what = ProcessInput.OriginalFile; } ProcessingResult result = processor?.Process(originalFile, matchResultType, values, generatedFiles ?? new FileInfo[0], what, token); if (result != null) { if (result.OutputFiles != null) { outputFiles.AddRange(result.OutputFiles); } if (result.Type == ProcessingResultType.Failure) { resultType = ProcessingResultType.Failure; } if (result.Message != null) { if (message.Length > 0) { message.Append(" | "); } message.Append(result.Message); } } } catch (Exception ex) when(!(ex is OperationCanceledException)) { resultType = ProcessingResultType.Failure; if (message.Length > 0) { message.Append(" | "); } message.Append(ex.Message); RunInfo.ExceptionInfos.Enqueue(new ExceptionInfo(ex, originalFile)); } } if (message.Length == 0) { message.Append(resultType.ToString()); } return(new ProcessingResult(resultType, message.ToString(), outputFiles.ToArray())); }
public ActionResult DeleteConfirmed(int processId, int inputId) { ProcessInput processInput = db.ProcessInputs .SingleOrDefault(x => x.ProcessId == processId && x.InputId == inputId); db.ProcessInputs.Remove(processInput); db.SaveChanges(); return(RedirectToAction("Index")); }
private void OnPageClosed(PageCloseReasons_e reason) { if (reason == PageCloseReasons_e.Okay) { try { IXDocument[] docs = null; var rootDoc = m_Data.Input.Document; switch (m_Data.Input.Scope) { case InputScope_e.AllReferences: docs = m_Data.Input.AllDocuments.References .Where(d => d.IsChecked).Select(d => d.Document).ToArray(); break; case InputScope_e.Selection: docs = m_Data.Input.Components .Distinct(new ComponentDocumentSafeEqualityComparer()) .Select(c => c.ReferencedDocument).ToArray(); break; default: throw new NotSupportedException(); } var input = docs.ToList(); ProcessInput?.Invoke(m_Host.Extension.Application, input); var exec = new AssemblyBatchRunJobExecutor(m_Host.Extension.Application, m_MacroRunnerSvc, input.ToArray(), m_Logger, m_Data.Macros.Macros.Macros.Select(x => x.Data).ToArray(), m_Data.Options.ActivateDocuments, m_Data.Options.AllowReadOnly, m_Data.Options.AllowRapid, m_Data.Options.AutoSave); var vm = new JobResultVM(rootDoc.Title, exec, m_CadDesc, m_Logger); using (var cancelHandler = new EscapeBatchExecutorCancelHandler(exec, m_Host.Extension.Application, m_Dispatcher)) { vm.TryRunBatch(); } var wnd = m_Host.Extension.CreatePopupWindow <ResultsWindow>(); wnd.Control.Title = $"{rootDoc.Title} batch job result"; wnd.Control.DataContext = vm; wnd.Show(); } catch (OperationCanceledException) { } catch (Exception ex) { m_Msg.ShowError(ex); m_Logger.Log(ex); } } }
// private GameObject m_SceneObject; void Awake() { IsProcessInput = true; m_Instance = this; // m_SceneObject = GameObject.Find("Scene"); // 把手势响应放在这个地方更合适 gameObject.AddComponent <PinchRecognizer>(); m_bPinching = false; }
public ActionResult Edit([Bind(Include = "ProcessId,InputId,Amount,Tag")] ProcessInput processInput) { if (ModelState.IsValid) { db.Entry(processInput).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.InputId = new SelectList(db.Products, "Id", "Name", processInput.InputId); ViewBag.ProcessId = new SelectList(db.Processes, "Id", "Name", processInput.ProcessId); return(View(processInput)); }
//called when data for any output pin is requested public void Evaluate(int SpreadMax) { if (FProcessInput == null) FProcessInput = new ProcessInput<AsTextureImageInstance>(FPinInImage); SetSliceCount(SpreadMax); if (FProcessInput.CheckInputSize() || FProcessInput.Input.ImageAttributesChanged) Reinitialize(); Update(); }
// Use this for initialization void Start() { m_nJoyStickOrigin.x = gameObject.transform.localPosition.x; m_nJoyStickOrigin.y = gameObject.transform.localPosition.y; //m_MoveRadius = m_MaxRadius * Mathf.Cos(67.5f*Mathf.PI/180); m_ProcessInput = ProcessInput.Instance(); m_JoyStickSprite.alpha = 0.5f; m_BackGround1.alpha = 0.5f; m_BackGround2.alpha = 0.5f; m_BackGround1.gameObject.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); m_BackGround1.gameObject.GetComponent <Spin>().enabled = false; //m_IsPressed = false; }
// GET: ProcessInputs/Details/5 public ActionResult Details(int?processId, int?inputId) { if (processId == null || inputId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProcessInput processInput = db.ProcessInputs .SingleOrDefault(x => x.ProcessId == processId && x.InputId == inputId); if (processInput == null) { return(HttpNotFound()); } return(View(processInput)); }
private void processPayment(ProcessInput input) { var userid = Context.GetUser(); var emp = (from empl in Employee where empl.employeeid == userid select empl).FirstOrDefault(); var emplog = (from empl in EmployeeLoginMapping where empl.employeeid == userid select empl).FirstOrDefault(); if (emp.divisionid != null) { var bgd = (from bg in BillGroupDetail where bg.Id == input.GroupId select bg).FirstOrDefault(); if (bgd == null) { throw new Exception("Bill Group Not Generated"); } var now = DateTime.Now; var qry = from bill in Bill join us in UnitSummary on bill.UnitId equals us.id where us.divisionid == emp.divisionid && us.billgroupid == bgd.BillGroupId && bill.MonthYear == input.MonthYear join pay in PaymentDetail on bill.Id equals pay.BillNo into pd from p in pd.DefaultIfEmpty() //from p in pd.Where(o=>o.Canceled==false).DefaultIfEmpty() //where p.Canceled == false group new { Bill = bill, Pay = p } by bill.Id into g select new PaymentProcess { Amount = g.First().Bill.TotalAmount, BillNo = g.First().Bill.Id, Paid = g.Sum(p => p.Pay == null ? 0 : p.Pay.Canceled ?0 : p.Pay.Amount), }; var qryLst = qry.ToList(); foreach (var item in qryLst) { item.Balance = Convert.ToDouble(item.Paid) - item.Amount; item.OverPay = item.Balance > 0; item.ProcessedAt = DateTime.Now; item.ProcessedBy = emplog.loginname; } PaymentProcess.AddRange(qryLst); bgd.Status = "Closed"; BillGroupDetail.Update(bgd); this.SaveChanges(); } }
// GET: ProcessInputs/Edit/5 public ActionResult Edit(int?processId, int?inputId) { if (processId == null || inputId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProcessInput processInput = db.ProcessInputs.SingleOrDefault(x => x.ProcessId == processId && x.InputId == inputId); if (processInput == null) { return(HttpNotFound()); } ViewBag.InputId = new SelectList(db.Products, "Id", "Name", processInput.InputId); ViewBag.ProcessId = new SelectList(db.Processes, "Id", "Name", processInput.ProcessId); return(View(processInput)); }
public override ProcessingResult Process(FileInfo file, MatchResultType matchResultType, string[] values, FileInfo[] generatedFiles, ProcessInput whatToProcess, CancellationToken token) { ProcessorScope scope = m_Parameters.OneZipFilePer; bool perInput = scope == ProcessorScope.InputFile; bool perPreviousOutput = scope == ProcessorScope.GeneratedOutputFile; bool scopedToMethod = perInput || perPreviousOutput; List <FileInfo> outputFiles = new List <FileInfo>(); if (scopedToMethod) { ClearFiles(); } if (whatToProcess == ProcessInput.GeneratedFiles) { if (perPreviousOutput) { foreach (FileInfo previousFile in generatedFiles) { ClearFiles(); AddFile(previousFile); outputFiles.Add(GenerateZip(previousFile, token)); } } else { foreach (FileInfo f in generatedFiles) { AddFile(f); } } } else { AddFile(file); } if (perInput) { outputFiles.Add(GenerateZip(file, token)); } return(new ProcessingResult(ProcessingResultType.Success, "Success", outputFiles.ToArray())); }
private void OnInput(ProcessInput evt) { switch (CurrentManagerState) { case ManagerState.RoundOver: if (evt.NewInput == PlayerController.InputState.Confirm) { announcer.GetComponent <WinningAnnouncer>().ResetBool(); } break; case ManagerState.SetOver: //if(evt.NewInput == PlayerController.InputState.Confirm) // EventManager.Instance.Fire(new Rematch()); //if(evt.NewInput == PlayerController.InputState.Quit) // Application.Quit(); break; } }
public void Process_GetExternalLinkList() { var fakeInputString = "There are 3 links here, link1: http://www.google.com, link2: http://www.yahoo.com, link3 http://www.google.com"; var fakeListObject = new List <OccurrenceModel>(); var fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "http://www.google.com"; fakeObject.OccurrenceCount = 2; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "http://www.yahoo.com"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); var actualList = ProcessInput.GetExternalLinkList(fakeInputString); Assert.IsTrue(fakeListObject.SequenceEqual(actualList, new OccurrenceModelComparer())); }
public override void Start() { base.Start(); ProcessInput.IsProcessInput = false; //UIManager.HideAllUIExceptStory(); //UIManager.ShowUI(UIInfo.StoryDialogRoot, OnUIOpen, null); // // 判断是否进入ModelStory模式 // Singleton<ObjManager>.Instance.MainPlayer.IsInModelStory = IsNeedSilentMode(m_nStoryID); // 如果正在键盘输入 隐藏键盘 if (ChatInfoLogic.Instance() != null) { ChatInfoLogic.Instance().HideKeyboard(); } if (ProcessInput.Instance() != null) { ProcessInput.Instance().ReleaseTouch(); ProcessInput.Instance().ResetStickState(); } if (JoyStickLogic.Instance() != null) { JoyStickLogic.Instance().ReleaseJoyStick(); } if (Singleton <ObjManager> .GetInstance().MainPlayer != null) { // 这儿进行一些特殊的处理,可能Cabal里用不到 Singleton <ObjManager> .Instance.MainPlayer.StopMove(); Singleton <ObjManager> .Instance.MainPlayer.IsNoMove = true; } UIManager.HideAllUIExceptStory(); // UIManager.ShowUI(UIInfo.StoryDialogRoot, OnUIOpen, null); UIManager.ShowUI(UIInfo.MovieUI, OnUIOpen, null); Messenger.Broadcast(MessengerConst.OnCutsceneMovieBegin); }
public void Process_GetNumberOfOccurrencePage() { var fakeInputString = "This is what we call fake input string, yes, is fake input string..."; var fakeListObject = new List <OccurrenceModel>(); var fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "is"; fakeObject.OccurrenceCount = 2; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "call"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "fake"; fakeObject.OccurrenceCount = 2; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "input"; fakeObject.OccurrenceCount = 2; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "string"; fakeObject.OccurrenceCount = 2; fakeListObject.Add(fakeObject); fakeObject = new OccurrenceModel(); fakeObject.OccurrenceWordOrLink = "yes"; fakeObject.OccurrenceCount = 1; fakeListObject.Add(fakeObject); var actualList = ProcessInput.GetNumberOfOccurrencePage(fakeInputString); Assert.IsTrue(fakeListObject.SequenceEqual(actualList, new OccurrenceModelComparer())); }
private void RunProcessors(IProcessor[] processors, FileInfo file, MatchResultType matchResultType, string[] values) { FileInfo[] lastOutputs = new FileInfo[0]; foreach (IProcessor processor in processors) { RunInfo.CancellationToken.ThrowIfCancellationRequested(); try { ProcessInput whatToProcess = (processor.InputFileSource == InputFileSource.OriginalFile ? ProcessInput.OriginalFile : ProcessInput.GeneratedFiles); ProcessingResult result = processor?.Process(file, matchResultType, values, lastOutputs ?? new FileInfo[0], whatToProcess, RunInfo.CancellationToken); FileInfo[] outputFiles = result == null ? new FileInfo[0] : result.OutputFiles; lastOutputs = outputFiles == null ? new FileInfo[0] : outputFiles; } catch (Exception ex) when(!(ex is OperationCanceledException)) { lastOutputs = new FileInfo[0]; RunInfo.ExceptionInfos.Enqueue(new ExceptionInfo(ex, file)); } } }
private void Handle(ProcessInput message) { _consoleReader.Tell(message); }
// 展示UI,根据类型不同,触发不同行为 public static bool ShowUI(UIPathData pathData, OnOpenUIDelegate delOpenUI = null, object param = null) { if (null == m_instance) { LogModule.ErrorLog("game manager is not init"); return(false); } m_instance.AddLoadDicRefCount(pathData.name); #if !UNITY_EDITOR && !UNITY_STANDALONE_WIN if (pathData.uiType == UIPathData.UIType.TYPE_POP || // pathData.uiType == UIPathData.UIType.TYPE_STORY || // 现在对话界面有可能是小对话不需要释放摇杆了,把释放摇杆的操作放到具体逻辑中去 pathData.uiType == UIPathData.UIType.TYPE_TIP || pathData.uiType == UIPathData.UIType.TYPE_MENUPOP) { if (JoyStickLogic.Instance() != null) { ProcessInput.Instance().ReleaseTouch(); JoyStickLogic.Instance().ReleaseJoyStick(); } } #endif Dictionary <string, GameObject> curDic = null; switch (pathData.uiType) { case UIPathData.UIType.TYPE_BASE: curDic = m_instance.m_dicBaseUI; break; case UIPathData.UIType.TYPE_POP: curDic = m_instance.m_dicPopUI; break; case UIPathData.UIType.TYPE_STORY: curDic = m_instance.m_dicStoryUI; break; case UIPathData.UIType.TYPE_TIP: curDic = m_instance.m_dicTipUI; break; case UIPathData.UIType.TYPE_MENUPOP: curDic = m_instance.m_dicMenuPopUI; break; case UIPathData.UIType.TYPE_MESSAGE: curDic = m_instance.m_dicMessageUI; break; case UIPathData.UIType.TYPE_DEATH: curDic = m_instance.m_dicDeathUI; break; default: return(false); } if (null == curDic) { return(false); } if (m_instance.m_dicCacheUI.ContainsKey(pathData.name)) { if (!curDic.ContainsKey(pathData.name)) { curDic.Add(pathData.name, m_instance.m_dicCacheUI[pathData.name]); } m_instance.m_dicCacheUI.Remove(pathData.name); } if (curDic.ContainsKey(pathData.name)) { // 如果缓存区有,那么直接显示 curDic[pathData.name].SetActive(true); m_instance.DoAddUI(pathData, curDic[pathData.name], delOpenUI, param); return(true); } m_instance.LoadUI(pathData, delOpenUI, param); return(true); }
private void Handle(ProcessInput processInput) { var input = Console.ReadLine(); Sender.Tell(new InputReceived(input)); }
public void TestMethod2() { //Second Test ProcessInput.InputProcessor(13); }
static void OnLoadItemGetRoot(bool bSuccess, object param) { // 异常 如果资源加载失败 if (bSuccess == false) { InitDataInfo curInfo = param as InitDataInfo; if (curInfo == null) { return; } if (curInfo._type == NEWITEMTYPE.TYPE_SKILL) { if (SkillBarLogic.Instance() != null) { SkillBarLogic.Instance().UpdateSkillBarInfo(); if (GameManager.gameManager.PlayerDataPool.ForthSkillFlag == true) { if (SkillBarLogic.Instance()) { SkillBarLogic.Instance().NewPlayerGuide(4); } } } } else { if (curInfo._type == NEWITEMTYPE.TYPE_MENUBAR || curInfo._type == NEWITEMTYPE.TYPE_FELLOW3DSHOW) { if (MenuBarLogic.Instance() != null) { MenuBarLogic.Instance().InitButtonActive(); } if (PlayerFrameLogic.Instance() != null) { PlayerFrameLogic.Instance().AddRemindNum(); } } else if (curInfo._type == NEWITEMTYPE.TYPE_FUNCTION) { if (FunctionButtonLogic.Instance() != null) { FunctionButtonLogic.Instance().InitButtonActive(); FunctionButtonLogic.Instance().PlayNewButtonEffect(); } } } return; } if (NewItemGetLogic.Instance() != null) { InitDataInfo curInfo = param as InitDataInfo; NewItemGetLogic.Instance().Init(curInfo._spriteName, curInfo._destGameObject, curInfo._type, curInfo._nNewSkillID, curInfo._attachGameObject, curInfo._ItemName, curInfo._strFuncName, curInfo._strDec); if (JoyStickLogic.Instance() != null) { ProcessInput.Instance().ReleaseTouch(); JoyStickLogic.Instance().ReleaseJoyStick(); } } }
void OnDestroy() { m_Instance = null; }
public static List <Restaurant> SearchRestaurants(string query) { List <Restaurant> r = ToWebList(ProcessInput.GetRestaurants("restaurants", "contains", query)); return(r); }
/********************************** ** ** ** GET ** ** ** **********************************/ public static List <Restaurant> TopThree() { List <Restaurant> r = ToWebList(ProcessInput.GetRestaurants("restaurants", "top", "3")); return(r); }
public static List <Restaurant> GetRestaurants(params string[] sortParams) { List <Restaurant> r = ToWebList(ProcessInput.GetRestaurants(sortParams)); return(r); }
public void AddHandler(ProcessInput inputFunc) { InputFunc += inputFunc; }