예제 #1
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			if (reciver.Prefix.TransferNumber == 0)
			{
				ServiceSend(null, reciver.Prefix.TransferID);
			}
		}
예제 #2
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			if (reciver.Prefix.TransferNumber == 0)
				ServiceSend(BaseConnection.Statistic, reciver.Prefix.TransferID);
			else if (reciver.Prefix.TransferNumber == 1)
			{
				Hop hop = new Hop() {Description = BaseConnection.LocalHost.Info};
				hop.OpenedConnections = new ObservableCollection<Hop>(Tcp.LocalOpenedConnections.Select(c => new Hop() {Description = c.RemoteHost.Info, RemoteID = c.ID, Statistic = c.Statistic}));
				ServiceSend(hop, reciver.Prefix.TransferID);
			}
			else if (reciver.Prefix.TransferNumber == 2)
			{
				int cid = (int)reciver.DataFrame;
				Tcp.Connection connection = Tcp.LocalOpenedConnections.FirstOrDefault(x=>x.ID == cid);
				if (connection == null)
				{
					ServiceSend(new ConnectionCloseResultArgs() {IsFaulted = true, Exception = new KeyNotFoundException("Die angegebne Connection konnte nicht gefunden werden: [" + cid + "]")}, reciver.Prefix.TransferID);
				}
				else
				{
					connection.Close();
					ServiceSend(new ConnectionCloseResultArgs(), reciver.Prefix.TransferID);
				}
			}
		}
예제 #3
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			if (reciver.Prefix.TransferNumber == 0)
			{
				ServiceSend(null, reciver.Prefix.TransferID).ContinueWith(t => Process.GetCurrentProcess().Kill());
			}
			else if (reciver.Prefix.TransferNumber == 500)
			{
				ApplicationExitArgs args = reciver.DataFrame as ApplicationExitArgs;
				BaseConnection.Log(this, "Remote " + args + "");
				if (OnExited != null)
				{
					OnExited(args);
				}
			}
			else if (reciver.Prefix.TransferNumber == 501)
			{
				UnhandledExceptionArgs args = reciver.DataFrame as UnhandledExceptionArgs;
				BaseConnection.Log(this, "Remote " + args);
				if (OnUnhandledError != null)
				{
					OnUnhandledError(args);
				}
			}
			else if (reciver.Prefix.TransferNumber == 502)
			{
				ServiceFailedArgs args = reciver.DataFrame as ServiceFailedArgs;
				BaseConnection.Log(this, "Remote " + args);
				if (OnServiceFailed != null)
				{
					OnServiceFailed(args);
				}
			}
		}
예제 #4
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			if (reciver.Prefix.TransferNumber == 0)
			{
				BitmapSource bitmapSource = NativeMethods.SaveScreen(reciver.DataFrame as Options);
				bitmapSource.Freeze();

				ServiceSend(bitmapSource.AsBytes(), reciver.Prefix.TransferID);
			}
		}
예제 #5
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			
			if (reciver.DataFrame is InvestigationObject && reciver.Prefix.TransferNumber == 0)
			{
				InvestigationObject ob = reciver.DataFrame as InvestigationObject;
				BaseConnection.RemoteHost.Info.FromInvestigationObject(ob);
				ServiceSend(InvestigationObject.Get(), reciver.Prefix.TransferID);
			}
		}
예제 #6
0
파일: OsService.cs 프로젝트: heinzsack/DEV
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			if (reciver.Prefix.TransferNumber == 0)
			{
				ServiceSend(null, reciver.Prefix.TransferID).ContinueWith(t => SystemRoutines.Shutdown());
			}
			else if (reciver.Prefix.TransferNumber == 1)
			{
				ServiceSend(null, reciver.Prefix.TransferID).ContinueWith(t => SystemRoutines.Restart());
			}
			else if (reciver.Prefix.TransferNumber == 2)
			{
				ServiceSend(null, reciver.Prefix.TransferID).ContinueWith(t => SystemRoutines.LogOff());
			}
			else if (reciver.Prefix.TransferNumber == 3)
			{
				ServiceSend(null, reciver.Prefix.TransferID).ContinueWith(t => SystemRoutines.Lock());
			}
			else if (reciver.Prefix.TransferNumber == 4)
			{
			}
			else if (reciver.Prefix.TransferNumber == 500)
			{
				SessionEndingArgs args = reciver.DataFrame as SessionEndingArgs;
				BaseConnection.Log(this, "Remote " + args);
				if (OnRemoteSessionEnding != null)
				{
					OnRemoteSessionEnding(args);
				}
			}
			else if (reciver.Prefix.TransferNumber == 501)
			{
				TimeChangedArgs args = reciver.DataFrame as TimeChangedArgs;
				BaseConnection.Log(this, "Remote " + args);
				if (OnRemoteTimeChanged != null)
				{
					OnRemoteTimeChanged(args);
				}
			}
			else if (reciver.Prefix.TransferNumber == 502)
			{
				PreferencesChangedArgs args = reciver.DataFrame as PreferencesChangedArgs;
				BaseConnection.Log(this, "Remote " + args);
				if (OnRemotePreferencesChanged != null)
				{
					OnRemotePreferencesChanged(args);
				}
			}
		}
