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


C# hsStream.Close方法代码示例

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


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

示例1: IAcceptConnection

        private void IAcceptConnection(Socket cli)
        {
            hsStream s = new hsStream(new NetworkStream(cli, false));
            pnCli2Srv_Connect hdr = new pnCli2Srv_Connect();
            hdr.Read(s);
            s.Close();

            IAcceptConnection(cli, hdr);
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:9,代码来源:Lobby.cs

示例2: SetMessage

        public void SetMessage(plMessage msg, hsResMgr mgr)
        {
            hsStream s = new hsStream(new MemoryStream());
            s.Version = mgr.Version;
            if (msg != null)
                mgr.WriteCreatable(s, msg);
            fHelper.Stream = s;
            s.Close();

            // Fill in the flags
            // TODO: CCR -> AllPlayers
            InterAgeRouting = msg.InterAgeRouting;
            UseRelRegions = msg.UseRelRegions;
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:14,代码来源:NetMsgGameMessage.cs

示例3: ReadDescriptors

 public static void ReadDescriptors(string path)
 {
     // TODO: EncryptedStream support
     if (Directory.Exists(path)) {
         foreach (string sdl in Directory.EnumerateFiles(path, "*.sdl")) {
             FileStream fs = new FileStream(Path.Combine(path, sdl), FileMode.Open, FileAccess.Read);
             ReadDescriptors(fs);
             fs.Close();
         }
     } else if (File.Exists(path)) {
         FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
         hsStream s = new hsStream(fs);
         ReadDescriptors(fs);
         s.Close();
         fs.Close();
     } else
         throw new FileNotFoundException(path);
 }
开发者ID:Hoikas,项目名称:PlasmaDotNet,代码行数:18,代码来源:SDLParser.cs

示例4: ParseStateRecord

        public plStateDataRecord ParseStateRecord(byte[] record, hsResMgr mgr)
        {
            MemoryStream ms = new MemoryStream(record);
            hsStream s = new hsStream(ms);
            s.Version = mgr.Version;

            plStateDataRecord result = new plStateDataRecord(this);
            try {
                result.ReadStreamHeader(s, mgr);
                result.Read(s, mgr);
            } catch (Exception e) {
                throw new plSDLException("Failed to parse StateDataRecord", e);
            } finally {
                s.Close();
                ms.Close();
            }

            return result;
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:19,代码来源:SDLMgr.cs

示例5: DumpStateRecord

        public byte[] DumpStateRecord(plStateDataRecord record, hsResMgr mgr)
        {
            MemoryStream ms = new MemoryStream();
            hsStream s = new hsStream(ms);
            s.Version = mgr.Version;

            byte[] buf = null;
            try {
                record.WriteStreamHeader(s, mgr);
                record.Write(s, mgr);
            } catch (Exception e) {
                throw new plSDLException("Failed to dump StateDataRecord", e);
            } finally {
                buf = ms.ToArray();
                s.Close();
                ms.Close();
            }

            return buf;
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:20,代码来源:SDLMgr.cs

示例6: ToArray

        public byte[] ToArray()
        {
            // Lots of overhead for such a simple operation...
            // All because eap sucks
            MemoryStream ms = new MemoryStream();
            hsStream s = new hsStream(ms);

            Write(s);
            byte[] buf = ms.ToArray();

            s.Close();
            ms.Close();

            return buf;
        }
开发者ID:Hoikas,项目名称:PlasmaDotNet,代码行数:15,代码来源:VaultNode.cs

示例7: IReadHoldingKey

        private void IReadHoldingKey(HoldingKey key)
        {
            // Prep the source stream...
            hsStream s = key.fStream;
            s.Seek(key.fOffset);

            // Let's dump this object into a protected stream
            MemoryStream ms = new MemoryStream();
            ms.Write(s.ReadBytes(key.fSize), 0, key.fSize);
            ms.Position = 0;

            //Now read the creatable from that protected stream
            hsStream pStream = new hsStream(ms);
            pStream.Version = s.Version;
            plCreatable pCre = ReadCreatable(pStream);

            // Do we need to use a plHexBuffer (unimplemented data)
            if (pCre == null) {
                plHexBuffer buf = new plHexBuffer();
                buf.Read(pStream, this);
                fObjects.Add(key.fKey, buf);

                plDebugLog.GetLog("ResManager").Warn(String.Format(
                    "Unimplemented KeyedObject '{0}' in {1}",
                    plManagedType.ClassName(key.fKey.ClassType),
                    key.fKey.Location));
            } else
                fObjects.Add(key.fKey, (hsKeyedObject)pCre);

            //Need to warn about read/size mismatch?
            if (ms.Length > ms.Position)
                plDebugLog.GetLog("ResManager").Warn(
                    String.Format("Read Error: {0} has {1} bytes left over", key.fKey.ObjectName, (ms.Length - ms.Position)));

            // Clean up
            pStream.Close();
            ms.Close();
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:38,代码来源:ResManager.cs


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