本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}