예제 #1
0
        public static WZPatchFile FromWZ(WZFile oldWZ, WZFile newWZ)
        {
            Rebuild patch = new Rebuild(oldWZ.Name + ".wz", oldWZ, newWZ);

            newWZ.Directory.Open(oldWZ.Directory, patch.operations);

            return patch;
        }
예제 #2
0
        public static WZPatchFile FromWZ(WZFile oldWZ, WZFile newWZ)
        {
            Rebuild patch = new Rebuild(oldWZ.Name + ".wz", oldWZ, newWZ);

            newWZ.Directory.Open(oldWZ.Directory, patch.operations);

            return(patch);
        }
예제 #3
0
 public WZDirectory(string Name, WZFile file, int baseOffset, WZDirectory parent, int Size)
 {
     this.Name = Name;
     this.baseOffset = baseOffset;
     this.file = file;
     this.Size = Size;
     this.parent = parent;
 }
예제 #4
0
 public WZDirectory(string Name, WZFile file, int baseOffset, WZDirectory parent, int Size)
 {
     this.Name       = Name;
     this.baseOffset = baseOffset;
     this.file       = file;
     this.Size       = Size;
     this.parent     = parent;
 }
예제 #5
0
 public void Patch(WZFile file)
 {
 }
예제 #6
0
 public WZDirectory(string Name, WZFile file, int baseOffset) : this(Name, file, baseOffset, null, 0) { }
예제 #7
0
 public WZDirectory(string Name, WZFile file) : this(Name, file, 0, null, 0) { }
예제 #8
0
 private void createPatchFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Map.Instance != null && MapID != "MapLogin.img")
     {
         OpenFileDialog ofdOpen = new OpenFileDialog();
         ofdOpen.Filter = "Map.wz|Map.wz";
         ofdOpen.Title = "Select the original files";
         if (ofdOpen.ShowDialog() != DialogResult.Cancel)
         {
             string fileName = ofdOpen.FileName;
             ofdOpen.Filter = "String.wz|String.wz";
             if (ofdOpen.ShowDialog() != DialogResult.Cancel)
             {
                 SaveFileDialog save = new SaveFileDialog();
                 save.Filter = "*.patch|*.patch";
                 if (save.ShowDialog() != DialogResult.Cancel)
                 {
                     //Save_Click(null, null);
                     WZFile map = new WZFile(fileName, file.Version);
                     WZFile str = new WZFile(ofdOpen.FileName, file.Version);
                     WZPatch patch = new WZPatch();
                     patch.files.Add(WZPatchFile.FromWZ(map, file));
                     patch.files.Add(WZPatchFile.FromWZ(str, stringf));
                     patch.Save(save.FileName);
                     str.Close();
                     map.Close();
                 }
             }
         }
     }
 }
예제 #9
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (Map.Instance == null) return;

            //Map.Instance.map.GetChild("info").SetInt("fieldLimit", 0);

            if (Map.Instance.map.GetChild("miniMap") != null)
            {
                Bitmap bitmap = new Bitmap(Map.Instance.Width, Map.Instance.Height);
                using (Graphics g = Graphics.FromImage(bitmap))
                    Map.Instance.Draw(g);
                bitmap = ResizeBitmap(bitmap, new Size(bitmap.Width / 16, bitmap.Height / 16));

                Map.Instance.map.GetChild("miniMap").GetCanvas("canvas").SetBitmap(bitmap);
                Map.Instance.map.GetChild("miniMap").GetCanvas("canvas").format = WZCanvas.ImageFormat.FORMAT_4444;
            }

            if (MapID == "MapLogin.img")
            {
                ui.Save();
                ui.Close();
                ui = new WZFile(UIFileName, file.Version);
                ui.Open();

                new Map(ui.Directory.GetIMG("MapLogin.img")).map.ToSave = true;
            }
            else
            {
                string IMG = ((IMGFile)Map.Instance.map).GetFullName();

                file.Save();
                stringf.Save();
                file.Close();
                file = new WZFile(MapFileName, file.Version);
                file.Open();
                stringf.Close();
                stringf = new WZFile(StringFileName, file.Version);
                stringf.Open();

                lock(MapLock)
                    new Map(file.Directory.GetIMG(IMG.Substring(4))).map.ToSave = true;
            }
        }
