public ActionNodePrefab(string _name, string _description, string identifier, ProgramAction _action) { Name = _name; Description = _description; Identifier = identifier; Action = _action; }
public Args(string path, string mask, ProgramAction action) { _path = path; _mask = mask; Action = action; _onlyAction = false; }
private void cbAction_SelectedIndexChanged(object sender, EventArgs e) { //Action發生更動的話要處理的事情 int index = cbAction.SelectedIndex; switch (index) { case 0: RightNowMode = ProgramAction.Drag; //cvImageBox.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.PanAndZoom; cvImageBox.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum; lblPointInfo.Text = "..."; break; case 1: RightNowMode = ProgramAction.Point; cvImageBox.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum; lblPointInfo.Text = GetRightNowPointInfo(); break; default: RightNowMode = ProgramAction.None; cvImageBox.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum; lblPointInfo.Text = "..."; break; } lblDebug.Text = GetDescription(RightNowMode); }
public static Args Parse(string[] args) { if (args.Length == 0) { throw new ArgumentException("Not specified search pattern!"); } //Default params string mask = args[0]; bool recursive = false; ProgramAction action = ProgramAction.ToFileName; for (int i = 1; i < args.Length; i++) { if (args[i] == "-recursive") { recursive = true; } else if (AllowedActions.ContainsKey(args[i])) { action = AllowedActions[args[i]]; } else { throw new ArgumentException("Unknown argument!"); } } return(new Args(mask, recursive, action)); }
public IndexModel(IConfiguration configuration) { Configuration = configuration; pathToken = Configuration["PathToken"]; pathFile = Configuration["PathFile"]; action = Configuration["Action"] == ProgramAction.SEND.ToString() ? ProgramAction.SEND : ProgramAction.RECEIVE; }
public SendController(IConfiguration configuration) { Configuration = configuration; pathToken = Configuration["PathToken"]; pathFile = Configuration["PathFile"]; action = Configuration["Action"] == ProgramAction.SEND.ToString() ? ProgramAction.SEND : ProgramAction.RECEIVE; }
static void Main(string[] args) { MainTimer.Interval = 300; MainTimer.Elapsed += MainTimer_Elapsed; MainTimer.Start(); Status = ProgramStatus.Program_Idle; Action = ProgramAction.Action_PopSlave; InputLoop(); }
public override void Generate() { for (int i = 0; i < this.slotCount; ++i) { ProgramAction action = this.GenerateRandomAction(); FieldColor color = this.GenerateRandomColor(); this.program[i].Action = action; this.program[i].Color = color; } }
static void Main(string[] args) { ProgramMenu menu = new ProgramMenu(); Tuple <string[], string[]> lastCipherText = null; while (true) { ProgramAction direction = menu.ChooseCipherAction(); AesCipher cipherProgram = new AesCipher(); Tuple <string[], string[]> valuesToUse = null; while (valuesToUse == null) { switch (direction) { case ProgramAction.Cipher: { CipherInputAction menuStartingChoice = menu.ChooseCipherInputType(); valuesToUse = GetCipherProgramValuesToUse(menu, menuStartingChoice); IEnumerable <RoundWords> roundKeys = GetRoundKeys(valuesToUse); menu.PromptForContinue(); byte[] inputBytes = valuesToUse.Item2.Select(x => CreateByteFromHexadecimal(x)).ToArray(); ByteArray result = cipherProgram.Cipher(inputBytes, roundKeys); lastCipherText = new Tuple <string[], string[]>(valuesToUse.Item1, result.Bytes1dArray.Select(x => CreateHexadecimalFromByte(x)).ToArray()); break; } case ProgramAction.Decipher: { DecipherInputAction menuStartingChoice = menu.ChooseDecipherInputType(); valuesToUse = GetDecipherProgramValuesToUse(menu, menuStartingChoice, lastCipherText); IEnumerable <RoundWords> roundKeys = GetRoundKeys(valuesToUse); menu.PromptForContinue(); byte[] inputBytes = valuesToUse.Item2.Select(x => CreateByteFromHexadecimal(x)).ToArray(); cipherProgram.Decipher(inputBytes, roundKeys); break; } default: { throw new Exception(SurpriseExceptionMessage); } } } menu.PromptForContinue(); } }
public IActionStrategy GetAction(ProgramAction action) { switch (action) { case ProgramAction.ToFileName: return(new FileNameAction()); case ProgramAction.ToTag: return(new TagAction()); default: return(null); } }
public override void Mutate() { bool mutateColor = random.Next(2) == 0; int randomPos = random.Next(this.slotCount); if (mutateColor) { FieldColor color = GenerateRandomColor(); this.program[randomPos].Color = color; } else { ProgramAction action = this.GenerateRandomAction(); this.program[randomPos].Action = action; } }
private void Main_UI_Load(object sender, EventArgs e) { #region 設定 SettingObj = new Setting(ConfigurationManager.AppSettings["SettingFileName"]); if (SettingPage == null) { SettingPage = new Setting_UI(SettingObj); SettingPage.Hide(); } #endregion #region 轉換PAGE if (saveResultConvertPage == null) { saveResultConvertPage = new SaveResultConvertPage(SettingObj); saveResultConvertPage.Hide(); } if (chiYaOutPage == null) { chiYaOutPage = new chiYaOutPage(); chiYaOutPage.Hide(); } if (KeyPointCheckPage == null) { KeyPointCheckPage = new KeyPointCheckPage(SettingObj); KeyPointCheckPage.Hide(); } #endregion #region ActionGroup RightNowMode = ProgramAction.None; #endregion Color_Red = new Bgr(0, 0, 255); Color_Blue = new Bgr(255, 0, 0); #region 隱藏放大視窗按鈕 this.MaximizeBox = false; this.MinimizeBox = false; #endregion #region 靠近點位的距離 NearThreadHold = 10; #endregion cvImageBox.MouseWheel += cvImageBox_MouseWheelEvent; }
protected void CreateCodeFromAction(ProgramAction programAction, ref StringBuilder code) { dynamic action = programAction; if (!_flag) { // qui non ha eseguito e cominciava con stackoverflow return; } _flag = false; CreateCodeFromAction(action, ref code); // se qui ha eseguito _flag = true; }
public ActionResult Details(string id = null) { StudentProfile studentprofile = db.StudentProfiles.Find(id); if (studentprofile == null) { Session["FlashMessage"] = "Student Profile not found"; return(RedirectToAction("Index", "StudentProfile")); } StudentProfileViewModel ViewModel = new StudentProfileViewModel(); ViewModel.student = studentprofile; var applications = studentprofile.Applications; List <ProgramAction> programactions = new List <ProgramAction>(); foreach (var application in applications) { ProgramAction programaction = new ProgramAction(); programaction.application = application; programaction.program = application.Program; programaction.student = studentprofile; //check student eligibility programaction.eligible = true; //check program application period programaction.inperiod = (application.Program.application_start_time <= DateTime.Now && DateTime.Now <= application.Program.application_end_time); //check if before program start time programaction.beforestart = (DateTime.Now < application.Program.application_start_time); //check existing application programaction.existed = true; //check application status programaction.saved = programaction.application.ApplicationStatus.name == "Saved"; //check program status programaction.open = application.Program.ProgramStatus.name == "Opened"; programactions.Add(programaction); } ViewModel.programactions = programactions; ViewModel.particulartypes = db.StudentParticularTypes.ToList(); ViewModel.experiencetypes = db.StudentExperienceTypes.ToList(); ViewBag.profilepic = System.IO.File.Exists(Server.MapPath("~/Images/StudentProfile/" + studentprofile.id + ".jpg")); return(PartialView(ViewModel)); }
public ActionResult MyProfile() { StudentProfileViewModel ViewModel = new StudentProfileViewModel(); string studentid = User.Identity.Name; var studentprofile = db.StudentProfiles.Find(studentid); if (studentprofile == null) { Session["FlashMessage"] = "Student Profile not found"; return(RedirectToAction("Index", "Home")); } var applications = db.Applications.ToList().Where(a => a.created_by == studentid.ToString()); ViewModel.student = studentprofile; List <ProgramAction> programactions = new List <ProgramAction>(); foreach (var application in applications) { ProgramAction programaction = new ProgramAction(); programaction.application = application; programaction.program = application.Program; programaction.student = studentprofile; //check student eligibility programaction.eligible = true; //check program application period programaction.inperiod = (application.Program.application_start_time <= DateTime.Now && DateTime.Now <= application.Program.application_end_time); //check if before program start time programaction.beforestart = (DateTime.Now < application.Program.application_start_time); //check existing application programaction.existed = true; //check application status programaction.saved = programaction.application.ApplicationStatus.name == "Saved"; //check program status programaction.open = application.Program.ProgramStatus.name == "Opened"; programactions.Add(programaction); } ViewModel.programactions = programactions; return(View(ViewModel)); }
public void executeAction(ProgramAction action) { this.executingAction = true; if (actionIndex == MAX_ACTIONS) { actionList.RemoveAt(0); actionIndex--; } while (actionIndex < actionList.Count()) { actionList.RemoveAt(actionList.Count - 1); } actionList.Add(action); action.execute(); actionIndex++; this.mainWindow.setUndoButton(true); this.mainWindow.setRedoButton(false); this.executingAction = false; }
public Args(string mask, bool resursive, ProgramAction action) { Mask = mask; Recursive = resursive; Action = action; }
public static bool CheckArguments(string[] args) { // show usage if no command line was given if (args == null || args.Length == 0) { Usage(String.Empty); return(false); } // // loop through all passed in arguments // for (int i = 0; i < args.Length; i++) { switch (args[i].ToUpperInvariant()) { // // action // case "-UPDATE": _action = ProgramAction.Update; break; case "-VERIFY": _action = ProgramAction.Verify; break; // // db // case "-DB": _xmlFileName = args[++i]; break; // // generic options // case "-MATCH": _matchPattern = args[++i]; break; case "-EXCLUDE": _excludePattern = args[++i]; break; case "-BASEPATH": _basePath = args[++i]; break; case "-R": case "-RECURSE": _recurse = true; break; // // path type // case "-RELATIVEPATH": _pathType = PathType.RelativePath; break; case "-FULLPATH": _pathType = PathType.FullPath; break; case "-FULLPATHNODRIVE": _pathType = PathType.FullPathNoDrive; break; // // checksum type // case "-MD5": _checksumType = ChecksumType.MD5; break; case "-SHA1": _checksumType = ChecksumType.SHA1; break; case "-SHA256": _checksumType = ChecksumType.SHA256; break; case "-SHA512": _checksumType = ChecksumType.SHA512; break; // // -verify options // case "-IGNOREMISSING": _verifyIgnoreMissing = true; break; case "-SHOWNEW": _verifyShowNew = true; break; case "-IGNORECHECKSUM": _verifyIgnoreChecksum = true; break; // // -update options // case "-REMOVEMISSING": _updateRemoveMissing = true; break; case "-IGNORENEW": _updateIgnoreNew = true; break; case "-PRETEND": _updatePretend = true; break; case "-UPDATEEXISTING": _updateExisting = true; break; default: Usage("Unknown argument: " + args[i]); return(false); } } return(true); }
public static void InputLoop() { while (true) { string command = Console.ReadLine().ToLower(); string[] splits = command.Split(' '); if (splits[0] == "action") { if (splits.Length >= 2) { if (splits[1] == "slave") { Action = ProgramAction.Action_PopSlave; } else if (splits[1] == "mix") { Action = ProgramAction.Action_PopSlaveThenApply; } else if (splits[1] == "full") { Action = ProgramAction.Action_Full; } } AddToConsole("ProgramAction is " + Action.ToString()); } else if (splits[0] == "start") { RenderTimer = 10000; if (splits.Length >= 2) { try { RenderTimer = Convert.ToInt16(splits[1]) * 1000; } catch { AddToConsole("Incorrect format."); continue; } } Logging.StartEmailLogLoop(5 * 60 * 1000); Status = ProgramStatus.Program_Idle; AddToConsole("AUTOCLAVE Started"); Cycle(); } else if (command == "slave") { if (Slave != null) { Slave.Close(); } Status = ProgramStatus.Program_Idle; Slave = new SequentialSlave(); Slave.Sequence = NumbersList; SystemSounds.Exclamation.Play(); Slave.ShowDialog(); NumbersList.Clear(); } else { AddToConsole("\'" + command + "\' not recognized."); } } }
/// <summary> /// Decode the given command-line arguments. /// </summary> public CommandLineArguments(IList <string> args) { for (int i = 0; i < args.Count; i++) { string arg = args[i]; if (arg[0] != '-') { Filenames.Add(arg); continue; } switch (arg[1]) { case 'v': Action = ProgramAction.Verify; break; case 'h': Action = ProgramAction.Help; break; case 'r': if (arg.Length <= 2) { if (i + 1 >= args.Count) { throw new ArgumentException("Missing pathname for root of website after \"-r\""); } RootPath = args[++i]; } else { RootPath = arg.Substring(2); } break; case 'w': if (arg.Length <= 2) { if (i + 1 >= args.Count) { throw new ArgumentException("Missing filename for \"website.dll\" after \"-w\""); } WebsiteDllFileName = args[++i]; } else { WebsiteDllFileName = arg.Substring(2); } break; case '-': switch (arg.Substring(2)) { case "verify": Action = ProgramAction.Verify; break; case "help": Action = ProgramAction.Help; break; case "root": if (i + 1 >= args.Count) { throw new ArgumentException("Missing pathname for root of website after \"--root\""); } RootPath = args[++i]; break; case "website": if (i + 1 >= args.Count) { throw new ArgumentException("Missing filename for \"website.dll\" after \"--website\""); } WebsiteDllFileName = args[++i]; break; case "verbose": Verbose = true; break; case "quiet": Quiet = true; break; } break; } } RootPath = Path.GetFullPath(RootPath); }
public Args(ProgramAction action) { Action = action; _onlyAction = true; }
public static bool CheckArguments(string[] args) { // show usage if no command line was given if (args == null || args.Length == 0) { Usage(String.Empty); return false; } // // loop through all passed in arguments // for (int i = 0; i < args.Length; i++) { switch (args[i].ToUpperInvariant()) { // // action // case "-UPDATE": _action = ProgramAction.Update; break; case "-VERIFY": _action = ProgramAction.Verify; break; // // db // case "-DB": _xmlFileName = args[++i]; break; // // generic options // case "-MATCH": _matchPattern = args[++i]; break; case "-EXCLUDE": _excludePattern = args[++i]; break; case "-BASEPATH": _basePath = args[++i]; break; case "-R": case "-RECURSE": _recurse = true; break; // // path type // case "-RELATIVEPATH": _pathType = PathType.RelativePath; break; case "-FULLPATH": _pathType = PathType.FullPath; break; case "-FULLPATHNODRIVE": _pathType = PathType.FullPathNoDrive; break; // // checksum type // case "-MD5": _checksumType = ChecksumType.MD5; break; case "-SHA1": _checksumType = ChecksumType.SHA1; break; case "-SHA256": _checksumType = ChecksumType.SHA256; break; case "-SHA512": _checksumType = ChecksumType.SHA512; break; // // -verify options // case "-IGNOREMISSING": _verifyIgnoreMissing = true; break; case "-SHOWNEW": _verifyShowNew = true; break; case "-IGNORECHECKSUM": _verifyIgnoreChecksum = true; break; // // -update options // case "-REMOVEMISSING": _updateRemoveMissing = true; break; case "-IGNORENEW": _updateIgnoreNew = true; break; case "-PRETEND": _updatePretend = true; break; default: Usage("Unknown argument: " + args[i]); return false; } } return true; }
public async static Task RunServerAtPort(string[] args, string[] urls, string pathToken, string pathFile, ProgramAction action) { host = CreateHostBuilder(args, urls, pathToken, pathFile, action).Build(); await host.StartAsync(); }
public static IHostBuilder CreateHostBuilder(string[] args, string[] urls, string pathToken, string pathFile, ProgramAction action) { var Dict = new Dictionary <string, string> { { "PathToken", pathToken }, { "PathFile", pathFile }, { "Action", action.ToString() } }; return(Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((hostingContext, config) => { config.AddInMemoryCollection(Dict); }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseWebRoot("wwwroot"); webBuilder.UseStartup <Startup>(); webBuilder.UseUrls(urls); })); }
private static bool SkipDueToOptimizations(ProgramSlot[] code, int funcIndex, int depth, ProgramAction action, FieldColor color) { // Rotation code optimization if ((action == ProgramAction.Left || action == ProgramAction.Right) && depth > 0) { // Do not use consequent opposite rotations with the same color if (code[depth - 1].Color == color && ((code[depth - 1].Action == ProgramAction.Left && action == ProgramAction.Right) || (code[depth - 1].Action == ProgramAction.Right && action == ProgramAction.Left))) { return true; } // Consequent rotation count optimization int i = depth - 1; int sameCount = 1; while (i >= 0 && code[i].Color == color && code[i].Action == action) { sameCount += 1; i -= 1; } // Max 2 rotations right and 1 rotation left if ((sameCount > 2 && action == ProgramAction.Right) || (sameCount > 1 && action == ProgramAction.Left)) return true; } // Recursion optimization - do not call function from itself in the first instruction if (depth == 0 && funcIndex == 0 && action == ProgramAction.F1 || depth == 0 && funcIndex == 1 && action == ProgramAction.F2 || depth == 0 && funcIndex == 2 && action == ProgramAction.F3 || depth == 0 && funcIndex == 3 && action == ProgramAction.F4 || depth == 0 && funcIndex == 4 && action == ProgramAction.F5) { return true; } return false; }
public ActionNode SetAction(ProgramAction action) { Action = action; return(this); }
private static bool SkipDueToOptimizations(ProgramSlot[] code, int funcIndex, int depth, ProgramAction action, FieldColor color) { // Rotation code optimization if ((action == ProgramAction.Left || action == ProgramAction.Right) && depth > 0) { // Do not use consequent opposite rotations with the same color if (code[depth - 1].Color == color && ((code[depth - 1].Action == ProgramAction.Left && action == ProgramAction.Right) || (code[depth - 1].Action == ProgramAction.Right && action == ProgramAction.Left))) { return(true); } // Consequent rotation count optimization int i = depth - 1; int sameCount = 1; while (i >= 0 && code[i].Color == color && code[i].Action == action) { sameCount += 1; i -= 1; } // Max 2 rotations right and 1 rotation left if ((sameCount > 2 && action == ProgramAction.Right) || (sameCount > 1 && action == ProgramAction.Left)) { return(true); } } // Recursion optimization - do not call function from itself in the first instruction if (depth == 0 && funcIndex == 0 && action == ProgramAction.F1 || depth == 0 && funcIndex == 1 && action == ProgramAction.F2 || depth == 0 && funcIndex == 2 && action == ProgramAction.F3 || depth == 0 && funcIndex == 3 && action == ProgramAction.F4 || depth == 0 && funcIndex == 4 && action == ProgramAction.F5) { return(true); } return(false); }