本文整理汇总了C#中StreamHandler类的典型用法代码示例。如果您正苦于以下问题:C# StreamHandler类的具体用法?C# StreamHandler怎么用?C# StreamHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamHandler类属于命名空间,在下文中一共展示了StreamHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElementRead
protected override void ElementRead(StreamHandler reader, int index)
{
if (index == -1)
this.ChangeCounter = reader.ReadUInt32();
else
throw new InvalidOperationException("Unknown read element: " + index);
}
示例2: ElementRead
protected override void ElementRead(StreamHandler reader, int index)
{
if (index == -2)
this.NewValue = reader.ReadUInt32();
else
base.ElementRead(reader, index);
}
示例3: GetNetworkLog
public static NetworkLog GetNetworkLog(string filename)
{
if (!s_initialized)
Initialize();
var ext = Path.GetExtension(filename);
var extFittingDumps = new List<NetworkLogWrapper>();
foreach (var info in s_logs)
{
if (info.FileExtension == ext)
extFittingDumps.Add(info);
}
if (extFittingDumps.Count == 0)
extFittingDumps = s_logs;
else if (extFittingDumps.Count == 1)
return extFittingDumps[0].Activate(NetworkLogMode.Reading);
byte[] header;
using (var sh = new StreamHandler(filename, FileMode.Open))
header = sh.ReadBytes(Math.Min((int)sh.Length, s_maxHeaderLength));
foreach (var wrapper in extFittingDumps)
{
if (wrapper.Fits(header))
return wrapper.Activate(NetworkLogMode.Reading);
}
return null;
}
示例4: ElementRead
protected override void ElementRead(StreamHandler reader, int index)
{
if (index == -5)
this.Unk = reader.ReadUInt32();
else
this.Data[-index - 1] = reader.ReadBytes(reader.ReadInt32());
}
示例5: Write
public void Write(StreamHandler Writer)
{
Writer.WriteUInt32((uint)Flags);
if ((Flags & (
SpellCastTargetFlags.Unit | SpellCastTargetFlags.Unk2 |
SpellCastTargetFlags.Object |
SpellCastTargetFlags.Corpse | SpellCastTargetFlags.PvPCorpse
)) != 0)
Writer.WritePackedGuid(TargetUnit);
if ((Flags & (SpellCastTargetFlags.Item | SpellCastTargetFlags.TradeItem)) != 0)
Writer.WritePackedGuid(TargetItem);
if ((Flags & SpellCastTargetFlags.SourceLocation) != 0)
{
Writer.WritePackedGuid(SourceTransportGuid);
Writer.WriteStruct<Vector3>(SourceLocation);
}
if ((Flags & SpellCastTargetFlags.DestLocation) != 0)
{
Writer.WritePackedGuid(DestTransportGuid);
Writer.WriteStruct<Vector3>(DestLocation);
}
if ((Flags & SpellCastTargetFlags.String) != 0)
Writer.WriteCString(StringTarget);
}
示例6: RemoteConnection
internal RemoteConnection(Stream pipeIn, Stream pipeOut, bool isClient)
{
this.pipeIn = pipeIn;
this.pipeOut = pipeOut;
this.isClient = isClient;
localProcessId = Process.GetCurrentProcess().Id;
callStack = new RemoteCallStack();
streamHandler = new StreamHandler(pipeIn, pipeOut);
if(!isClient) {
CfxRuntime.OnCfxShutdown += new Action(CfxRuntime_OnCfxShutdown);
}
writer = new Thread(WriteLoopEntry);
reader = new Thread(ReadLoopEntry);
writer.Name = "cfx_rpc_writer";
reader.Name = "cfx_rpc_reader";
writer.IsBackground = true;
reader.IsBackground = true;
writer.Start();
reader.Start();
}
示例7: Read
public override void Read(StreamHandler Reader)
{
this.Count = Reader.ReadByte();
this.Seed = Reader.ReadUInt32();
this.ClientSeed = Reader.ReadBytes(16);
this.ServerSeed = Reader.ReadBytes(16);
}
示例8: ElementRead
protected override void ElementRead(StreamHandler reader, int index)
{
if (index == -3)
this.UnkByte = reader.UnalignedReadTinyInt(2);
else
base.ElementRead(reader, index);
}
示例9: ElementWrite
protected override void ElementWrite(StreamHandler writer, int index)
{
if (index == -3)
writer.UnalignedWriteInt(this.UnkByte, 2);
else
base.ElementWrite(writer, index);
}
示例10: Save
public override void Save(StreamHandler writer)
{
writer.WritePackedGuid(this.Unit);
foreach (var update in this.Auras)
update.Save(writer);
}
示例11: ReadElement
protected override void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
{
if (element == MovementStatusElements.GenericDword0)
this.ChangeCounter = reader.ReadUInt32();
else
base.ReadElement(reader, element, status, guid, tguid);
}
示例12: Read
public override void Read(StreamHandler reader)
{
Entity = reader.ReadGuid();
Model = reader.ReadUInt32();
Race = (Races)reader.ReadByte();
Gender = (Genders)reader.ReadByte();
Class = (Classes)reader.ReadByte();
Skin = reader.ReadByte();
Face = reader.ReadByte();
Hair = reader.ReadByte();
HairColor = reader.ReadByte();
FaceFeatures = reader.ReadByte();
Guild = reader.ReadGuid();
Head = reader.ReadUInt32();
Shoulders = reader.ReadUInt32();
Body = reader.ReadUInt32();
Chest = reader.ReadUInt32();
Waist = reader.ReadUInt32();
Legs = reader.ReadUInt32();
Feet = reader.ReadUInt32();
Wrists = reader.ReadUInt32();
Hands = reader.ReadUInt32();
Back = reader.ReadUInt32();
Tabard = reader.ReadUInt32();
}
示例13: Read
public void Read(StreamHandler Reader)
{
Flags = (SpellCastTargetFlags)Reader.ReadUInt32();
if ((Flags & (
SpellCastTargetFlags.Unit | SpellCastTargetFlags.Unk2 |
SpellCastTargetFlags.Object |
SpellCastTargetFlags.Corpse | SpellCastTargetFlags.PvPCorpse
)) != 0)
TargetUnit = Reader.ReadPackedGuid();
if ((Flags & (SpellCastTargetFlags.Item | SpellCastTargetFlags.TradeItem)) != 0)
TargetItem = Reader.ReadPackedGuid();
if ((Flags & SpellCastTargetFlags.SourceLocation) != 0)
{
SourceTransportGuid = Reader.ReadPackedGuid();
SourceLocation = Reader.ReadVector3();
}
if ((Flags & SpellCastTargetFlags.DestLocation) != 0)
{
DestTransportGuid = Reader.ReadPackedGuid();
DestLocation = Reader.ReadVector3();
}
if ((Flags & SpellCastTargetFlags.String) != 0)
StringTarget = Reader.ReadCString();
}
示例14: ObjectBus
public ObjectBus(StreamHandler streamHandler)
{
if (streamHandler == null)
throw new ArgumentNullException ("streamHandler");
this.streamHandler = streamHandler;
streamHandler.RegisterCallback (streamHandlerCallback);
}
示例15: ReadElement
protected override void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
{
if (element == MovementStatusElements.GenericDword2)
this.NewValue = reader.ReadSingle();
else
base.ReadElement(reader, element, status, guid, tguid);
}