private async Task Zoom(MouseEventArgs e, Common.Direction direction) { switch (e.Type) { case "mousedown": await CameraService.Zoom(1, direction); break; default: await CameraService.Zoom(1, Common.Direction.Stop); break; } }
private async Task PanTilt(MouseEventArgs e, Common.Direction panDirection, Common.Direction tiltDirection) { switch (e.Type) { case "mousedown": await CameraService.PanTilt(1, panDirection, tiltDirection); break; default: await CameraService.PanTilt(1, Common.Direction.Stop, Common.Direction.Stop); break; } }
public TfmPreviewFolderWBGWorker( String Dir, Common.FolderType Folder = Common.FolderType.None, Common.Gender Gender = Common.Gender.None, Common.Direction Direction = Common.Direction.None, bool CropImage = false, bool SleepThread = true, Common.OfficialMirType OfficialMirType = Common.OfficialMirType.None) { InitializeComponent(); // Cast signature variables to shared variables _dir = Dir; lbDirectory.Caption = _dir; _folder = Folder; _gender = Gender; _direction = Direction; _cropImage = CropImage; _sleepThread = SleepThread; _officialMirType = OfficialMirType; // Log output listLog.Items.Add(string.Format("<b>[{0}]</b> Process started.", DateTime.Now, _dir)); listLog.Items.Add(string.Format("Directory: <color=blue>{0}</color>", _dir)); listLog.Items.Add(string.Format("Folder Type: <color=blue>{0}</color> Gender: <color=blue>{1}</color> Direction: <color=blue>{2}</color> Official Mir Type: <color=blue>{3}</color>", _folder.ToString(), _gender.ToString(), Direction.ToString(), _officialMirType.ToString())); listLog.Items.Add(string.Format("Crop Images: <color=red>{0}</color> Sleep Thread: <color=red>{1}</color>", _cropImage.ToString(), _sleepThread.ToString())); listLog.TopIndex = listLog.Items.Count - 1; // Decide to load structured format or generic if (_folder != Common.FolderType.None && _folder != Common.FolderType.Data) { FilesCount = (ushort)Directory.GetFiles(_dir).Length; } else { Files.AddRange(Directory.GetFiles(_dir)); } // Start the asynchronous operation. if (backgroundWorker1.IsBusy != true) { startTime = DateTime.Now; // Log time for time taken log backgroundWorker1.RunWorkerAsync(); } GC.Collect(); }
/// <summary> /// Recursive function to populate the reachable basic blocks list. /// </summary> /// <param name="actual">Actual BasicBlock to start from (exclusive)</param> /// <param name="direction">The direction to go to while collecting reachable basic blocks</param> private static void recursive(BasicBlock actual, Common.Direction direction) { DoneIDs.Add(actual.ID); //If it's not the last or the first basic block, then we add then to the list //Both had to be out of the list to avoid problems during data analysis if (actual.getPredecessors.Count > 0 && actual.getSuccessors.Count > 0) { ReachableBasicBlocks.Add(actual); } List <BasicBlock> bblist = (direction == Common.Direction.Up) ? actual.getPredecessors : actual.getSuccessors; foreach (BasicBlock block in bblist) { if (!DoneIDs.Contains(block.ID)) { recursive(block, direction); } } }
/// <summary> /// Function to get all the reachable basic blocks by the actual basic block. /// </summary> /// <param name="actual">Actual BasicBlock to start from (exclusive)</param> /// <param name="direction">The direction to go to while collecting reachable basic blocks</param> public static List <BasicBlock> GetReachableBasicBlocks(BasicBlock actual, Common.Direction direction) { /* * Cleaning the done_ids and reachable_basic_blocks lists, so they won't be influenced by the algorithm's * previous runs (if these exist). */ DoneIDs.Clear(); ReachableBasicBlocks.Clear(); /* * Populating the list */ recursive(actual, direction); ReachableBasicBlocks = ReachableBasicBlocks.Distinct().ToList(); ReachableBasicBlocks.Remove(actual); /* * In the end we clear the done_ids list, so it won't influence the algorithm's * future runs (if these will exist). */ DoneIDs.Clear(); return(ReachableBasicBlocks); }
private void btnPreview_Click(object sender, EventArgs e) { // Error handle if (tbDir.Text.Length == 0) { MessageBox.Show("Please select a valid folder."); return; } if (cbType.Text == string.Empty) { MessageBox.Show("Please select a valid folder type"); return; } LibraryFolder = tbDir.Text; FolderType = (Common.FolderType)Enum.Parse(typeof(Common.FolderType), cbType.Text); Gender = (Common.Gender)radioGender.EditValue; Direction = (Common.Direction)radioDirection.EditValue; CropImage = (cbListAdditional.Items[0].CheckState == CheckState.Checked) ? true : false; SleepThread = (cbListAdditional.Items[1].CheckState == CheckState.Checked) ? true : false; ReturnType = Common.ReturnTye.Preview; this.Close(); }
public override void LoadFromXml(XmlTextReader xmlIn) { // Grab the expected attributes string rawCount = xmlIn.GetAttribute(0); string rawUnique = xmlIn.GetAttribute(1); string rawSpace = xmlIn.GetAttribute(2); string rawDirection = xmlIn.GetAttribute(3); // Convert to correct types int count = Convert.ToInt32(rawCount); int unique = Convert.ToInt32(rawUnique); Decimal space = Convert.ToDecimal(rawSpace); Common.Direction direction = (rawDirection == "Horizontal" ? Common.Direction.Horizontal : Common.Direction.Vertical); // Update myself with new values _unique = unique; _space = space; _direction = direction; // Load each of the children for (int i = 0; i < count; i++) { // Read the next Element if (!xmlIn.Read()) { throw new ArgumentException("An element was expected but could not be read in"); } TabGroupBase newElement = null; // Is it another sequence? if (xmlIn.Name == "Sequence") { newElement = new TabGroupSequence(_tabbedGroups, this); } else if (xmlIn.Name == "Leaf") { newElement = new TabGroupLeaf(_tabbedGroups, this); } else { throw new ArgumentException("Unknown element was encountered"); } bool expectEndElement = !xmlIn.IsEmptyElement; // Load its config newElement.LoadFromXml(xmlIn); // Add new element to the collection Add(newElement); // Do we expect and end element to occur? if (expectEndElement) { // Move past the end element if (!xmlIn.Read()) { throw new ArgumentException("Could not read in next expected node"); } // Check it has the expected name if (xmlIn.NodeType != XmlNodeType.EndElement) { throw new ArgumentException("EndElement expected but not found"); } } } }
public bool Move(PuzzleConsole.Common.Direction inDirection) { //First turn the actor in the desired direction Direction = inDirection; //And then move if it's possible if (canMove(inDirection)) { Point oldLocation = Location; Location = Location.Add( PuzzleConsole.Common.DirectionToPointOffset(inDirection) ); //Then tell the layer I'm on where I moved to //remove from old location Layer.Actors[oldLocation.Y][oldLocation.X] = new Empty(); //insert into new location Layer.Actors[Location.Y][Location.X] = this; return true; } else { return false; } }
public MoveAction(Command command, Common.Direction direction) : base(command) { this.Direction = direction; }
public Rover(int xCoordinate, int yCoordinate, Common.Direction direction) { this.XCoordinate = xCoordinate; this.YCoordinate = yCoordinate; this.RoverDirection = direction; }
public TfmPreviewFolder(String Dir, Common.FolderType Folder = Common.FolderType.None, Common.Gender Gender = Common.Gender.None, Common.Direction Direction = Common.Direction.None) { InitializeComponent(); backgroundWorker1.WorkerReportsProgress = true; backgroundWorker1.WorkerSupportsCancellation = true; if (backgroundWorker1.IsBusy != true) { // Start the asynchronous operation. backgroundWorker1.RunWorkerAsync(); } FilesCount = (ushort)Directory.GetFiles(Dir).Length; // Files = Directory.GetFiles(Dir); for (int i = 0; i < FilesCount; i++) { try { //if (Files[i].EndsWith(".LIB", StringComparison.OrdinalIgnoreCase)) //{ _tempLibrary = new FileStructures.MLibraryV2(Dir + "//" + i.ToString("00") + ".Lib"); switch (Folder) { case Common.FolderType.None: // TODO: Add break; case Common.FolderType.CHumEffect: switch (Gender) { case Common.Gender.None: //string.Format("Library: {0}.Lib\r\nDatabase Effect Number: {1}", i.ToString("00"), (i+1).ToString("00")); ImageListBox.Items.Add(new ImageListBoxItem(null, string.Format("Library: {0}.Lib\r\nDatabase Effect Number: {1}", i.ToString("00"), (i + 1).ToString("00")), i, "", _tempLibrary.Images[0 + ((byte)Direction * 8)].Image)); break; case Common.Gender.Male: ImageListBox.Items.Add(new ImageListBoxItem(null, string.Format("Library: {0}.Lib\r\nDatabase Effect Number: {1}\r\nGender: Male", i.ToString("00"), (i + 1).ToString("00")), i, "", _tempLibrary.Images[0 + ((byte)Direction * 8)].Image)); break; case Common.Gender.Female: ImageListBox.Items.Add(new ImageListBoxItem(null, string.Format("Library: {0}.Lib\r\nDatabase Effect Number: {1}\r\nGender: Female", i.ToString("00"), (i + 1).ToString("00")), i, "", _tempLibrary.Images[0 + ((byte)Direction * 8) + ArmourOffset].Image)); break; case Common.Gender.Both: ImageListBox.Items.Add(new ImageListBoxItem(null, string.Format("Library: {0}.Lib\r\nDatabase Effect Number: {1}\r\nGender: Male", i.ToString("00"), (i + 1).ToString("00")), i, "", _tempLibrary.Images[0 + ((byte)Direction * 8)].Image)); ImageListBox.Items.Add(new ImageListBoxItem(null, string.Format("Library: {0}.Lib\r\nDatabase Effect Number: {1}\r\nGender: Female", i.ToString("00"), (i + 1).ToString("00")), i, "", _tempLibrary.Images[0 + ((byte)Direction * 8) + ArmourOffset].Image)); break; default: break; } break; case Common.FolderType.CArmour: switch (Gender) { case Common.Gender.None: ImageListBox.Items.Add(new ImageListBoxItem(null, "Library: " + i.ToString("00") + ".Lib", i, "", _tempLibrary.Images[0 + ((byte)Direction * 4)].Image)); break; case Common.Gender.Male: ImageListBox.Items.Add(new ImageListBoxItem(null, "Library: " + i.ToString("00") + ".Lib" + "\r\nGender: Male", i, "", _tempLibrary.Images[0 + ((byte)Direction * 4)].Image)); break; case Common.Gender.Female: ImageListBox.Items.Add(new ImageListBoxItem(null, "Library: " + i.ToString("00") + ".Lib" + "\r\nGender: Female", i, "", _tempLibrary.Images[0 + ((byte)Direction * 4) + ArmourOffset].Image)); break; case Common.Gender.Both: ImageListBox.Items.Add(new ImageListBoxItem(null, "Library: " + i.ToString("00") + ".Lib" + "\r\nGender: Male", i, "", _tempLibrary.Images[0 + ((byte)Direction * 4)].Image)); ImageListBox.Items.Add(new ImageListBoxItem(null, "Library: " + i.ToString("00") + ".Lib" + "\r\nGender: Female", i, "", _tempLibrary.Images[0 + ((byte)Direction * 4) + ArmourOffset].Image)); break; default: break; } break; case Common.FolderType.CWeapon: // TODO: Add break; case Common.FolderType.CShields: // TODO: Add break; case Common.FolderType.CWeaponEffect: // TODO: Add break; case Common.FolderType.AArmour: // TODO: Add break; case Common.FolderType.AHumEffect: // TODO: Add break; case Common.FolderType.AWeapon: // TODO: Add break; case Common.FolderType.AWeaponEffect: // TODO: Add break; case Common.FolderType.ARArmour: // TODO: Add break; case Common.FolderType.ARHumEffect: // TODO: Add break; case Common.FolderType.ARWeapon: // TODO: Add break; case Common.FolderType.ARWeaponEffect: // TODO: Add break; case Common.FolderType.NPC: ImageListBox.Items.Add(new ImageListBoxItem(null, "Library: " + i.ToString("00") + ".Lib", i, i.ToString("00"), Functions.CropImage.CropTransparent(_tempLibrary.Images[0].Image).Image)); break; default: break; } //} } catch (Exception ex) { //ErrorFiles.Add(Files[i]); continue; } finally { if (ErrorFiles.Count > 0) { MessageBox.Show(ErrorFiles.ToString()); } } GC.Collect(); } this.Text += " " + ImageListBox.Items.Count.ToString(); }