Esempio n. 1
0
            public void AddPackage(NetPackage package)
            {
                if (package == null)
                {
                    return;
                }

                if (m_finishedContents.ContainsKey(package.ContentID))
                {
                    return;
                }

                Content content = null;

                if (m_contents.ContainsKey(package.ContentID))
                {
                    content = m_contents[package.ContentID];
                }
                else
                {
                    content = new Content(package.ContentID);
                    m_contents.Add(package.ContentID, content);
                }

                content.Add(package);

                if (content.IsFull())
                {
                    Cmd    cmd  = null;
                    byte[] data = content.CombineData();

                    UserInfo usr     = UserInfoManager.FindUser(RemoteEP);
                    string   usrname = (usr == null) ? "no user" : usr.Username;

                    Logger.CounterCommand_Recv(content.CommandType);
                    if (content.CommandType != NetCommandType.RemoveProcessedPackage)
                    {
                        Logger.WriteLine("<<--- command: " + content.CommandType.ToString() + " from :" + usrname);
                    }

                    cmd = GenerateCommand(content, cmd, data);

                    CommandPool.AddCommand(cmd);

                    m_contents.Remove(content.ID);
                    m_finishedContents.Add(content.ID, content.ID);
                }
            }