当前位置: 首页>>代码示例>>C#>>正文


C# MemoryStream.readString方法代码示例

本文整理汇总了C#中KBEngine.MemoryStream.readString方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryStream.readString方法的具体用法?C# MemoryStream.readString怎么用?C# MemoryStream.readString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KBEngine.MemoryStream的用法示例。


在下文中一共展示了MemoryStream.readString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Client_onScriptVersionNotMatch

        /*
            脚本版本不匹配
        */
        public void Client_onScriptVersionNotMatch(MemoryStream stream)
        {
            serverScriptVersion = stream.readString();

            Dbg.ERROR_MSG("Client_onScriptVersionNotMatch: verInfo=" + clientScriptVersion + "(server: " + serverScriptVersion + ")");
            Event.fireAll("onScriptVersionNotMatch", new object[]{clientScriptVersion, serverScriptVersion});

            if(_persistentInofs != null)
                _persistentInofs.onScriptVersionNotMatch(clientScriptVersion, serverScriptVersion);
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:13,代码来源:KBEngine.cs

示例2: Client_onHelloCB

        /*
            握手之后服务端的回调
        */
        public void Client_onHelloCB(MemoryStream stream)
        {
            serverVersion = stream.readString();
            serverScriptVersion = stream.readString();
            serverProtocolMD5 = stream.readString();
            serverEntitydefMD5 = stream.readString();
            Int32 ctype = stream.readInt32();

            Dbg.DEBUG_MSG("KBEngine::Client_onHelloCB: verInfo(" + serverVersion
                + "), scriptVersion("+ serverScriptVersion + "), srvProtocolMD5("+ serverProtocolMD5
                + "), srvEntitydefMD5("+ serverEntitydefMD5 + "), + ctype(" + ctype + ")!");

            onServerDigest();

            if(currserver == "baseapp")
            {
                onLogin_baseapp();
            }
            else
            {
                onLogin_loginapp();
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:26,代码来源:KBEngine.cs

示例3: Client_onLoginSuccessfully

        /*
            登录loginapp成功了
        */
        public void Client_onLoginSuccessfully(MemoryStream stream)
        {
            var accountName = stream.readString();
            username = accountName;
            baseappIP = stream.readString();
            baseappPort = stream.readUint16();

            Dbg.DEBUG_MSG("KBEngine::Client_onLoginSuccessfully: accountName(" + accountName + "), addr(" +
                    baseappIP + ":" + baseappPort + "), datas(" + _serverdatas.Length + ")!");

            _serverdatas = stream.readBlob();
            login_baseapp(true);
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:16,代码来源:KBEngine.cs

示例4: onImportClientMessages

        public void onImportClientMessages(MemoryStream stream)
        {
            UInt16 msgcount = stream.readUint16();

            Dbg.DEBUG_MSG(string.Format("KBEngine::Client_onImportClientMessages: start currserver=" + currserver + "(msgsize={0})...", msgcount));

            while(msgcount > 0)
            {
                msgcount--;

                MessageID msgid = stream.readUint16();
                Int16 msglen = stream.readInt16();

                string msgname = stream.readString();
                sbyte argstype = stream.readInt8();
                Byte argsize = stream.readUint8();
                List<Byte> argstypes = new List<Byte>();

                for(Byte i=0; i<argsize; i++)
                {
                    argstypes.Add(stream.readUint8());
                }

                System.Reflection.MethodInfo handler = null;
                bool isClientMethod = msgname.Contains("Client_");

                if(isClientMethod)
                {
                    handler = typeof(KBEngineApp).GetMethod(msgname);
                    if(handler == null)
                    {
                        Dbg.WARNING_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: interface({1}/{2}/{3}) no implement!",
                            currserver, msgname, msgid, msglen));

                        handler = null;
                    }
                    else
                    {
                        //Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages: imported({0}/{1}/{2}) successfully!",
                        //	msgname, msgid, msglen));
                    }
                }

                if(msgname.Length > 0)
                {
                    Message.messages[msgname] = new Message(msgid, msgname, msglen, argstype, argstypes, handler);

                    //if(!isClientMethod)
                    //	Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: imported({1}/{2}/{3}) successfully!",
                    //		currserver, msgname, msgid, msglen));

                    if(isClientMethod)
                    {
                        Message.clientMessages[msgid] = Message.messages[msgname];
                    }
                    else
                    {
                        if(currserver == "loginapp")
                            Message.loginappMessages[msgid] = Message.messages[msgname];
                        else
                            Message.baseappMessages[msgid] = Message.messages[msgname];
                    }
                }
                else
                {
                    Message msg = new Message(msgid, msgname, msglen, argstype, argstypes, handler);

                    //if(!isClientMethod)
                    //	Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: imported({1}/{2}/{3}) successfully!",
                    //		currserver, msgname, msgid, msglen));

                    if(currserver == "loginapp")
                        Message.loginappMessages[msgid] = msg;
                    else
                        Message.baseappMessages[msgid] = msg;
                }
            };

            onImportClientMessagesCompleted();
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:80,代码来源:KBEngine.cs

示例5: Client_initSpaceData

        /*
            服务端初始化客户端的spacedata, spacedata请参考API
        */
        public void Client_initSpaceData(MemoryStream stream)
        {
            clearSpace(false);
            spaceID = stream.readUint32();

            while(stream.length() > 0)
            {
                string key = stream.readString();
                string val = stream.readString();
                Client_setSpaceData(spaceID, key, val);
            }

            Dbg.DEBUG_MSG("KBEngine::Client_initSpaceData: spaceID(" + spaceID + "), size(" + _spacedatas.Count + ")!");
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:17,代码来源:KBEngine.cs

示例6: createDataTypeFromStream

        public void createDataTypeFromStream(MemoryStream stream, bool canprint)
        {
            UInt16 utype = stream.readUint16();
            string name = stream.readString();
            string valname = stream.readString();

            /* 有一些匿名类型,我们需要提供一个唯一名称放到datatypes中
                如:
                <onRemoveAvatar>
                    <Arg>	ARRAY <of> INT8 </of>		</Arg>
                </onRemoveAvatar>
            */
            if(valname.Length == 0)
                valname = "Null_" + utype;

            if(canprint)
                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: importAlias(" + name + ":" + valname + ":" + utype + ")!");

            if(name == "FIXED_DICT")
            {
                KBEDATATYPE_FIXED_DICT datatype = new KBEDATATYPE_FIXED_DICT();
                Byte keysize = stream.readUint8();
                datatype.implementedBy = stream.readString();

                while(keysize > 0)
                {
                    keysize--;

                    string keyname = stream.readString();
                    UInt16 keyutype = stream.readUint16();
                    datatype.dicttype[keyname] = keyutype;
                };

                EntityDef.datatypes[valname] = datatype;
            }
            else if(name == "ARRAY")
            {
                UInt16 uitemtype = stream.readUint16();
                KBEDATATYPE_ARRAY datatype = new KBEDATATYPE_ARRAY();
                datatype.vtype = uitemtype;
                EntityDef.datatypes[valname] = datatype;
            }
            else
            {
                KBEDATATYPE_BASE val = null;
                EntityDef.datatypes.TryGetValue(name, out val);
                EntityDef.datatypes[valname] = val;
            }

            EntityDef.id2datatypes[utype] = EntityDef.datatypes[valname];

            // 将用户自定义的类型补充到映射表中
            EntityDef.datatype2id[valname] = utype;
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:54,代码来源:KBEngine.cs

示例7: onImportClientEntityDef

        public void onImportClientEntityDef(MemoryStream stream)
        {
            createDataTypeFromStreams(stream, true);

            while(stream.length() > 0)
            {
                string scriptmethod_name = stream.readString();
                UInt16 scriptUtype = stream.readUint16();
                UInt16 propertysize = stream.readUint16();
                UInt16 methodsize = stream.readUint16();
                UInt16 base_methodsize = stream.readUint16();
                UInt16 cell_methodsize = stream.readUint16();

                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: import(" + scriptmethod_name + "), propertys(" + propertysize + "), " +
                        "clientMethods(" + methodsize + "), baseMethods(" + base_methodsize + "), cellMethods(" + cell_methodsize + ")!");

                ScriptModule module = new ScriptModule(scriptmethod_name);
                EntityDef.moduledefs[scriptmethod_name] = module;
                EntityDef.idmoduledefs[scriptUtype] = module;

                Type Class = module.script;

                while(propertysize > 0)
                {
                    propertysize--;

                    UInt16 properUtype = stream.readUint16();
                    UInt32 properFlags = stream.readUint32();
                    Int16 ialiasID = stream.readInt16();
                    string name = stream.readString();
                    string defaultValStr = stream.readString();
                    KBEDATATYPE_BASE utype = EntityDef.id2datatypes[stream.readUint16()];

                    System.Reflection.MethodInfo setmethod = null;

                    if(Class != null)
                    {
                        try{
                            setmethod = Class.GetMethod("set_" + name);
                        }
                        catch (Exception e)
                        {
                            string err = "KBEngine::Client_onImportClientEntityDef: " +
                                scriptmethod_name + ".set_" + name + ", error=" + e.ToString();

                            throw new Exception(err);
                        }
                    }

                    Property savedata = new Property();
                    savedata.name = name;
                    savedata.utype = utype;
                    savedata.properUtype = properUtype;
                    savedata.properFlags = properFlags;
                    savedata.aliasID = ialiasID;
                    savedata.defaultValStr = defaultValStr;
                    savedata.setmethod = setmethod;
                    savedata.val = savedata.utype.parseDefaultValStr(savedata.defaultValStr);

                    module.propertys[name] = savedata;

                    if(ialiasID >= 0)
                    {
                        module.usePropertyDescrAlias = true;
                        module.idpropertys[(UInt16)ialiasID] = savedata;
                    }
                    else
                    {
                        module.usePropertyDescrAlias = false;
                        module.idpropertys[properUtype] = savedata;
                    }

                    //Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), property(" + name + "/" + properUtype + ").");
                };

                while(methodsize > 0)
                {
                    methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    Int16 ialiasID = stream.readInt16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.id2datatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.aliasID = ialiasID;
                    savedata.args = args;

                    if(Class != null)
                    {
                        try{
//.........这里部分代码省略.........
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:101,代码来源:KBEngine.cs

示例8: Client_onImportClientEntityDef

        public void Client_onImportClientEntityDef(MemoryStream stream)
        {
            UInt16 aliassize = stream.readUint16();
            Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: importAlias(size=" + aliassize + ")!");

            while(aliassize > 0)
            {
                aliassize--;
                createDataTypeFromStream(stream, true);
            };

            foreach(string datatype in EntityDef.datatypes.Keys)
            {
                if(EntityDef.datatypes[datatype] != null)
                {
                    EntityDef.datatypes[datatype].bind();
                }
            }

            while(stream.opsize() > 0)
            {
                string scriptmethod_name = stream.readString();
                UInt16 scriptUtype = stream.readUint16();
                UInt16 propertysize = stream.readUint16();
                UInt16 methodsize = stream.readUint16();
                UInt16 base_methodsize = stream.readUint16();
                UInt16 cell_methodsize = stream.readUint16();

                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: import(" + scriptmethod_name + "), propertys(" + propertysize + "), " +
                        "clientMethods(" + methodsize + "), baseMethods(" + base_methodsize + "), cellMethods(" + cell_methodsize + ")!");

                ScriptModule module = new ScriptModule(scriptmethod_name);
                EntityDef.moduledefs[scriptmethod_name] = module;
                EntityDef.idmoduledefs[scriptUtype] = module;

                Dictionary<string, Property> defpropertys = new Dictionary<string, Property>();
                Entity.alldefpropertys.Add(scriptmethod_name, defpropertys);

                Type Class = module.script;

                while(propertysize > 0)
                {
                    propertysize--;

                    UInt16 properUtype = stream.readUint16();
                    string name = stream.readString();
                    string defaultValStr = stream.readString();
                    KBEDATATYPE_BASE utype = EntityDef.iddatatypes[stream.readUint16()];

                    System.Reflection.MethodInfo setmethod = null;

                    if(Class != null)
                    {
                        setmethod = Class.GetMethod("set_" + name);
                    }

                    Property savedata = new Property();
                    savedata.name = name;
                    savedata.properUtype = properUtype;
                    savedata.defaultValStr = defaultValStr;
                    savedata.utype = utype;
                    savedata.setmethod = setmethod;

                    module.propertys[name] = savedata;
                    module.idpropertys[properUtype] = savedata;

                    Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), property(" + name + "/" + properUtype + ").");
                };

                while(methodsize > 0)
                {
                    methodsize--;

                    UInt16 methodUtype = stream.readUint16();
                    string name = stream.readString();
                    Byte argssize = stream.readUint8();
                    List<KBEDATATYPE_BASE> args = new List<KBEDATATYPE_BASE>();

                    while(argssize > 0)
                    {
                        argssize--;
                        args.Add(EntityDef.iddatatypes[stream.readUint16()]);
                    };

                    Method savedata = new Method();
                    savedata.name = name;
                    savedata.methodUtype = methodUtype;
                    savedata.args = args;

                    if(Class != null)
                        savedata.handler = Class.GetMethod(name);

                    module.methods[name] = savedata;
                    module.idmethods[methodUtype] = savedata;
                    Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: add(" + scriptmethod_name + "), method(" + name + ").");
                };

                while(base_methodsize > 0)
                {
                    base_methodsize--;
//.........这里部分代码省略.........
开发者ID:jsboys,项目名称:kbengine,代码行数:101,代码来源:KBEngine.cs

示例9: Client_onImportMercuryErrorsDescr

        public void Client_onImportMercuryErrorsDescr(MemoryStream stream)
        {
            UInt16 size = stream.readUint16();
            while(size > 0)
            {
                size -= 1;

                MercuryErr e;
                e.id = stream.readUint16();
                e.name = stream.readString();
                e.descr = stream.readString();

                mercuryErrs.Add(e.id, e);

                Dbg.DEBUG_MSG("Client_onImportMercuryErrorsDescr: id=" + e.id + ", name=" + e.name + ", descr=" + e.descr);
            }
        }
开发者ID:jsboys,项目名称:kbengine,代码行数:17,代码来源:KBEngine.cs

示例10: Client_onHelloCB

 public void Client_onHelloCB(MemoryStream stream)
 {
     serverVersion_ = stream.readString();
     Int32 ctype = stream.readInt32();
     Dbg.DEBUG_MSG("KBEngine::Client_onHelloCB: verInfo(" + serverVersion_ + "), ctype(" + ctype + ")!");
 }
开发者ID:jsboys,项目名称:kbengine,代码行数:6,代码来源:KBEngine.cs

示例11: createDataTypeFromStream

        public void createDataTypeFromStream(MemoryStream stream, bool canprint)
        {
            UInt16 utype = stream.readUint16();
            string name = stream.readString();
            string valname = stream.readString();

            if(canprint)
                Dbg.DEBUG_MSG("KBEngine::Client_onImportClientEntityDef: importAlias(" + name + ":" + valname + ")!");

            if(valname == "FIXED_DICT")
            {
                KBEDATATYPE_FIXED_DICT datatype = new KBEDATATYPE_FIXED_DICT();
                Byte keysize = stream.readUint8();
                datatype.implementedBy = stream.readString();

                while(keysize > 0)
                {
                    keysize--;

                    string keyname = stream.readString();
                    UInt16 keyutype = stream.readUint16();
                    datatype.dicttype[keyname] = keyutype;
                };

                EntityDef.datatypes[name] = datatype;
            }
            else if(valname == "ARRAY")
            {
                UInt16 uitemtype = stream.readUint16();
                KBEDATATYPE_ARRAY datatype = new KBEDATATYPE_ARRAY();
                datatype.type = uitemtype;
                EntityDef.datatypes[name] = datatype;
            }
            else
            {
                KBEDATATYPE_BASE val = null;
                EntityDef.datatypes.TryGetValue(valname, out val);
                EntityDef.datatypes[name] = val;
            }

            EntityDef.iddatatypes[utype] = EntityDef.datatypes[name];
            EntityDef.datatype2id[name] = EntityDef.datatype2id[valname];
        }
开发者ID:jsboys,项目名称:kbengine,代码行数:43,代码来源:KBEngine.cs

示例12: Client_onVersionNotMatch

        public void Client_onVersionNotMatch(MemoryStream stream)
        {
            serverVersion_ = stream.readString();
            Dbg.DEBUG_MSG("Client_onVersionNotMatch: verInfo=" + clientVersion_ + " not match(server: " + serverVersion_ + ")");

            Event.fire("onVersionNotMatch", new object[]{clientVersion_, serverVersion_});
        }
开发者ID:QiuleiWang,项目名称:kbengine,代码行数:7,代码来源:KBEngine.cs

示例13: createFromStream

		public override object createFromStream(MemoryStream stream)
		{
			return stream.readString();
		}
开发者ID:kjdjpan,项目名称:kbengine_unity3d_plugins,代码行数:4,代码来源:DataTypes.cs


注:本文中的KBEngine.MemoryStream.readString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。