Esempio n. 1
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            bool ret = true;

            m_resultCode = issStream.Decode4();

            if (m_resultCode == 0)
            {
                m_configVer = issStream.Decode1();

                if (m_configVer == 0)
                {
                    SimpleStream stream = new SimpleStream();
                    m_config = new ValConfig();

                    stream.SetBuffer(issStream.DecodeBuffer(), true);
                    ret = m_config.DeSerialize(stream);
                }
            }

            if (ret)    ret = issStream.CheckSignature();
            return ret;
        }
Esempio n. 2
0
        protected override bool OnDeSerialize(SimpleStream.SerializableDecoder decoder, SimpleStream stream)
        {
            bool ret = true;

            try
            {
                m_serverIp                  = decoder.DecodeString();
                m_serverPort                = (int)decoder.Decode4();
                m_lastConnectedServerIp     = decoder.DecodeString();
                m_lastConnectedServerPort   = (int)decoder.Decode4();

                ValConfig config = new ValConfig();
                if (config.DeSerialize(stream))
                    m_config = config;
                else
                    m_config = null;

                StageManager stageManager = new StageManager();
                if (stageManager.DeSerialize(stream))
                {
                    stageManager.SetServer(this);
                    m_stageManager = stageManager;
                }

                ItemManager itemManager = new ItemManager();
                if (itemManager.DeSerialize(stream))
                {
                    itemManager.SetServer(this);
                    m_itemManager = itemManager;
                }
            }
            catch (Exception)
            {
                ret = false;
            }

            return ret;
        }