public temp_unk(BinaryReader reader, int num) { buffer = null; data = null; bufferType = (ActorTypes)reader.ReadInt32(); uint bufferLength = reader.ReadUInt32(); if (bufferType == ActorTypes.Pinup && bufferLength == 4) { data = new ActorPinup(reader); } else if (bufferType == ActorTypes.ScriptEntity && bufferLength == 100) { data = new ActorScriptEntity(reader); } else if (bufferType == ActorTypes.Radio && bufferLength == 1028) { data = new ActorRadio(reader); } else if (bufferType == ActorTypes.Sound && bufferLength == 592) { //long pos = reader.BaseStream.Position; //data = new ActorSoundEntity(reader); //reader.BaseStream.Position = pos; buffer = reader.ReadBytes((int)bufferLength); } else { buffer = reader.ReadBytes((int)bufferLength); } }
public ActorExtraData(BinaryReader reader) { buffer = null; data = null; bufferType = 0; ReadFromFile(reader); }
public temp_unk(BinaryReader reader) { buffer = null; data = null; bufferType = 0; ReadFromFile(reader); }
private void Paste() { if (clipboard is ActorExtraData) { ActorExtraData ExtraData = (clipboard as ActorExtraData); IActorExtraDataInterface NewExtraData = ActorFactory.CreateDuplicateExtraData(ExtraData.BufferType, ExtraData.Data); TreeNode SelectedNode = ActorTreeView.SelectedNode; if (ActorTreeView.SelectedNode.Text.Equals("Extra Data")) { ActorExtraData ExistingExtraData = (SelectedNode.Tag as ActorExtraData); if (ExtraData.BufferType == ExistingExtraData.BufferType) { ExistingExtraData.Data = NewExtraData; } } } }
public void ReadFromFile(BinaryReader reader) { buffer = null; data = null; bufferType = (ActorTypes)reader.ReadInt32(); uint bufferLength = reader.ReadUInt32(); buffer = reader.ReadBytes((int)bufferLength); using (MemoryStream stream = new MemoryStream(buffer)) { bool isBigEndian = false; //we'll change this once console parsing is complete. data = ActorFactory.LoadExtraData(bufferType, stream, isBigEndian); Debug.Assert(bufferLength == stream.Length); } buffer = (data == null ? buffer : null); }
private void Paste() { if (clipboard is ActorExtraData) { ActorExtraData ExtraData = (clipboard as ActorExtraData); IActorExtraDataInterface NewExtraData = ActorFactory.CreateDuplicateExtraData(ExtraData.BufferType, ExtraData.Data); TreeNode SelectedNode = ActorTreeView.SelectedNode; if (ActorTreeView.SelectedNode.Text.Equals("Extra Data")) { ActorExtraData ExistingExtraData = (SelectedNode.Tag as ActorExtraData); if (ExtraData.BufferType == ExistingExtraData.BufferType) { ExistingExtraData.Data = NewExtraData; } } Text = Language.GetString("$ACTOR_EDITOR_TITLE") + "*"; bIsFileEdited = true; } }
public static IActorExtraDataInterface CreateDuplicateExtraData(ActorTypes type, IActorExtraDataInterface extraData) { switch (type) { case ActorTypes.C_Sound: return(new ActorSoundEntity(extraData)); default: return(null); } }
public void ReadFromFile(BinaryReader reader) { buffer = null; data = null; bufferType = (ActorTypes)reader.ReadInt32(); uint bufferLength = reader.ReadUInt32(); buffer = reader.ReadBytes((int)bufferLength); bool parsed = false; using (MemoryStream stream = new MemoryStream(buffer)) { bool isBigEndian = false; //we'll change this once console parsing is complete. if (bufferType == ActorTypes.Pinup && bufferLength == 4) { data = new ActorPinup(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.ScriptEntity && bufferLength == 100) { data = new ActorScriptEntity(stream, isBigEndian); parsed = true; } //else if (bufferType == ActorTypes.Radio && bufferLength == 1028) //{ // data = new ActorRadio(stream, isBigEndian); //} else if (bufferType == ActorTypes.Airplane && bufferLength == 4) { data = new ActorAircraft(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.SpikeStrip && bufferLength == 4) { data = new ActorSpikeStrip(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Door && bufferLength == 364) { data = new ActorDoor(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Wardrobe && bufferLength == 208) { data = new ActorWardrobe(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.TrafficTrain && bufferLength == 180) { data = new ActorTrafficTrain(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.TrafficHuman && bufferLength == 160) { data = new ActorTrafficHuman(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.TrafficCar && bufferLength == 220) { data = new ActorTrafficCar(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.LightEntity && bufferLength == 2316) { data = new ActorLight(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Item && bufferLength == 152) { data = new ActorItem(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Sound && bufferLength == 592) { data = new ActorSoundEntity(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.CleanEntity && bufferLength == 20) { data = new ActorCleanEntity(stream, isBigEndian); parsed = true; } } if (parsed) { buffer = null; } }