public void Read(MpqFileStream stream) { Flags = stream.ReadValueS16(); W1 = stream.ReadValueS16(); W2 = stream.ReadValueS16(); }
public void Read(MpqFileStream stream) { GBId = stream.ReadValueS32(); I0 = stream.ReadValueS32(); }
public void Read(MpqFileStream stream) { stream.Position += 8; QuestStepFailureConditions = stream.ReadSerializedData <QuestStepFailureCondition>(); }
public void Read(MpqFileStream stream) { this.SceneChunks = stream.ReadSerializedData <SceneChunk>(); this.ChunkCount = stream.ReadValueS32(); stream.Position += (3 * 4); }
public SceneClusterSet(MpqFileStream stream) { this.ClusterCount = stream.ReadValueS32(); stream.Position += (4 * 3); this.SceneClusters = stream.ReadSerializedData <SceneCluster>(); }
public void Read(MpqFileStream stream) { this.S0 = stream.ReadString(64, true); this.I0 = stream.ReadValueS32(); }
public Float3(MpqFileStream stream) { X = stream.ReadValueF32(); Y = stream.ReadValueF32(); Z = stream.ReadValueF32(); }
public void Read(MpqFileStream stream) { this.I0 = stream.ReadValueS32(); this.Scale = stream.ReadValueF32(); }
public void Read(MpqFileStream stream) { this.F0 = stream.ReadValueF32(); this.Event = new TriggerEvent(stream); }
public void Read(MpqFileStream stream) { this.I0 = stream.ReadValueS32(); this.Location = new Vector3D(stream); }
public void Read(MpqFileStream stream) { this.I0 = stream.ReadValueS32(); this.Q0 = new Quaternion16(stream); }
public void Read(MpqFileStream stream) { this.I0 = stream.ReadValueS32(); this.Keys = stream.ReadSerializedData <ScaleKey>(); }
public void Read(MpqFileStream stream) { this.Name = stream.ReadString(64, true); }
public void Read(MpqFileStream stream) { W0 = stream.ReadValueS16(); W1 = stream.ReadValueS16(); }
public void Read(MpqFileStream stream) { this.UHash = stream.ReadValueS32(); this.S0 = stream.ReadString(32, true); this.F0 = stream.ReadValueF32(); }
public VelocityVector3D(MpqFileStream stream) { this.VelocityX = stream.ReadValueF32(); this.VelocityY = stream.ReadValueF32(); this.VelocityZ = stream.ReadValueF32(); }
public void Read(MpqFileStream stream) { this.SNOTexture = stream.ReadValueS32(); this.I0 = stream.ReadValueS32(); stream.Position += 4; }
public static void UnpackMap(string inputMapPath, string outputFolderPath) { if (!File.Exists(inputMapPath)) { throw new FileNotFoundException(String.Format("Input map at {0} does not exist.", inputMapPath)); } if (Directory.Exists(outputFolderPath) && Directory.EnumerateFileSystemEntries(outputFolderPath).Any()) { throw new IOException(String.Format("Output folder at {0} is not empty.", outputFolderPath)); } // Strategy is as follows: // Copy map to the target location. Then extract all files, but convert the map into a container by deleting all the files inside. // Goal is that we are left with the MPQ container which contains all the other misc information which we are currently unable to manage. // In future, we might be able to generate the MPQ from scratch, but for now we will keep a big chunk of "unmanaged" data and focus // on the files we are able to manage. string containerPath = Path.Combine(outputFolderPath, FILENAME_CONTAINER); Directory.CreateDirectory(outputFolderPath); // Copy map to target location in preparation to convert it into a container File.Copy(inputMapPath, containerPath); string listFile = null; // Extract all files from the map and remove them from the container using (MpqArchive container = new MpqArchive(containerPath, FileAccess.ReadWrite)) using (MpqArchive archive = new MpqArchive(inputMapPath, FileAccess.Read)) { // Check if somebody is trying to unpack a container - lets avoid creating Matroshchkas if (archive.HasFile(DUMMY_FILENAME)) { throw new Exception("Input map seems to be a container rather than a packed map."); } using (MpqFileStream file = archive.OpenFile(MPQ_LISTFILE)) using (StreamReader sr = new StreamReader(file)) { listFile = sr.ReadToEnd(); } // We have to add a dummy file as otherwise the listfile gets deleted and somehow doesnt get restored... if (!container.HasFile(DUMMY_FILENAME)) { string dummyFilePath = Path.GetTempFileName(); try { using (StreamWriter listFileHandle = new StreamWriter(dummyFilePath)) { listFileHandle.WriteLine("Dummy file"); } container.AddFileFromDiskEx(dummyFilePath, DUMMY_FILENAME, MpqFileAddFileExFlags.MPQ_FILE_COMPRESS, MpqFileAddFileExCompression.MPQ_COMPRESSION_BZIP2, MpqFileAddFileExCompression.MPQ_COMPRESSION_NEXT_SAME); } finally { File.Delete(dummyFilePath); } } using (StringReader reader = new StringReader(listFile)) { string currentArchiveFile = string.Empty; do { currentArchiveFile = reader.ReadLine(); if (currentArchiveFile != null) { if (currentArchiveFile == DUMMY_FILENAME) { continue; } string targetPath = Path.Combine(outputFolderPath, currentArchiveFile.Trim('\\')); Directory.CreateDirectory(Path.GetDirectoryName(targetPath)); archive.ExtractFile(currentArchiveFile, targetPath); container.RemoveFile(currentArchiveFile); } } while (currentArchiveFile != null); } container.Compact(MPQ_LISTFILE); } }
/// <summary> /// Reads Vector2D from given MPQFileStream. /// </summary> /// <param name="stream">The MPQFileStream to read from.</param> public Vector2D(MpqFileStream stream) { X = stream.ReadValueS32(); Y = stream.ReadValueS32(); }
public void Read(MpqFileStream stream) { this.SNOScene = stream.ReadValueS32(); this.I0 = stream.ReadValueS32(); this.LabelGBId = stream.ReadValueS32(); }
public void Read(MpqFileStream stream) { X = stream.ReadValueF32(); Y = stream.ReadValueF32(); Z = stream.ReadValueF32(); }
public AxialCylinder(MpqFileStream stream) { this.Position = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); Ax1 = stream.ReadValueF32(); Ax2 = stream.ReadValueF32(); }
public void Read(MpqFileStream stream) { this.SNOHandle = new SNOHandle(stream); this.PRTransform = new PRTransform(stream); this.SceneSpecification = new SceneSpecification(stream); }
public Sphere(MpqFileStream stream) { Position = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); Radius = stream.ReadValueF32(); }
public SubSceneGroup(MpqFileStream stream) { this.Read(stream); }
public WeightedLook(MpqFileStream stream) { this.LookLink = stream.ReadString(64, true); Int0 = stream.ReadValueS32(); }
public LabelRuleSet(MpqFileStream stream) { Rulecount = stream.ReadValueS32(); stream.Position += (3 * 4); this.LabelRules = stream.ReadSerializedData <LabelRule>(); }
/// <summary> /// Reads Quaternion from given MPQFileStream. /// </summary> /// <param name="stream">The MPQFileStream to read from.</param> public Quaternion(MpqFileStream stream) { this.Vector3D = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); this.W = stream.ReadValueF32(); }
public QuestLevelRange(MpqFileStream stream) { Min = stream.ReadValueS32(); Max = stream.ReadValueS32(); }
public void Read(MpqFileStream stream) { this.Flags = stream.ReadValueS16(); this.WCell = stream.ReadValueS16(); }