private void ConnectThread() { try { // Инициализация Options.width = 1024; Options.height = 768; Options.Canvas = new RdpCanvas(Options.width, Options.height); ControlFlow.resetOrderState(); Licence.Reset(); ChangedRect.Reset(); // Подключение Network.Connect(Options.Host, Options.Port); MCS.sendСonnectionRequest(null, false); // Получения изображения Rdp.Start(); } catch { // Флаг выполнения Options.IsRunned = false; } }
public static void Disconnect() { m_Packet = null; next_packet = 0; if (Network.Connected) { try { MCS.Disconnect(); } catch { } Network.Close(); } }
internal static void processRedirection(RdpPacket data, bool bStdRedirect) { if (!bStdRedirect) { data.ReadLittleEndian16(); } data.ReadLittleEndian16(); data.ReadLittleEndian16(); Options.sessionID = data.ReadLittleEndian32(); int num = data.ReadLittleEndian32(); if ((num & 1) != 0) { Options.Host = data.ReadUnicodeString(); } byte[] buffer = null; if ((num & 2) != 0) { int count = data.ReadLittleEndian32(); buffer = new byte[count]; data.Read(buffer, 0, count); } if ((num & 4) != 0) { Options.Username = data.ReadUnicodeString(); } if ((num & 8) != 0) { Options.Domain = data.ReadUnicodeString(); } if ((num & 0x10) != 0) { Options.Password = data.ReadUnicodeString(); } if ((num & 0x200) != 0) { Options.Host = data.ReadUnicodeString(); } if ((num & 0x100) != 0) { Options.Host = data.ReadUnicodeString(); } if (!string.IsNullOrEmpty(Options.Domain)) { Options.DomainAndUsername = Options.Domain + @"\" + Options.Username; } else { Options.DomainAndUsername = Options.Username; } if ((num & 0x80) == 0) { Network.Close(); Licence.Reset(); Network.Connect(Options.Host, Options.Port); MCS.sendСonnectionRequest(buffer, false); } }