當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。