示例#1
0
文件: Scene.cs 项目: Neverknew/mooege
 public void Read(MpqFileStream stream)
 {
     Flags = stream.ReadValueS16();
     W1    = stream.ReadValueS16();
     W2    = stream.ReadValueS16();
 }
示例#2
0
文件: World.cs 项目: realTobby/NullD
 public void Read(MpqFileStream stream)
 {
     GBId = stream.ReadValueS32();
     I0   = stream.ReadValueS32();
 }
示例#3
0
文件: Quest.cs 项目: wlasser/mooege-2
 public void Read(MpqFileStream stream)
 {
     stream.Position           += 8;
     QuestStepFailureConditions = stream.ReadSerializedData <QuestStepFailureCondition>();
 }
示例#4
0
文件: World.cs 项目: realTobby/NullD
 public void Read(MpqFileStream stream)
 {
     this.SceneChunks = stream.ReadSerializedData <SceneChunk>();
     this.ChunkCount  = stream.ReadValueS32();
     stream.Position += (3 * 4);
 }
示例#5
0
文件: World.cs 项目: realTobby/NullD
 public SceneClusterSet(MpqFileStream stream)
 {
     this.ClusterCount  = stream.ReadValueS32();
     stream.Position   += (4 * 3);
     this.SceneClusters = stream.ReadSerializedData <SceneCluster>();
 }
示例#6
0
文件: Globals.cs 项目: cduran/mooege
 public void Read(MpqFileStream stream)
 {
     this.S0 = stream.ReadString(64, true);
     this.I0 = stream.ReadValueS32();
 }
示例#7
0
 public Float3(MpqFileStream stream)
 {
     X = stream.ReadValueF32();
     Y = stream.ReadValueF32();
     Z = stream.ReadValueF32();
 }
示例#8
0
 public void Read(MpqFileStream stream)
 {
     this.I0    = stream.ReadValueS32();
     this.Scale = stream.ReadValueF32();
 }
示例#9
0
 public void Read(MpqFileStream stream)
 {
     this.F0    = stream.ReadValueF32();
     this.Event = new TriggerEvent(stream);
 }
示例#10
0
 public void Read(MpqFileStream stream)
 {
     this.I0       = stream.ReadValueS32();
     this.Location = new Vector3D(stream);
 }
示例#11
0
 public void Read(MpqFileStream stream)
 {
     this.I0 = stream.ReadValueS32();
     this.Q0 = new Quaternion16(stream);
 }
示例#12
0
 public void Read(MpqFileStream stream)
 {
     this.I0   = stream.ReadValueS32();
     this.Keys = stream.ReadSerializedData <ScaleKey>();
 }
示例#13
0
 public void Read(MpqFileStream stream)
 {
     this.Name = stream.ReadString(64, true);
 }
示例#14
0
文件: Scene.cs 项目: Neverknew/mooege
 public void Read(MpqFileStream stream)
 {
     W0 = stream.ReadValueS16();
     W1 = stream.ReadValueS16();
 }
示例#15
0
文件: Globals.cs 项目: cduran/mooege
 public void Read(MpqFileStream stream)
 {
     this.UHash = stream.ReadValueS32();
     this.S0    = stream.ReadString(32, true);
     this.F0    = stream.ReadValueF32();
 }
示例#16
0
 public VelocityVector3D(MpqFileStream stream)
 {
     this.VelocityX = stream.ReadValueF32();
     this.VelocityY = stream.ReadValueF32();
     this.VelocityZ = stream.ReadValueF32();
 }
示例#17
0
文件: Globals.cs 项目: cduran/mooege
 public void Read(MpqFileStream stream)
 {
     this.SNOTexture  = stream.ReadValueS32();
     this.I0          = stream.ReadValueS32();
     stream.Position += 4;
 }
示例#18
0
        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);
                }
        }
示例#19
0
文件: Vector2D.cs 项目: wlasser/D3Emu
 /// <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();
 }
示例#20
0
 public void Read(MpqFileStream stream)
 {
     this.SNOScene  = stream.ReadValueS32();
     this.I0        = stream.ReadValueS32();
     this.LabelGBId = stream.ReadValueS32();
 }
示例#21
0
 public void Read(MpqFileStream stream)
 {
     X = stream.ReadValueF32();
     Y = stream.ReadValueF32();
     Z = stream.ReadValueF32();
 }
示例#22
0
 public AxialCylinder(MpqFileStream stream)
 {
     this.Position = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
     Ax1           = stream.ReadValueF32();
     Ax2           = stream.ReadValueF32();
 }
示例#23
0
文件: World.cs 项目: realTobby/NullD
 public void Read(MpqFileStream stream)
 {
     this.SNOHandle          = new SNOHandle(stream);
     this.PRTransform        = new PRTransform(stream);
     this.SceneSpecification = new SceneSpecification(stream);
 }
示例#24
0
 public Sphere(MpqFileStream stream)
 {
     Position = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
     Radius   = stream.ReadValueF32();
 }
示例#25
0
文件: World.cs 项目: realTobby/NullD
 public SubSceneGroup(MpqFileStream stream)
 {
     this.Read(stream);
 }
示例#26
0
 public WeightedLook(MpqFileStream stream)
 {
     this.LookLink = stream.ReadString(64, true);
     Int0          = stream.ReadValueS32();
 }
示例#27
0
文件: World.cs 项目: realTobby/NullD
 public LabelRuleSet(MpqFileStream stream)
 {
     Rulecount        = stream.ReadValueS32();
     stream.Position += (3 * 4);
     this.LabelRules  = stream.ReadSerializedData <LabelRule>();
 }
示例#28
0
 /// <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();
 }
示例#29
0
文件: Quest.cs 项目: wlasser/mooege-2
 public QuestLevelRange(MpqFileStream stream)
 {
     Min = stream.ReadValueS32();
     Max = stream.ReadValueS32();
 }
示例#30
0
文件: Scene.cs 项目: Neverknew/mooege
 public void Read(MpqFileStream stream)
 {
     this.Flags = stream.ReadValueS16();
     this.WCell = stream.ReadValueS16();
 }