예제 #10
0
        private bool load()
        {
            if (file == null)
            {
                OpenFileDialog ofdOpen = new OpenFileDialog();
                ofdOpen.Filter = "Map.wz|Map.wz";
                if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                {
                    MapFileName = ofdOpen.FileName;
                    string MobFileName = ofdOpen.FileName.ToLower().Replace("map.wz", "mob.wz");
                    string NpcFileName = ofdOpen.FileName.ToLower().Replace("map.wz", "npc.wz");
                    string SoundFileName = ofdOpen.FileName.ToLower().Replace("map.wz", "sound.wz");
                    StringFileName = ofdOpen.FileName.ToLower().Replace("map.wz", "string.wz");
                    string ReactorFileName = ofdOpen.FileName.ToLower().Replace("map.wz", "reactor.wz");
                    UIFileName = ofdOpen.FileName.ToLower().Replace("map.wz", "ui.wz");
                    if (!System.IO.File.Exists(MobFileName))
                    {
                        ofdOpen.Filter = "Mob.wz|Mob.wz";
                        if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                        {
                            MobFileName = ofdOpen.FileName;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    if (!System.IO.File.Exists(NpcFileName))
                    {
                        NpcFileName = System.IO.Path.GetDirectoryName(ofdOpen.FileName) + "\\npc.wz";

                        if (!System.IO.File.Exists(NpcFileName))
                        {
                            ofdOpen.Filter = "Npc.wz|Npc.wz";
                            if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                            {
                                NpcFileName = ofdOpen.FileName;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    if (!System.IO.File.Exists(SoundFileName))
                    {
                        SoundFileName = System.IO.Path.GetDirectoryName(ofdOpen.FileName) + "\\sound.wz";

                        if (!System.IO.File.Exists(SoundFileName))
                        {
                            ofdOpen.Filter = "Sound.wz|Sound.wz";
                            if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                            {
                                SoundFileName = ofdOpen.FileName;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    if (!System.IO.File.Exists(StringFileName))
                    {
                        StringFileName = System.IO.Path.GetDirectoryName(ofdOpen.FileName) + "\\string.wz";

                        if (!System.IO.File.Exists(StringFileName))
                        {
                            ofdOpen.Filter = "String.wz|String.wz";
                            if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                            {
                                StringFileName = ofdOpen.FileName;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    if (!System.IO.File.Exists(ReactorFileName))
                    {
                        ReactorFileName = System.IO.Path.GetDirectoryName(ofdOpen.FileName) + "\\reactor.wz";

                        if (!System.IO.File.Exists(ReactorFileName))
                        {
                            ofdOpen.Filter = "Reactor.wz|Reactor.wz";
                            if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                            {
                                ReactorFileName = ofdOpen.FileName;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    if (!System.IO.File.Exists(UIFileName))
                    {
                        UIFileName = System.IO.Path.GetDirectoryName(ofdOpen.FileName) + "\\ui.wz";

                        if (!System.IO.File.Exists(UIFileName))
                        {
                            ofdOpen.Filter = "UI.wz|UI.wz";
                            if (ofdOpen.ShowDialog() != DialogResult.Cancel)
                            {
                                UIFileName = ofdOpen.FileName;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    file = new WZFile(MapFileName);
                    if (MessageBox.Show("Version 0." + file.DetectVersion() + " detected, is it right?", "Version", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        GetVersion version = new GetVersion();
                        version.ShowDialog();
                        file.Version = byte.Parse(version.Version.Text);
                    }
                    file.Open();
                    mob = new WZFile(MobFileName, file.Version);
                    mob.Open();
                    npc = new WZFile(NpcFileName, file.Version);
                    npc.Open();
                    sound = new WZFile(SoundFileName, file.Version);
                    sound.Open();
                    stringf = new WZFile(StringFileName, file.Version);
                    stringf.Open();
                    reactor = new WZFile(ReactorFileName, file.Version);
                    reactor.Open();
                    ui = new WZFile(UIFileName, file.Version);
                    ui.Open();
                    LoadNames(mob.Directory, stringf.Directory.GetIMG("Mob.img"), mobNames);
                    LoadNames(npc.Directory, stringf.Directory.GetIMG("Npc.img"), npcNames);
                    //MapCurve.ProcessObjects(file.Directory.GetDirectory("Obj"));
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
예제 #11
0
 public WZDirectory(string Name, WZFile file, int baseOffset) : this(Name, file, baseOffset, null, 0)
 {
 }
예제 #12
0
 public WZDirectory(string Name, WZFile file) : this(Name, file, 0, null, 0)
 {
 }
예제 #13
0
 public void Patch(WZFile file)
 {
 }