Пример #1
0
        private void runTick(BotEngine.Interface.FromProcessMeasurement <IMemoryMeasurement> eveMemory)
        {
            var ContextMenu           = eveMemory?.Value?.Menu?.FirstOrDefault();
            var ContextMenuFirstEntry = ContextMenu?.Entry?.FirstOrDefault();

            //var version = _jsContext.Execute("(function() { var res = null; require(['sanderling-v8/v8/interface/Espresso'], function(EspressoV8Interface) { res = EspressoV8Interface.singleton().onTick(); } ); return res; })();");
        }
Пример #2
0
        /// <summary>
        /// </summary>
        /// <param name="Measurement">contains the structures read from the eve online client process memory.</param>
        static public void MeasurementReceived(BotEngine.Interface.FromProcessMeasurement <IMemoryMeasurement> Measurement)
        {
            Console.WriteLine("\nMeasurement received");
            Console.WriteLine("measurement time: " + ((Measurement?.End)?.ToString("### ### ### ### ###")?.Trim() ?? "null"));

            var ListUIElement =
                Measurement?.Value?.EnumerateReferencedUIElementTransitive()
                ?.GroupBy(UIElement => UIElement.Id)
                ?.Select(Group => Group?.FirstOrDefault())
                ?.ToArray();

            Console.WriteLine("number of UI elements in measurement: " + (ListUIElement?.Length.ToString() ?? "null"));

            var ContextMenu = Measurement?.Value?.Menu?.FirstOrDefault();

            var ContextMenuFirstEntry = ContextMenu?.Entry?.FirstOrDefault();

            if (null == ContextMenuFirstEntry)
            {
                Console.WriteLine("no contextmenu open");
            }
            else
            {
                var Center = ContextMenuFirstEntry.Region.Center();

                Console.WriteLine("contextmenu first entry : label: \"" + (ContextMenuFirstEntry?.Text ?? "null") + "\", center location : " +
                                  Center.A.ToString() + ", " + Center.B.ToString());
            }
        }
Пример #3
0
        public static void MeasurementReceived(BotEngine.Interface.FromProcessMeasurement <IMemoryMeasurement> measurement)
        {
            //Console.WriteLine("\nMeasurement received");
            // Console.WriteLine("measurement time: " + ((measurement?.End)?.ToString("### ### ### ### ###")?.Trim() ?? "null"));

            var ListUIElement =
                measurement?.Value?.EnumerateReferencedUIElementTransitive()
                ?.GroupBy(uiElement => uiElement.Id)
                ?.Select(group => group?.FirstOrDefault())
                ?.ToArray();



            var    overview     = measurement.Value.WindowOverview.First();
            var    entry        = overview.ListView.Entry.Where(x => x.LabelText.ElementAt(2).Text.Contains("Wormhole"));
            var    work         = entry.First().LabelText;
            string ToSearch     = entry.First().LabelText.ElementAt(2).Text.Split(' ')[1];
            var    SelectedItem = measurement.Value.WindowSelectedItemView.FirstOrDefault();
            var    labelText    = SelectedItem.LabelText.Last();

            //Sanderling.Motor.MotionParamExtension.MouseMove(labelText, new[] { BotEngine.Motor.MouseButtonIdEnum.Left });
            //labelText.Dump();


            return;
        }
Пример #4
0
        public void MeasurementReceived(BotEngine.Interface.FromProcessMeasurement <IMemoryMeasurement> measurement)
        {
            InputSimulator sim      = new InputSimulator();
            var            overview = measurement?.Value.WindowOverview.FirstOrDefault();
            var            entry    = overview.ListView.Entry.First(x =>
                                                                    Regex.IsMatch(x.LabelText.ElementAt(2).Text, @"Wormhole [A-Z]"));
            string toSearch    = entry.LabelText.ElementAt(2).Text.Split(' ')[1];
            string Hole        = (toSearch.Contains("K162")) ? "UNK" : Worm.GetHole(toSearch);
            var    scanResults = measurement?.Value.WindowProbeScanner.First().ScanResultView.Entry.FirstOrDefault();
            string scanID      = scanResults?.LabelText.ElementAt(1).Text.Substring(0, 3);

            if (Regex.IsMatch(Hole, @"Barbican|Conflux|Redoubt|Sentinel|Vidette"))
            {
                scanID = "Drifter";
            }
            ClipString = string.Format(ClipString, scanID, Hole);
            bool isEol = false;

            if (Hole.Contains("UNK"))
            {
                var motor = new WindowMotor(EveMainWindow.Value);
                ShowInfo(overview.ListView.Entry.First(x => Regex.IsMatch(x.LabelText.ElementAt(2).Text, @"Wormhole [A-Z]")), measurement);
                //ShowInfo(overview.ListView.Entry.FirstOrDefault(x => x.LabelText.ElementAt(2).Text.Contains("Wormhole")),measurement);
                Sanderling.Interface.FromInterfaceResponse response = null;
                do
                {
                    response = sensor?.MeasurementTakeNewRequest(EveClientId.Value);
                } while (null == response);

                var InfoWindow =
                    response.MemoryMeasurement?.Value.WindowOther.First(x => x.Caption.Contains("formation"));
                SelectAndCopy(sim, InfoWindow);

                ClipString = string.Format(ClipString, scanID, Hole);//, Extensions.Julian4());
                bool isEOL = false;

                var results = Classify(ClipString, out isEOL);

                string Name = (string.IsNullOrEmpty(results)) ? ClipString : results;
                Name += ((isEOL) ? " eol" + Extensions.Julian4() : Extensions.Julian4());
                BookmarkByOverview(Name);
                ///// Use this as a way of saying my program is done reset the
                ///// ScanHelper program foreground

                //Thread.Sleep(50);
                //SetForegroundWindow(new System.Windows.Interop.WindowInteropHelper(App.Current.MainWindow).Handle);
                //   App.Current.MainWindow.Close();
            }
            BookmarkByOverview(ClipString + Extensions.Julian4());
        }
