Esempio n. 1
0
        public PatchWriter(Stream stream, PatchFileType patchFileType)
            : base(stream)
        {
            if (patchFileType == PatchFileType.Verdata)
                throw new Exception("This file format is not supported");

            this.patchFileType = patchFileType;
        }
Esempio n. 2
0
        private void patchConverterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.Title    = "Select the patch you wish to convert";
            openFileDialog.Filter   = "MUO patch (*.muo)|*.muo|UOP patch (*.uop)|*.uop|Verdata patch (verdata.mul)|verdata.mul";
            openFileDialog.FileName = string.Empty;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                UpdateStatus("Loading " = openFileDialog.FileName + "...");
                PatchReader reader = new PatchReader(File.Open(openFileDialog.FileName, FileMode.Open), PatchReader.ExtensionToPatchFileType(Path.GetExtension(openFileDialog.FileName)));

                UpdateStatus("Reading patches, please wait... ");
                List <Patch> patches = reader.ReadPatches();


                UpdateStatus("Loaded " + patches.Count.ToString() + " patches into memory...");
                saveFileDialog.Title    = "Select where you wish to save the patches to";
                saveFileDialog.Filter   = "MUO patch (*.muo)|*.muo|UOP patch (*.uop)|*.uop|Verdata patch (verdata.mul)|verdata.mul";
                saveFileDialog.FileName = string.Empty;

                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    PatchFileType type = PatchReader.ExtensionToPatchFileType(Path.GetExtension(saveFileDialog.FileName));

                    UpdateStatus("Saving patches, please wait... ");

                    PatchWriter writer = new PatchWriter(File.Open(saveFileDialog.FileName, FileMode.OpenOrCreate), type);

                    switch (type)
                    {
                    case PatchFileType.MUO:
                        PatchWriter.CreateMUO(saveFileDialog.FileName, patches); break;

                    case PatchFileType.UOP:
                        PatchWriter.CreateUOP(saveFileDialog.FileName, patches); break;

                    case PatchFileType.Verdata:
                        break;
                    }

                    UpdateStatus("Patch conversion complete");
                    MessageBox.Show("Patch conversion complete", "Success");
                }
                else
                {
                    MessageBox.Show("Patch conversion process aborted", "Aborted");
                }

                if (reader != null)
                {
                    reader.Close();
                }

                patches = null;
            }
        }
Esempio n. 3
0
        public PatchWriter(Stream stream, PatchFileType patchFileType)
            : base(stream)
        {
            if (patchFileType == PatchFileType.Verdata)
            {
                throw new Exception("This file format is not supported");
            }

            this.patchFileType = patchFileType;
        }
Esempio n. 4
0
 public Patch(
     string header,
     string?index,
     PatchFileType fileType,
     string fileNameA,
     string?fileNameB,
     bool isCombinedDiff,
     PatchChangeType changeType,
     string?text)
 {
     Header         = header ?? throw new ArgumentNullException(nameof(header));
     Index          = index;
     FileType       = fileType;
     FileNameA      = fileNameA ?? throw new ArgumentNullException(nameof(fileNameA));
     FileNameB      = fileNameB;
     IsCombinedDiff = isCombinedDiff;
     ChangeType     = changeType;
     Text           = text;
 }
Esempio n. 5
0
 public Patcher(PatchFileType patchFileType, string infile, string outfile)
 {
     this.infile = infile;
     this.outfile = outfile;
     this.filetype = patchFileType;
 }
Esempio n. 6
0
 public PatchReader(Stream stream, PatchFileType patchFileType)
     : base(stream)
 {
     _patchFileType = patchFileType;
 }
Esempio n. 7
0
 public PatchReader(Stream stream, PatchFileType patchFileType) : base(stream)
 {
     _patchFileType = patchFileType;
 }