예제 #1
0
        public static bool CloseConnection(string Data)
        {
            PushConnectNetworkData pdata = null;
            NetRedirWS             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());
        }
예제 #2
0
        public static string StartNetRedir(Network net, string SessionID, string ToServer, int Port)
        {
            NetRedirWS R = new NetRedirWS(net, ToServer, Port, SessionID);

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

            return(SessionID);
        }