Пример #1
0
        public void AddFrame(ServerFrame f)
        {
            ThreadPool.QueueUserWorkItem((x) =>
            {
                bool notfound = true;
                while (notfound)
                {
                    lock(RegistorSS)
                    {
                        foreach (var i in RegistorSS)
                        {
                            if (i.HandlerID == "none")
                            {
                                i.Name = f.Name;
                                i.Description = f.Name;
                                i.HandlerID = f.HandlerID;

                                byte[] buf = new Handshake() { Description = f.Name, Name = f.Name, HandlerID = f.HandlerID }.Write();

                                i.NetS.Write(buf, 0, buf.Length);
                                Logger.Log("Assigned Role of " + f.HandlerID + " to " + i.ID.ToString());
                                notfound = false;

                                break;
                            }
                        }
                    }
                }
            });
        }
Пример #2
0
 /// <summary>
 /// Use this to Deploy a new Frame
 /// </summary>
 /// <param name="f">Frame Object</param>
 public void AddFrame(ServerFrame f)
 {
     MFSS.AddFrame(f);
 }
Пример #3
0
        private void HandlePacket(byte[] data, NetworkStream ns)
        {
            var x = PacketManager.GetPacket(data[0]).Parse(data);

            if (x is Handshake)
            {
                lock (RegistorSS)
                {
                    var y = x as Handshake;

                    var ss = new ServerFrame();

                    ss.Description = y.Description;
                    ss.HandlerID = y.HandlerID;
                    ss.ID = y.ID;
                    ss.Name = y.Name;
                    ss.NetS = ns;

                    RegistorSS.Add(ss);
                    Logger.Log("SS registored on guid: " + ss.ID.ToString());
                }
            }
            if (x is Disconect)
            {
                lock (RegistorSS)
                {
                    var y = x as Disconect;
                    int index = RegistorSS.FindIndex((xx) => { return xx.ID == y.ID; });
                    Logger.Log("SS(" + RegistorSS[index].ID.ToString() + ") Closed");
                    RegistorSS.RemoveAt(index);
                }
            }
        }