Пример #5
0
        static void SampleRun()
        {
            Console.WriteLine("this Programm reads the memory of the eve online client process.");
            Console.WriteLine("start an eve online client and login to your account. Then press any key to continue.\n");
            Console.ReadKey();

            var Config = Extension.ConfigReadFromConsole();

            if (null == Config)
            {
                Console.WriteLine("reading config failed.");
                return;
            }

            var LicenseClient = new BotEngine.Interface.LicenseClient()
            {
                ServerAddress = Config.LicenseServerAddress, LicenseKey = Config.LicenseKey
            };

            Console.WriteLine();
            Console.WriteLine("connecting to " + (LicenseClient?.ServerAddress ?? "") + " using Key \"" + (LicenseClient?.LicenseKey ?? "") + "\" ....");

            while (!LicenseClient.AuthCompleted)
            {
                LicenseClient.ExchangeAuth();

                Thread.Sleep(1111);
            }

            var AuthResult = LicenseClient?.ExchangeAuthLast?.Value?.Response;

            var LicenseServerSessionId = AuthResult?.SessionId;

            Console.WriteLine("Auth completed, SessionId = " + (LicenseServerSessionId ?? "null"));

            Console.WriteLine("\nstarting to set up the sensor and read from memory.\nthe initial measurement takes longer.");

            var SensorAppManager = new BotEngine.Interface.InterfaceAppManager();

            var SensorServerHub = new SimpleSensorServerDispatcher()
            {
                SensorAppManager = SensorAppManager, LicenseClient = LicenseClient
            };

            BotEngine.Interface.FromProcessMeasurement <IMemoryMeasurement> MeasurementMemoryReceivedLast = null;

            while (true)
            {
                try
                {
                    //	Limit the frequency of measurements.
                    var RequestedMeasurementTime =
                        (MeasurementMemoryReceivedLast?.Begin + MeasurementTimeDistanceMin) ??
                        Bib3.Glob.StopwatchZaitMiliSictInt();

                    //	not specifying a subset to read, the sensor will simply read all available (types in MemoryStruct namespace) structures from memory.
                    SensorServerHub.Exchange(
                        Config.EveOnlineClientProcessId,
                        RequestedMeasurementTime,
                        Measurement =>
                    {
                        MeasurementMemoryReceivedLast = Measurement;
                        MeasurementReceived(Measurement);
                    });
                }
                finally
                {
                    Thread.Sleep(250);
                }
            }
        }
        private void MainWindow_SimulateMeasurement(Interface.MemoryStruct.IMemoryMeasurement measurement)
        {
            var time = GetTimeStopwatch();

            MemoryMeasurementLast = new BotEngine.Interface.FromProcessMeasurement <Interface.MemoryStruct.IMemoryMeasurement>(measurement, time, time);
        }
		public void Exchange(
			int? EveOnlineClientProcessId,
			Int64 RequestedMeasurementTime,
			Action<BotEngine.Interface.FromProcessMeasurement<MemoryStruct.IMemoryMeasurement>> CallbackMeasurementMemoryNew)
		{
			BotEngine.Interface.FromProcessMeasurement<MemoryStruct.IMemoryMeasurement> MeasurementMemoryNew = null;

			lock (Lock)
			{
				var Time = Bib3.Glob.StopwatchZaitMiliSictInt();

				var ServerExchangeLastAge = Time - ServerExchangeLastTime;

				if (ServerExchangeTimeDistanceMin <= ServerExchangeLastAge)
				{
					if (LicenseClient?.AuthCompleted ?? false)
					{
						ServerExchangeLastTime = Time;

						var LicenseServerSessionId = LicenseClient?.ExchangeAuthLast?.Value?.Response?.SessionId;

						var ToServerMessage = new BotEngine.Interface.FromClientToServerMessage()
						{
							SessionId = LicenseServerSessionId,
							Interface = SensorAppManager?.ToServer(),
							Time = Bib3.Glob.StopwatchZaitMiliSictInt(),
						};

						var FromServerMessage = LicenseClient?.ExchangePayload(ToServerMessage);

						if (null != FromServerMessage)
						{
							SensorAppManager.FromServer(FromServerMessage.Interface);
						}
					}
					else
					{
						LicenseClient?.ExchangeAuth();
					}
				}

				var MeasurementMemoryReceivedLastTime = MeasurementMemoryReceivedLast?.End;

				var ToSensorMessage = new FromConsumerToSensorMessage()
				{
					RequestedMeasurementProcessId = EveOnlineClientProcessId,
					MeasurementMemoryRequestTime = RequestedMeasurementTime,
					MeasurementMemoryReceivedLastTime = MeasurementMemoryReceivedLastTime,
				};

				var FromSensorAppMessage = SensorAppManager?.ConsumerExchange(new BotEngine.Interface.FromConsumerToInterfaceProxyMessage()
				{
					AppSpecific = ToSensorMessage.SerializeSingleBib3RefNezDifProtobuf(),
				});

				if (null == FromSensorAppMessage)
				{
					return;
				}

				var FromSensorAppMessagePortionAppSpecific = FromSensorAppMessage.AppSpecific;

				var SensorMessageEveOnline =
					FromSensorAppMessagePortionAppSpecific.DeSerializeProtobufBib3RefNezDif()?.FirstOrDefault() as FromSensorToConsumerMessage;

				var MeasurementMemory = SensorMessageEveOnline?.MemoryMeasurement;

				if (null == MeasurementMemory)
				{
					return;
				}

				if (MeasurementMemory?.End == MeasurementMemoryReceivedLast?.End)
				{
					return;
				}

				MeasurementMemoryReceivedLast = MeasurementMemory;

				MeasurementMemoryNew = MeasurementMemory;
			}

			if (null != MeasurementMemoryNew)
			{
				CallbackMeasurementMemoryNew?.Invoke(MeasurementMemoryNew);
			}
		}
