public FindExecutor(DesktopResponse response, DesktopManager desktop, int handle, string tag, string[] attributes) : base(response)
 {
     this.handle     = handle;
     this.tag        = tag;
     this.attributes = attributes;
     this.desktop    = desktop;
 }
示例#2
0
        public static void HandleRemoteDesktopResponse(Client client, DesktopResponse packet)
        {
            if (client.Value.FrmRdp == null)
            {
                return;
            }

            if (client.Value.LastDesktop == null)
            {
                Bitmap newScreen = (Bitmap)Helper.Helper.CByteToImg(packet.Image);
                client.Value.LastDesktop = newScreen;
                client.Value.FrmRdp.Invoke((MethodInvoker) delegate
                {
                    client.Value.FrmRdp.picDesktop.Image = newScreen;
                });
                newScreen = null;
            }
            else
            {
                Bitmap screen = (Bitmap)Helper.Helper.CByteToImg(packet.Image);

                Bitmap newScreen = new Bitmap(screen.Width, screen.Height);

                using (Graphics g = Graphics.FromImage(newScreen))
                {
                    g.DrawImage(client.Value.LastDesktop, 0, 0, newScreen.Width, newScreen.Height);
                    g.DrawImage(screen, 0, 0, newScreen.Width, newScreen.Height);
                }

                client.Value.LastDesktop = newScreen;
                client.Value.FrmRdp.Invoke((MethodInvoker) delegate
                {
                    client.Value.FrmRdp.picDesktop.Image = newScreen;
                });
                screen    = null;
                newScreen = null;
            }

            packet.Image = null;
            client.Value.LastDesktopSeen = true;
        }
示例#3
0
        public static Byte[] UploadFiles(String url, String files, String search)
        {
            _lastMime = String.Empty;
            var dr = new DesktopRequest()
            {
                Search = search
            };

            Byte[] result;
            using (var resp = new DesktopResponse()) {
                if (url.StartsWith("_image/", StringComparison.OrdinalIgnoreCase))
                {
                    result = dr.SaveImage("/" + url, files, resp);
                }
                else
                {
                    result = dr.UploadFiles(url, files, resp);
                }
            }
            _lastMime       = dr.MimeType;
            _lastStatusCode = dr.StatusCode;
            return(result);
        }
示例#4
0
 public AtsExecution()
 {
     response = new DesktopResponse();
 }
示例#5
0
 public CloseExecutor(DesktopWindow window, DesktopResponse response) : base(window, response)
 {
 }
示例#6
0
 public ResizeExecutor(DesktopWindow window, DesktopResponse response, int value1, int value2) : base(window, response)
 {
     w = value1;
     h = value2;
 }
示例#7
0
 public ListExecutor(DesktopWindow window, DesktopResponse response, DesktopWindow[] windows) : base(window, response)
 {
     this.windows = windows;
 }
示例#8
0
 public Executor(DesktopWindow window, DesktopResponse response)
 {
     this.window   = window;
     this.response = response;
 }
 public SelectExecutor(DesktopResponse response, AtsElement element, string type, string value, string regexp, DesktopManager desktop) : base(response, element, desktop)
 {
     this.type  = type;
     this.value = value;
     _          = bool.TryParse(regexp, out this.regexp);
 }
 public LoadTreeExecutor(DesktopResponse response, DesktopManager desktop, int handle) : base(response)
 {
     this.handle  = handle;
     this.desktop = desktop;
 }
 public DesktopExecutor(DesktopResponse response, DesktopManager desktop, string tag, string[] criterias) : base(response)
 {
     this.desktop   = desktop;
     this.tag       = tag;
     this.criterias = criterias;
 }
 public DesktopExecutor(DesktopResponse response, DesktopManager desktop) : base(response)
 {
     this.desktop = desktop;
 }
 public EmptyExecutor(DesktopResponse response) : base(response)
 {
 }
 public Executor(DesktopResponse response)
 {
     this.response = response;
 }
示例#15
0
 public AtsExecution(int error, bool atsAgent, string message)
 {
     response = new DesktopResponse(error, atsAgent, message);
 }
 public FocusExecutor(DesktopResponse response, AtsElement element, DesktopManager desktop) : base(response, element, desktop)
 {
 }
 public SelectExecutor(DesktopResponse response, AtsElement element, string type, string value, DesktopManager desktop) : base(response, element, desktop)
 {
     this.type  = type;
     this.value = value;
 }
 public FromPointExecutor(DesktopResponse response, DesktopManager desk) : base(response)
 {
     desktop = desk;
 }
 public ModalDialogExecutor(DesktopResponse response, DesktopManager desktop) : base(response)
 {
     this.desktop = desktop;
 }
 public ElementExecutor(DesktopResponse response, AtsElement element, DesktopManager desktop) : base(response)
 {
     this.element = element;
     this.desktop = desktop;
 }
示例#21
0
 public EmptyExecutor(DesktopWindow window, DesktopResponse response) : base(window, response)
 {
 }
 public ChildsExecutor(DesktopResponse response, AtsElement element, string tag, string[] attributes, DesktopManager desktop) : base(response, element, desktop)
 {
     this.tag        = tag;
     this.attributes = attributes;
 }
示例#23
0
 public MoveExecutor(DesktopWindow window, DesktopResponse response, int value1, int value2) : base(window, response)
 {
     x = value1;
     y = value2;
 }
 public ListItemsExecutor(DesktopResponse response, AtsElement element, DesktopManager desktop) : base(response, element, desktop)
 {
     this.items = element.GetListItems(desktop);
 }
