/// <summary> /// Draws the border. /// </summary> /// <param name="rectangle">Rectangle to be used.</param> /// <param name="theme">The theme to be used.</param> /// <param name="blank">If the border should be drawn with the background color(blank).</param> private static void DrawBorder(Rectangle rectangle, Theme theme, bool blank = false) { if (Boundries.OutOfBounds(rectangle)) { throw new Exception("Out of bounds exception" + rectangle); } Console.ForegroundColor = blank?theme.Background:theme.Border; for (int x = 0; x <= rectangle.Width; x++) { Console.SetCursorPosition(rectangle.X + x, rectangle.Y); Console.Write(Unicode.BorderCodes.RECT_TOP); Console.SetCursorPosition(rectangle.X + x, rectangle.Y + rectangle.Height); Console.Write(Unicode.BorderCodes.RECT_BOTTOM); } for (int y = 0; y <= rectangle.Height; y++) { Console.SetCursorPosition(rectangle.X, rectangle.Y + y); Console.Write(Unicode.BorderCodes.RECT_LEFT); Console.SetCursorPosition(rectangle.X + rectangle.Width, rectangle.Y + y); Console.Write(Unicode.BorderCodes.RECT_RIGHT); } }
void Start() { _rigidBody = GetComponent <Rigidbody>(); _shotSound = GetComponent <AudioSource>(); boundries = new Boundries(); var gameObjectNoShootText = GameObject.FindWithTag("NoShootsText"); if (gameObjectNoShootText == null) { Debug.Log("Cannot find 'shoots ' gameObject"); } else { _nrOfShootsText = gameObjectNoShootText.GetComponent <Text>(); } var gameController = GameObject.FindWithTag("GameController"); if (gameController == null) { Debug.Log("Cannot find 'GameController' gameObject"); } else { _gameController = gameController.GetComponent <GameController>(); _shootArea = _gameController.ShootArea; } }
/// <summary> /// Draws the background. /// </summary> /// <param name="rectangle">Rectangle to be used.</param> /// <param name="theme">The theme to be used.</param> private static void DrawBackground(Rectangle rectangle, Theme theme) { if (Boundries.OutOfBounds(rectangle)) { throw new Exception("Out of bounds exception: " + rectangle); } for (int y = 0; y < rectangle.Height; y++) { for (int x = 0; x < rectangle.Width; x++) { Console.SetCursorPosition(rectangle.X + x, rectangle.Y + y); Console.BackgroundColor = theme.Background; Console.Write(" "); } } }
public bool IsOutOfBounds(Coordinate coordinate) { return(Boundries.OutOfBounds(coordinate.x, coordinate.y, _bounds)); }
/// <summary> /// Constructor /// </summary> /// <param name="Input">Body text</param> /// <param name="Header">Header of the message</param> public MIMEBody(string Input, MIMEHeader Header) { if (string.IsNullOrEmpty(Input)) { throw new ArgumentNullException("Input can not be null"); } MediaEnum ContentType; ContentType = GetMediaType(Header); if (MediaEnum.MEDIA_MULTIPART == ContentType) { string CurrentBoundry = GetBoundryMarker(Header); if (string.IsNullOrEmpty(CurrentBoundry)) { return; } CurrentBoundry = CurrentBoundry.Replace("\"", ""); string BoundryStart = "--" + CurrentBoundry; string BoundryEnd = BoundryStart + "--"; int StartIndex = Input.IndexOf(BoundryStart, 0); if (StartIndex == -1) { return; } int EndIndex = Input.IndexOf(BoundryEnd, 0); if (EndIndex == -1) { EndIndex = Input.Length; } Content = Input.Substring(0, StartIndex); while (StartIndex < EndIndex) { StartIndex += BoundryStart.Length + 2; if (StartIndex >= EndIndex) { break; } int TempIndex = Input.IndexOf(BoundryStart, StartIndex); if (TempIndex != -1) { Boundries.Add(new MIMEMessage(Input.Substring(StartIndex, TempIndex - StartIndex))); } else { break; } StartIndex = TempIndex; } } else { Content = Input; } string Encoding = ""; try { Encoding = Header[Constants.TransferEncoding].Attributes[0].Value; } catch { Encoding = Constants.Encoding7Bit; } Code CodeUsing = CodeManager.Instance[Encoding]; CodeUsing.CharacterSet = Header[Constants.ContentType][Constants.Charset]; CodeUsing.Decode(Content, out _Content); }
public ITrackedVideo GetData() { ITrackedVideo trackedVideo = ModelResolver.Resolve <ITrackedVideo>(); trackedVideo.FileName = FileName; trackedVideo.Result = Result; trackedVideo.SmoothMotion = SmoothMotion; //trackedVideo.SmoothFactor = SmoothFactor; trackedVideo.FrameRate = FrameRate; trackedVideo.CentroidSize = CentroidSize; trackedVideo.PelvicArea1 = PelvicArea1; trackedVideo.PelvicArea2 = PelvicArea2; trackedVideo.PelvicArea3 = PelvicArea3; trackedVideo.PelvicArea4 = PelvicArea4; trackedVideo.UnitsToMilimeters = UnitsToMilimeters; trackedVideo.Message = Message; if (Results != null) { Dictionary <int, SingleFrameResultXml> headPoints = Results.GetData(); Dictionary <int, ISingleFrameResult> finalResults = new Dictionary <int, ISingleFrameResult>(); foreach (var entry in headPoints) { int key = entry.Key; SingleFrameResultXml currentEntry = entry.Value; if (currentEntry == null) { finalResults.Add(key, null); } else { finalResults.Add(key, currentEntry.GetData()); } } trackedVideo.Results = finalResults; } //if (WaistSizes != null) //{ // trackedVideo.WaistSizes = WaistSizes.GetData(); //} if (MotionTrack != null) { trackedVideo.MotionTrack = MotionTrack.Select(x => x.GetPoint()).ToArray(); } if (SmoothedMotionTrack != null) { trackedVideo.SmoothedMotionTrack = SmoothedMotionTrack.Select(x => x.GetPoint()).ToArray(); } if (OrientationTrack != null) { trackedVideo.OrientationTrack = OrientationTrack.Select(x => x.GetVector()).ToArray(); } if (Boundries != null) { trackedVideo.Boundries = Boundries.Select(x => x.GetBoundary()).ToArray(); } if (Events != null) { trackedVideo.Events = Events.Select(x => x.GetData()).ToArray(); } if (InteractingBoundries != null) { trackedVideo.InteractingBoundries = InteractingBoundries.GetData().ToDictionary(kvp => kvp.Key.GetBoundary(), kvp => kvp.Value.Select(x => x.GetData()).ToArray()); } trackedVideo.MinInteractionDistance = MinInteractionDistance; trackedVideo.GapDistance = GapDistance; trackedVideo.ThresholdValue = ThresholdValue; trackedVideo.ThresholdValue2 = ThresholdValue2; trackedVideo.StartFrame = StartFrame; trackedVideo.EndFrame = EndFrame; trackedVideo.UnitsToMilimeters = UnitsToMilimeters; trackedVideo.UpdateTrack(); return(trackedVideo); }