示例#1
0
		public UIElement UIElementConstruct(
			Bib3.OrtogoonInt Region)
		{
			lock (Lock)
			{
				return new UIElement(new BotEngine.ObjectIdInt64(UIElementIdNext++), Region);
			}
		}
示例#2
0
		public MotionResult ActSequenceMotion(IEnumerable<Motion> seqMotion)
		{
			try
			{
				if (null == seqMotion)
					return null;

				var InputSimulator = new WindowsInput.InputSimulator();

				foreach (var Motion in seqMotion.WhereNotDefault())
				{
					var MotionMousePosition = Motion?.MousePosition;
					var MotionTextEntry = Motion?.TextEntry;
					var mouseLocationOnScreen = MotionMousePosition.HasValue ? WindowHandle.ClientToScreen(MotionMousePosition.Value) + MouseOffsetStatic : null;

					if (mouseLocationOnScreen.HasValue || (Motion.WindowToForeground ?? false))
						EnsureWindowIsForeground();

					if (mouseLocationOnScreen.HasValue)
					{
						User32.SetCursorPos((int)mouseLocationOnScreen.Value.A, (int)mouseLocationOnScreen.Value.B);

						Thread.Sleep(MouseEventTimeDistanceMilli);
					}

					var mouseSetAction = new[]
					{
						Motion?.MouseButtonDown?.Select(button => new KeyValuePair<MouseButtonIdEnum, bool>(button, true)),
						Motion?.MouseButtonUp?.Select(button => new KeyValuePair<MouseButtonIdEnum, bool>(button, false)),
					}.ConcatNullable().ToArray();

					if (0 < mouseSetAction?.Length)
					{
						foreach (var mouseAction in mouseSetAction)
							mouseActionFromButtonIdAndState?.TryGetValueOrDefault(mouseAction)?.Invoke(InputSimulator.Mouse);

						Thread.Sleep(MouseEventTimeDistanceMilli);
					}

					Motion?.KeyDown?.ForEach(keyDown =>
					{
						EnsureWindowIsForeground();
						InputSimulator.Keyboard.KeyDown(keyDown);
						Thread.Sleep(KeyboardEventTimeDistanceMilli);
					});

					Motion?.KeyUp?.ForEach(keyUp =>
					{
						EnsureWindowIsForeground();
						InputSimulator.Keyboard.KeyUp(keyUp);
						Thread.Sleep(KeyboardEventTimeDistanceMilli);
					});

					if (0 < MotionTextEntry?.Length)
					{
						EnsureWindowIsForeground();
						InputSimulator.Keyboard.TextEntry(MotionTextEntry);
					}
				}

				return new MotionResult(true);
			}
			catch (Exception Exception)
			{
				return new MotionResult(Exception);
			}
		}
		public void Accumulate(FromProcessMeasurement<SensorRaw.MemoryMeasurement> FromProcessMemoryMeasurement)
		{
			if (null == FromProcessMemoryMeasurement)
			{
				return;
			}

			var Time = FromProcessMemoryMeasurement.Ende;

			var TargetDistanceMax =
				FromProcessMemoryMeasurement?.Wert?.Target?.Select(Target => Target.DistanceMin())
				?.WhereNotNullSelectValue()
				?.MaxNullable();

			var OverviewEntryAndMenu = FromProcessMemoryMeasurement?.Wert?.OverviewEntryMenu();

			var OverviewEntryMenuFirst = OverviewEntryAndMenu?.Value?.FirstOrDefault();

			var OverviewEntryMenuContainsEntryLock = null != (OverviewEntryMenuFirst?.EntryLock() ?? OverviewEntryMenuFirst?.EntryUnlock());

			Int64? UpperBoundFromOverviewEntry = null;
			Int64? LowerBoundFromOverviewEntry = null;

			if (OverviewEntryMenuContainsEntryLock)
			{
				LowerBoundFromOverviewEntry = OverviewEntryAndMenu?.Key?.DistanceMin();
			}
			else
			{
				UpperBoundFromOverviewEntry = OverviewEntryAndMenu?.Key?.DistanceMin();
			}

			if (UpperBoundFromOverviewEntry < TargetDistanceMax)
			{
				UpperBoundFromOverviewEntry = null;
			}

			var MeasurementLowerBound =
				new[] { TargetDistanceMax, LowerBoundFromOverviewEntry }
				?.WhereNotNullSelectValue()
				.MaxNullable();

			var MeasurementUpperBound = UpperBoundFromOverviewEntry;

			if (MeasurementLowerBound.HasValue)
			{
				ListMeasurementRangeBound.Enqueue(new MeasurementBound1DIntAtTime(MeasurementLowerBound.Value, false, Time));
			}

			if (MeasurementUpperBound.HasValue)
			{
				ListMeasurementRangeBound.Enqueue(new MeasurementBound1DIntAtTime(MeasurementUpperBound.Value, true, Time));
			}

			//	remove measurements older then 10 minutes.
			Bib3.Extension.DequeueEnumerator(ListMeasurementRangeBound, element => element.Time < Time - 1000 * 60 * 10);

			{
				var DriftNano = ((DriftBeginPercent * (int)1e+7) / DriftTimeToCross);

				var ListMeasurementRangeBoundDrifted =
					MappedDrift(ListMeasurementRangeBound, Time - DriftTimeToCross, DriftNano)
					?.ToArray();

				WertZuZaitpunktStruct<Int64>? LowerBound;
				WertZuZaitpunktStruct<Int64>? UpperBound;

				BoundComputeFromSetMeasuredBound(
					ListMeasurementRangeBoundDrifted,
					out LowerBound,
					out UpperBound,
					2);

				this.RangeMin = LowerBound?.Wert;
				this.RangeMax = UpperBound?.Wert;
			}
		}