Пример #8
0
        public void MeasurementReceived(BotEngine.Interface.FromProcessMeasurement <IMemoryMeasurement> measurement)
        {
            var ListUIElement =
                measurement?.Value?.EnumerateReferencedUIElementTransitive()
                ?.GroupBy(uiElement => uiElement.Id)
                ?.Select(group => group?.FirstOrDefault())
                ?.ToArray();

            //Classify("K346");
            //return;
            var    overview = measurement.Value.WindowOverview.First();
            var    entry    = overview.ListView.Entry.Where(x => x.LabelText.ElementAt(2).Text.Contains("Wormhole"));
            var    work     = entry.First().LabelText;
            string ToSearch = entry.First().LabelText.ElementAt(2).Text.Split(' ')[1];
            string Hole     = string.Empty;

            Hole = (ToSearch.Contains("K162")) ? "UNK" : WormLib.Worm.GetHole(ToSearch);
            var    ScanResult = measurement.Value.WindowProbeScanner.First().ScanResultView.Entry.First();
            string ID         = ScanResult?.LabelText.ElementAt(1).Text.Substring(0, 3);
            string ClipString = "{0} {1}";

            ClipString = string.Format(ClipString, ID, Hole);
            RunAsStaThread(() => { Clipboard.SetText(ClipString); });

            if (Hole.Equals("UNK"))
            {
                textBox1.Text = Classify(ClipString);
                RunAsStaThread(() => { Clipboard.SetText(textBox1.Text); });
            }
            else
            {
                textBox1.Text = ClipString;
            }
            //{
            //var id = Process.GetProcesses()
            //?.FirstOrDefault(pr => pr.MainWindowTitle.Contains("Sanderling")).Id;
            //SetForegroundWindow(Process.GetProcessById(id.Value).MainWindowHandle);
            //SendKeys.SendWait("{F5}");
            //while (ClipString.Equals(Clipboard.GetText())) { Thread.Sleep(100); }
            //ClipboardString.Add(Clipboard.GetText());

            //this.textBox1.Lines = ClipboardString.ToArray();
            //    this.textBox1.Text = ClipString;
            //    string Rgx = ClipboardString.First();
            //    string sss = string.Empty;


            //    if (System.Text.RegularExpressions.Regex.IsMatch(ClipboardString.Last().ToString(), @"medium"))
            //        sss = Rgx.Replace("UNK", "C1");

            //    if (System.Text.RegularExpressions.Regex.IsMatch(ClipboardString.Last().ToString(), @"into unknown") &&
            //        !sss.Contains("C1"))
            //        sss = Rgx.Replace("UNK", "C23");

            //    if (System.Text.RegularExpressions.Regex.IsMatch(ClipboardString.Last().ToString(), @"D|dangerous"))
            //        sss = Rgx.Replace("UNK", "C45");

            //    if (System.Text.RegularExpressions.Regex.IsMatch(ClipboardString.Last().ToString(), @"D|deadly"))
            //        sss = Rgx.Replace("UNK", "C6");

            //    //if (System.Text.RegularExpressions.Regex.IsMatch(ID, @"[A-Z]00\d") ||
            //       if(System.Text.RegularExpressions.Regex.IsMatch(ClipboardString.Last().ToString(), @"O|only the smallest"))
            //        sss += ("F");

            //    if (System.Text.RegularExpressions.Regex.IsMatch(ClipboardString.Last().ToString(), @"reaching the end"))
            //        sss = Rgx += " eol";
            //    if (string.IsNullOrEmpty(sss)) sss = ClipString;
            //    RunAsSTAThread(() => { Clipboard.SetText(sss); });
            //    textBox1.Text = sss;
            //}

            //return;
        }
