Beispiel #1
0
        public static bool CloseConnection(string Data)
        {
            PushConnectNetworkData pdata = null;
            NetRedir redir = null;

            try
            {
                pdata = JsonConvert.DeserializeObject <PushConnectNetworkData>(Data);
            }
            catch (Exception ee)
            {
                Debug.WriteLine(ee.ToString());
            }

            if (pdata == null)
            {
                return(false);
            }

            lock (Locker)
            {
                if (Redirs.ContainsKey(pdata.GUID) == false)
                {
                    return(false);
                }
                redir = Redirs[pdata.GUID];
            }

            return(redir.CloseConnection());
        }
Beispiel #2
0
        public static string StartNetRedir(string ToServer, int Port, Network net)
        {
            string   SessionID = Guid.NewGuid().ToString();
            Network  cnet      = net.CloneElement2();
            NetRedir R         = new NetRedir(ToServer, Port, SessionID, cnet);

            if (R.InitSuccess == false)
            {
                return("");
            }
            lock (Locker)
            {
                Redirs.Add(SessionID, R);
            }

            return(SessionID);
        }
Beispiel #3
0
        public static PushConnectNetworkData ProcessDataRecv(string SessionID)
        {
            PushConnectNetworkData res = new PushConnectNetworkData();

            res.GUID   = SessionID;
            res.Result = 0x16;
            NetRedir r = null;

            lock (Locker)
            {
                if (Redirs.ContainsKey(SessionID) == false)
                {
                    return(res);
                }
                r = Redirs[SessionID];
            }
            return(r.GetData());
        }