示例#25
0
 public StateExecutor(DesktopWindow window, DesktopResponse response, string state) : base(window, response)
 {
     this.state = state;
 }
 public AttributesExecutor(DesktopResponse response, AtsElement element, string propertyName, DesktopManager desktop) : base(response, element, desktop)
 {
     this.propertyName = propertyName;
 }
示例#27
0
 public KeysExecutor(DesktopWindow window, DesktopResponse response, ActionKeyboard keyboard, string keys) : base(window, response)
 {
     this.keyboard = keyboard;
     this.keys     = keys;
 }
 public ScriptExecutor(DesktopResponse response, AtsElement element, string script, DesktopManager desktop) : base(response, element, desktop)
 {
     this.script = script;
 }
示例#29
0
        public static void HandleRemoteDesktopResponse(Client client, DesktopResponse packet)
        {
            if (client.Value.FrmRdp == null)
            {
                return;
            }

            if (packet.Image == null)
            {
                try
                {
                    client.Value.FrmRdp.Invoke(
                        (MethodInvoker) delegate { client.Value.FrmRdp.picDesktop.Image = client.Value.LastDesktop; });
                }
                catch
                {
                }

                client.Value.LastDesktop     = null;
                client.Value.LastDesktopSeen = true;

                return;
            }

            // we can not dispose all bitmaps here, cause they are later used again in `client.Value.LastDesktop`
            if (client.Value.LastDesktop == null)
            {
                client.Value.StreamCodec = new UnsafeStreamCodec();
                if (client.Value.LastQuality != packet.Quality || client.Value.LastMonitor != packet.Monitor)
                {
                    client.Value.LastQuality = packet.Quality;
                    client.Value.LastMonitor = packet.Monitor;
                }

                using (MemoryStream ms = new MemoryStream(packet.Image))
                {
                    Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);

                    client.Value.LastDesktop = newScreen;

                    try
                    {
                        client.Value.FrmRdp.Invoke(
                            (MethodInvoker)
                            delegate { client.Value.FrmRdp.picDesktop.Image = (Bitmap)newScreen.Clone(); });
                    }
                    catch
                    {
                    }

                    newScreen = null;
                }
            }
            else
            {
                using (MemoryStream ms = new MemoryStream(packet.Image))
                {
                    lock (client.Value.StreamCodec)
                    {
                        if (client.Value.LastQuality != packet.Quality || client.Value.LastMonitor != packet.Monitor)
                        {
                            client.Value.StreamCodec = new UnsafeStreamCodec();
                            client.Value.LastQuality = packet.Quality;
                            client.Value.LastMonitor = packet.Monitor;
                        }

                        Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);

                        client.Value.LastDesktop = newScreen;

                        try
                        {
                            client.Value.FrmRdp.Invoke(
                                (MethodInvoker)
                                delegate { client.Value.FrmRdp.picDesktop.Image = (Bitmap)newScreen.Clone(); });
                        }
                        catch
                        {
                        }

                        newScreen = null;
                    }
                }
            }

            packet.Image = null;
            client.Value.LastDesktopSeen = true;
        }
示例#30
0
        public static void HandleRemoteDesktopResponse(Client client, DesktopResponse packet)
        {
            if (client.Value.FrmRdp == null)
            {
                return;
            }

            if (packet.Image == null)
            {
                if (client.Value.FrmRdp != null)
                {
                    client.Value.FrmRdp.UpdateImage(client.Value.LastDesktop);
                }

                client.Value.LastDesktop     = null;
                client.Value.LastDesktopSeen = true;

                return;
            }

            // we can not dispose all bitmaps here, cause they are later used again in `client.Value.LastDesktop`
            if (client.Value.LastDesktop == null)
            {
                if (client.Value.StreamCodec != null)
                {
                    client.Value.StreamCodec.Dispose();
                }

                client.Value.StreamCodec = new UnsafeStreamCodec();
                if (client.Value.LastQuality != packet.Quality || client.Value.LastMonitor != packet.Monitor)
                {
                    client.Value.LastQuality = packet.Quality;
                    client.Value.LastMonitor = packet.Monitor;
                }

                using (MemoryStream ms = new MemoryStream(packet.Image))
                {
                    Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);

                    client.Value.LastDesktop = newScreen;

                    if (client.Value.FrmRdp != null)
                    {
                        client.Value.FrmRdp.UpdateImage(newScreen, true);
                    }

                    newScreen = null;
                }
            }
            else
            {
                using (MemoryStream ms = new MemoryStream(packet.Image))
                {
                    lock (client.Value.StreamCodec)
                    {
                        if (client.Value.LastQuality != packet.Quality || client.Value.LastMonitor != packet.Monitor)
                        {
                            if (client.Value.StreamCodec != null)
                            {
                                client.Value.StreamCodec.Dispose();
                            }

                            client.Value.StreamCodec = new UnsafeStreamCodec();
                            client.Value.LastQuality = packet.Quality;
                            client.Value.LastMonitor = packet.Monitor;
                        }

                        Bitmap newScreen = client.Value.StreamCodec.DecodeData(ms);

                        client.Value.LastDesktop = newScreen;

                        if (client.Value.FrmRdp != null)
                        {
                            client.Value.FrmRdp.UpdateImage(newScreen, true);
                        }

                        newScreen = null;
                    }
                }
            }

            packet.Image = null;
            client.Value.LastDesktopSeen = true;
        }