Пример #9
0
        public void Exchange(
            int?EveOnlineClientProcessId,
            Int64 RequestedMeasurementTime,
            Action <BotEngine.Interface.FromProcessMeasurement <MemoryStruct.IMemoryMeasurement> > CallbackMeasurementMemoryNew)
        {
            BotEngine.Interface.FromProcessMeasurement <MemoryStruct.IMemoryMeasurement> MeasurementMemoryNew = null;

            lock (Lock)
            {
                var Time = Bib3.Glob.StopwatchZaitMiliSictInt();

                var ServerExchangeLastAge = Time - ServerExchangeLastTime;

                if (ServerExchangeTimeDistanceMin <= ServerExchangeLastAge)
                {
                    if (LicenseClient?.AuthCompleted ?? false)
                    {
                        ServerExchangeLastTime = Time;

                        var LicenseServerSessionId = LicenseClient?.ExchangeAuthLast?.Value?.Response?.SessionId;

                        var ToServerMessage = new BotEngine.Interface.FromClientToServerMessage()
                        {
                            SessionId = LicenseServerSessionId,
                            Interface = SensorAppManager?.ToServer(),
                            Time      = Bib3.Glob.StopwatchZaitMiliSictInt(),
                        };

                        var FromServerMessage = LicenseClient?.ExchangePayload(ToServerMessage);

                        if (null != FromServerMessage)
                        {
                            SensorAppManager.FromServer(FromServerMessage.Interface);
                        }
                    }
                    else
                    {
                        LicenseClient?.ExchangeAuth();
                    }
                }

                var MeasurementMemoryReceivedLastTime = MeasurementMemoryReceivedLast?.End;

                var ToSensorMessage = new FromConsumerToSensorMessage()
                {
                    RequestedMeasurementProcessId     = EveOnlineClientProcessId,
                    MeasurementMemoryRequestTime      = RequestedMeasurementTime,
                    MeasurementMemoryReceivedLastTime = MeasurementMemoryReceivedLastTime,
                };

                var FromSensorAppMessage = SensorAppManager?.ConsumerExchange(new BotEngine.Interface.FromConsumerToInterfaceProxyMessage()
                {
                    AppSpecific = ToSensorMessage.SerializeSingleBib3RefNezDifProtobuf(),
                });

                if (null == FromSensorAppMessage)
                {
                    return;
                }

                var FromSensorAppMessagePortionAppSpecific = FromSensorAppMessage.AppSpecific;

                var SensorMessageEveOnline =
                    FromSensorAppMessagePortionAppSpecific.DeSerializeProtobufBib3RefNezDif()?.FirstOrDefault() as FromSensorToConsumerMessage;

                var MeasurementMemory = SensorMessageEveOnline?.MemoryMeasurement;

                if (null == MeasurementMemory)
                {
                    return;
                }

                if (MeasurementMemory?.End == MeasurementMemoryReceivedLast?.End)
                {
                    return;
                }

                MeasurementMemoryReceivedLast = MeasurementMemory;

                MeasurementMemoryNew = MeasurementMemory;
            }

            if (null != MeasurementMemoryNew)
            {
                CallbackMeasurementMemoryNew?.Invoke(MeasurementMemoryNew);
            }
        }