Esempio n. 1
0
        protected override void ExecuteImpl()
        {
            GroupInfo gi = GroupInfoManager.FindGroup(m_groupKey);

            if (gi != null)
            {
                if (m_text.Contains(TextCommand_IsAlive))
                {
                    OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendGroupTextMessage(gi.Key, MsgInputConfig.FormatMessage("I'm alive."), m_remoteIP));
                    return;
                }
                else if (m_text.Contains(TextCommand_Version))
                {
                    OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendGroupTextMessage(gi.Key, MsgInputConfig.FormatMessage(DataManager.Version), m_remoteIP));
                    return;
                }
                else if (m_text.Contains(TextCommand_Dead_Pkg_Count))
                {
                    OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendTextMessage(MsgInputConfig.FormatMessage(Logger.Get_Dead_Pkg_Counter()), m_remoteIP));
                    return;
                }
            }

            UserInfo usr = UserInfoManager.FindUser(m_remoteIP);

            if (gi != null && usr != null)
            {
                gi.AppendMessage(m_text, usr.Username);
            }
        }
Esempio n. 2
0
        protected override void ExecuteImpl()
        {
            GroupInfo gi   = GroupInfoManager.FindGroup(m_groupKey);
            UserInfo  user = UserInfoManager.FindUser(m_remoteIP);

            Workbench.GroupAddUser(gi, user);
        }
Esempio n. 3
0
        public static void AddGroup(string groupKey, string name)
        {
            if (string.IsNullOrEmpty(groupKey) || string.IsNullOrEmpty(name))
            {
                return;
            }

            if (GroupInfoManager.FindGroup(groupKey) != null)
            {
                return;
            }

            s_singleton.Invoke(new DoAction(delegate
            {
                Logger.WriteLine(string.Format("Add Group: {0}. with key: {1}", name, groupKey));

                GroupInfo gi = new GroupInfo(groupKey, name);
                GroupInfoManager.AddGroup(gi);
                s_singleton.m_groups.AddGroup(gi);
            }));
        }
Esempio n. 4
0
        protected override void ExecuteImpl()
        {
            if (string.IsNullOrEmpty(m_groupKey))
            {
                return;
            }

            UserInfo usr = UserInfoManager.FindUser(m_remoteIP);

            if (usr == null)
            {
                Workbench.AddClient(m_username, m_remoteIP);
            }

            GroupInfo grp = GroupInfoManager.FindGroup(m_groupKey);

            if (grp != null)
            {
                Workbench.GroupAddUser(grp, usr);
                OutgoingPackagePool.AddFirst(NetPackageGenerater.AddGroupUser(m_groupKey, m_remoteIP));
            }
        }
Esempio n. 5
0
        public NP_AppendGroupImageMessageCmd(byte[] data, IPEndPoint remoteIP)
        {
            m_user = UserInfoManager.FindUser(remoteIP);

            int key_length = Helper.GetInt(data);

            m_group = GroupInfoManager.FindGroup(Helper.GetString(data, 4, key_length));

            int length = Helper.GetInt(data, key_length + 4);

            m_filename = Helper.GetString(data, key_length + 8, length);
            m_filename = Path.Combine(DataManager.GetCustomFaceFolderPath(), m_filename);

            int fileDataOffset = 4 + key_length + length + 4;
            int fileDataLength = data.Length - fileDataOffset;

            MemoryStream ms = new MemoryStream(data, fileDataOffset, fileDataLength);

            byte[] imgData = ms.ToArray();
            ms.Dispose();

            GenerateImageFile(imgData, ref m_filename);
        }