예제 #7
0
	protected override void RxRecived(Packet.Rx receiver)
		{
		Application.Current.Dispatcher.Invoke (DispatcherPriority.DataBind, new Action (() =>
		{
			if (receiver.Prefix.TransferNumber == 0)
				{
				WPMediaFrozenMachineCheck Request = receiver.DataFrame as WPMediaFrozenMachineCheck;
				Request.DoCheck().ContinueWith(t =>
					{
					ServiceSend(Request, Guid.Empty, 1);
					if (Request.ServerVisibleTimeDifferenceInSeconds > 240)
						{
						WMB.Basics.ReportErrorToEventViewer("Local Time On Machine = "
							+ Request.TimeCheckList[0].LocalTimeOnMachine.ToString("yyy-MM-dd HH:mm:ss")
							+ "\r\nCentral CheckServer Time = " + Request.TimeCheckList[0].CentralTime.ToString("yyy-MM-dd HH:mm:ss"));

						WMB.Basics.StartExternalProgramm(Path.Combine(System.Environment.SystemDirectory, "CMD.exe"),
							"/C shutdown /r /t 0 /f");

						}
					});
				}
			else
				{
				if (receiver.State == Packet.Rx.States.Succeeded)
					{
					if (OnReceivedWPMediaFrocenMachineCheckCall != null)
						OnReceivedWPMediaFrocenMachineCheckCall((WPMediaFrozenMachineCheck)receiver.DataFrame);
					}
				else
					{
					if (OnReceivedWPMediaFrocenMachineCheckCall != null)
						OnReceivedWPMediaFrocenMachineCheckCall((WPMediaFrozenMachineCheck)null);

					}
				}
			}));
		}
예제 #8
0
	protected override void RxIncoming (Packet.Rx reciver)
		{
		}
예제 #9
0
		protected internal override void RxIncoming(Packet.Rx reciver)
		{
		}
예제 #10
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
		}
예제 #11
0
		/// <summary>
		/// Sendet ein Packet über diese Verbindung.
		/// </summary>
		/// <param name="tx"></param>
		/// <returns></returns>
		public Task Send(Packet.Tx tx)
		{
			if (IsDisposed)
				throw new InvalidOperationException("Auf das verworfene Objekt kann nicht zugegriffen werden.");

			Task t = new Task(() =>
			{
				byte[] txBytes = tx.AsBytes();
				Task send = Base.Transciver.Send(txBytes);
				send.Wait();
				if (send.IsFaulted)
				{
					throw send.Exception.MostInner();
				}
				else
				{
					Base.Statistic.TxPacketCount++;
				}
			}, TaskCreationOptions.LongRunning);
			t.Start(TaskScheduler.Default);
			return t;
		}
예제 #12
0
		protected internal override void RxRecived(Packet.Rx reciver)
		{
			if (reciver.Prefix.TransferNumber == 500)
			{
				Task retrival = new Task(() =>
				{
					ObservableCollection<ProcessItem> rv = new ObservableCollection<ProcessItem>();
					foreach (Process process in Process.GetProcesses())
					{
						ProcessItem processItem = new ProcessItem();
						processItem.FromProcess(process);

						rv.Add(processItem);
					}
					ServiceSend(rv, reciver.Prefix.TransferID);


				}, TaskCreationOptions.LongRunning);
				retrival.Start(TaskScheduler.Default);
			}
			else if (reciver.Prefix.TransferNumber == 600)
			{
				int pid = (int) reciver.DataFrame;
				try
				{
					Process processById = Process.GetProcessById(pid);
					processById.Kill();
					ServiceSend(new ProcessKillResultArgs() {IsFaulted = false, Exception = null}, reciver.Prefix.TransferID);
				}
				catch (Exception e)
				{
					ServiceSend(new ProcessKillResultArgs() {IsFaulted = true, Exception = e}, reciver.Prefix.TransferID);
				}
			}
			else if (reciver.Prefix.TransferNumber == 700)
			{
				ProcessStartArgs args = (ProcessStartArgs) reciver.DataFrame;
				Task<Process> task = new Task<Process>(() =>
				{
					ProcessStartInfo psi = new ProcessStartInfo();
					psi.Arguments = args.Arguments;
					psi.FileName = args.Path;
					Process process = Process.Start(psi);
					return process;
				}, TaskCreationOptions.LongRunning);
				task.Start(TaskScheduler.Default);
				task.ContinueWith(t =>
				{
					if (t.IsFaulted)
					{
						ServiceSend(new ProcessStartResultArgs() {IsFaulted = true, Exception = t.Exception}, reciver.Prefix.TransferID);
						return;
					}
					else
					{
						ProcessItem pi = new ProcessItem();
						pi.FromProcess(t.Result);
						ServiceSend(new ProcessStartResultArgs() { ProcessItem = pi }, reciver.Prefix.TransferID);
					}
				}, TaskScheduler.Default);
			}
		}