Exemple #1
0
 public MainWindow(string appID)
 {
     this.InitializeComponent();
     this.Icon = Icons.CheckedPage;
     try
     {
         this.ilBrowserIcons.Images.Add(Icons.DocFolder);
         this.ilBrowserIcons.Images.Add(Icons.FolderClosed);
         this.ilBrowserIcons.Images.Add(Icons.FolderOpen);
         this.ilBrowserIcons.Images.Add(Icons.ConfigFile);
     }
     catch (Exception E)
     {
         Console.WriteLine("{0}", E.ToString());
         this.tvDataFiles.ImageList = null;
     }
     for (int i = 1; i < 20; ++i)
     {
         string DataDir = Path.Combine(POL.GetApplicationPath(appID), "Rom");
         if (i > 1)
         {
             DataDir += i.ToString();
         }
         if (Directory.Exists(DataDir))
         {
             TreeNode Root = this.tvDataFiles.Nodes.Add(I18N.GetText(String.Format("FFXI{0}", i)));
             Root.ImageIndex = Root.SelectedImageIndex = 0;
             Root.Tag        = DataDir;
             Root.Nodes.Add("<dummy>").Tag = Root;
         }
     }
     this.InitializeROMMenus();
     this.ResetViewers();
 }
Exemple #2
0
 public POLUtilsUI()
 {
     this.InitializeComponent();
     this.Icon = Icons.POLViewer;
     {
         var V = Assembly.GetExecutingAssembly().GetName().Version;
         this.Text += String.Format(" {0}.{1}", V.Major, V.Minor);
         if (V.Build != 0 || V.Revision != 0)
         {
             this.Text += String.Format(".{0}", V.Build);
         }
         if (V.Revision != 0)
         {
             this.Text += String.Format(".{0}", V.Revision);
         }
     }
     this.Show();
     this.UpdateSelectedRegion();
     // "Engrish Onry" is only of use if
     //  1) a JP POL client is installed, and
     //  2) the JP version of FFXI is installed.
     if ((POL.AvailableRegions & POL.Region.Japan) == 0 || !POL.IsAppInstalled(AppID.FFXI, POL.Region.Japan))
     {
         this.btnFFXIEngrishOnry.Enabled = false;
     }
     // FFXITC is only of use if
     // FFXI Test Client is installed
     if (!POL.IsAppInstalled(AppID.FFXITC))
     {
         this.btnFFXITCDataBrowser.Enabled = false;
     }
 }
Exemple #3
0
 private void SaveSettings()
 {
     if (this.btnApply.Enabled)
     {
         if (this.grpGlobalConfig.Enabled)
         {
             var configKey = POL.OpenAppConfigKey(AppID.FFXI, true);
             if (configKey == null)
             {
                 MessageBox.Show(this, "Unable to open the configuration registry key for writing. You may need to run POLUtils as administrator to be able to save changes.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 this.grpGlobalConfig.Enabled = false;
             }
             else
             {
                 try { configKey.SetValue("0001", int.Parse(this.txtGUIWidth.Text)); } catch { }
                 try { configKey.SetValue("0002", int.Parse(this.txtGUIHeight.Text)); } catch { }
                 try { configKey.SetValue("0003", int.Parse(this.txt3DWidth.Text)); } catch { }
                 try { configKey.SetValue("0004", int.Parse(this.txt3DHeight.Text)); } catch { }
                 try { configKey.SetValue("0029", int.Parse(this.txtSoundEffects.Text)); } catch { }
             }
         }
         foreach (CharacterConfig cc in this.cmbCharacters.Items)
         {
             cc.Save();
         }
         this.btnApply.Enabled = false;
     }
 }
Exemple #4
0
        public static string GetFilePath(byte App, short Dir, byte File)
        {
            string ROMDir = "Rom";

            if (App > 0)
            {
                ++App;
                ROMDir += App.ToString();
            }
            return(Path.Combine(POL.GetApplicationPath(AppID.FFXI),
                                Path.Combine(ROMDir, Path.Combine(Dir.ToString(), Path.ChangeExtension(File.ToString(), ".dat")))));
        }
Exemple #5
0
 private void UpdateSelectedRegion()
 {
     this.txtSelectedRegion.Text          = new NamedEnum(POL.SelectedRegion).Name;
     this.btnChooseRegion.Enabled         = POL.MultipleRegionsAvailable;
     this.btnFFXIConfigEditor.Enabled     = POL.IsAppInstalled(AppID.FFXI);
     this.btnFFXIDataBrowser.Enabled      = POL.IsAppInstalled(AppID.FFXI);
     this.btnFFXIMacroManager.Enabled     = POL.IsAppInstalled(AppID.FFXI);
     this.btnFFXIStrangeApparatus.Enabled = POL.IsAppInstalled(AppID.FFXI);
     this.btnFFXIEngrishOnry.Enabled      = POL.IsAppInstalled(AppID.FFXI) && (POL.AvailableRegions & POL.Region.Japan) != 0 && false;
     this.btnTetraViewer.Enabled          = POL.IsAppInstalled(AppID.TetraMaster);
     this.btnFFXINPCRenamer.Enabled       = POL.IsAppInstalled(AppID.FFXI);
 }
Exemple #6
0
        /// <summary>
        /// This is an event handler for if/when FFXI exits while we're still running
        /// so that we can clean up properly.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal void PolExited(object sender, EventArgs e)
        {
            // Halt monitoring
            Stop();
            pol = null;

            OnReaderStatusChanged(new ReaderStatusEventArgs()
            {
                Active         = true,
                DataSourceType = this.ParseModeType,
                StatusMessage  = "FFXI Exited"
            });
        }
Exemple #7
0
 public static int Main(string[] Arguments)
 {
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(POLUtils.KaBOOM);
     Application.EnableVisualStyles();
     if (POL.AvailableRegions == POL.Region.None)
     {
         MessageBox.Show(I18N.GetText("Text:NoPOL"), I18N.GetText("Caption:NoPOL"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
     else
     {
         POLUtils.AvailableCultures = new ArrayList();
         string LastCulture = String.Empty;
         using (RegistryKey SettingsKey = POL.OpenPOLUtilsConfigKey())
         {
             if (SettingsKey != null)
             {
                 LastCulture = SettingsKey.GetValue("UI Culture", null) as string;
                 if (LastCulture == null)
                 {
                     LastCulture = String.Empty;
                 }
             }
         }
         // Detect Available Languages
         POLUtils.AvailableCultures.Add(new CultureChoice(CultureInfo.InvariantCulture));
         foreach (CultureInfo CI in CultureInfo.GetCultures(CultureTypes.AllCultures))
         {
             if (CI.Name != String.Empty && Directory.Exists(Path.Combine(Application.StartupPath, CI.Name)))
             {
                 CultureChoice CC = new CultureChoice(CI);
                 POLUtils.AvailableCultures.Add(CC);
                 if (LastCulture != String.Empty && LastCulture == CC.Culture.Name)
                 {
                     CultureChoice.Current = CC;
                 }
             }
         }
         if (CultureChoice.Current == null) // if none configured, default to invariant culture
         {
             CultureChoice.Current = POLUtils.AvailableCultures[0] as CultureChoice;
         }
         // The loop is for the benefit of language change
         POLUtils.KeepGoing = true;
         while (POLUtils.KeepGoing)
         {
             POLUtils.KeepGoing = false;
             Application.Run(new POLUtilsUI());
         }
     }
     return(0);
 }
Exemple #8
0
        public static bool GetFilePath(int FileNumber, out byte App, out short Dir, out byte File)
        {
            string DataRoot = POL.GetApplicationPath(AppID.FFXI);

            for (byte i = 1; i < 20; ++i)
            {
                string Suffix  = "";
                string DataDir = DataRoot;
                if (i > 1)
                {
                    Suffix  = i.ToString();
                    DataDir = Path.Combine(DataRoot, "Rom" + Suffix);
                }
                string VTableFile = Path.Combine(DataDir, String.Format("VTABLE{0}.DAT", Suffix));
                string FTableFile = Path.Combine(DataDir, String.Format("FTABLE{0}.DAT", Suffix));
                if (i == 1) // add the Rom now (not needed for the *TABLE.DAT, but needed for the other DAT paths)
                {
                    DataDir = Path.Combine(DataRoot, "Rom");
                }
                if (System.IO.File.Exists(VTableFile) && System.IO.File.Exists(FTableFile))
                {
                    try
                    {
                        BinaryReader VBR =
                            new BinaryReader(new FileStream(VTableFile, FileMode.Open, FileAccess.Read, FileShare.Read));
                        if (FileNumber < VBR.BaseStream.Length)
                        {
                            VBR.BaseStream.Seek(FileNumber, SeekOrigin.Begin);
                            if (VBR.ReadByte() == i)
                            {
                                BinaryReader FBR =
                                    new BinaryReader(new FileStream(FTableFile, FileMode.Open, FileAccess.Read, FileShare.Read));
                                FBR.BaseStream.Seek(2 * FileNumber, SeekOrigin.Begin);
                                ushort FileDir = FBR.ReadUInt16();
                                App  = (byte)(i - 1);
                                Dir  = (short)(FileDir / 0x80);
                                File = (byte)(FileDir % 0x80);
                                FBR.Close();
                                return(true);
                            }
                        }
                        VBR.Close();
                    }
                    catch {}
                }
            }
            App = File = 0;
            Dir = 0;
            return(false);
        }
Exemple #9
0
 public User(string username, string password, string name, string lastname, POL gender, string jmbg, string phonenumber, string email, ROLE uloga)
 {
     Voznje      = new List <Ride>();
     UserName    = username;
     Password    = password;
     Name        = name;
     LastName    = lastname;
     Gender      = gender;
     JMBG        = jmbg;
     PhoneNumber = phonenumber;
     Email       = email;
     Uloga       = uloga;
     Voznje      = new List <Ride>();
     Blokiran    = false;
 }
Exemple #10
0
 private static void LoadData()
 {
     AutoTranslator.Data_ = new MessageGroupCollection();
     try {
         string       DataFilePath = Path.Combine(POL.GetApplicationPath(AppID.FFXI), "ROM/76/23.DAT");
         FileStream   FS           = new FileStream(DataFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
         Encoding     E            = new FFXIEncoding();
         BinaryReader BR           = new BinaryReader(FS, E);
         while (FS.Position < FS.Length)
         {
             AutoTranslator.Data_.Add(AutoTranslator.ReadMessageGroup(BR, E));
         }
         BR.Close();
     } catch (Exception E) { Console.WriteLine(E.ToString()); }
 }
Exemple #11
0
 private string MakeBackupFolder(bool CreateIfNeeded)
 {
     try {
         string BackupFolder = Path.Combine(POL.GetApplicationPath(AppID.FFXI), "EngrishOnry-Backup");
         if (CreateIfNeeded && !Directory.Exists(BackupFolder))
         {
             this.AddLogEntry(String.Format(I18N.GetText("CreateBackupDir"), BackupFolder));
             Directory.CreateDirectory(BackupFolder);
         }
         return(BackupFolder);
     }
     catch {
         this.LogFailure("MakeBackupFolder");
         return(null);
     }
 }
Exemple #12
0
        public MainWindow()
        {
            InitializeComponent();
            this.Icon = Icons.TetraMaster;
            TreeNode Root = new TreeNode("Tetra Master Data Files");

            this.tvDataFiles.Nodes.Add(Root);
            string TetraDir = POL.GetApplicationPath(AppID.TetraMaster);

            foreach (string DataFilePath in Directory.GetFiles(Path.Combine(TetraDir, "data"), "gW*.dat"))
            {
                TreeNode TN = new TreeNode(Path.GetFileName(DataFilePath));
                TN.Tag = DataFilePath;
                Root.Nodes.Add(TN);
                FileStream F = new FileStream(DataFilePath, FileMode.Open, FileAccess.Read);
                this.ReadTOC(F, TN);
            }
            Root.Expand();
        }
Exemple #13
0
        /// <summary>
        /// This function is run as a thread to read ram and raise events when new
        /// data shows up.
        /// </summary>
        internal void Monitor()
        {
            pol = ProcessAccess.GetFFXIProcess(polPID, abortMonitorThread);
            if (pol == null)
            {
                OnReaderStatusChanged(new ReaderStatusEventArgs()
                {
                    Active         = true,
                    DataSourceType = this.ParseModeType,
                    StatusMessage  = "Failed to find FFXI"
                });

                return;
            }
            else
            {
                OnReaderStatusChanged(new ReaderStatusEventArgs()
                {
                    Active         = true,
                    DataSourceType = this.ParseModeType,
                    StatusMessage  = "Found FFXI"
                });

                pol.Process.Exited += new EventHandler(PolExited);
            }

            // Wait for packets published from Windower.
            using (var ctx = new ZMQ.Context(1))
            {
                using (Socket subscriber = ctx.Socket(SocketType.SUB))
                {
                    subscriber.Connect("tcp://localhost:43350");
                    subscriber.Subscribe(pol.Process.Id.ToString(), Encoding.Unicode);

                    while (!abortMonitorThread.WaitOne(0))
                    {
                        string address  = subscriber.Recv(Encoding.Unicode);
                        string contents = subscriber.Recv(Encoding.Unicode);
                    }
                }
            }
        }
Exemple #14
0
 private void SaveSettings()
 {
     if (this.btnApply.Enabled)
     {
         if (this.grpGlobalConfig.Enabled)
         {
             RegistryKey ConfigKey = POL.OpenAppConfigKey(AppID.FFXI);
             try { ConfigKey.SetValue("0001", int.Parse(this.txtGUIWidth.Text)); } catch { }
             try { ConfigKey.SetValue("0002", int.Parse(this.txtGUIHeight.Text)); } catch { }
             try { ConfigKey.SetValue("0003", int.Parse(this.txt3DWidth.Text)); } catch { }
             try { ConfigKey.SetValue("0004", int.Parse(this.txt3DHeight.Text)); } catch { }
             try { ConfigKey.SetValue("0029", int.Parse(this.txtSoundEffects.Text)); } catch { }
         }
         foreach (CharacterConfig CC in this.cmbCharacters.Items)
         {
             CC.Save();
         }
         this.btnApply.Enabled = false;
     }
 }
Exemple #15
0
        private void LoadSettings()
        {
            // Load Global settings
            RegistryKey ConfigKey = POL.OpenAppConfigKey(AppID.FFXI);

            if (ConfigKey == null)
            {
                this.grpGlobalConfig.Enabled = false;
            }
            else
            {
                this.txtGUIWidth.Text     = String.Format("{0}", ConfigKey.GetValue("0001"));
                this.txtGUIHeight.Text    = String.Format("{0}", ConfigKey.GetValue("0002"));
                this.txt3DWidth.Text      = String.Format("{0}", ConfigKey.GetValue("0003"));
                this.txt3DHeight.Text     = String.Format("{0}", ConfigKey.GetValue("0004"));
                this.txtSoundEffects.Text = String.Format("{0}", ConfigKey.GetValue("0029"));
            }
            // Select the first character to trigger loading its config
            if (this.cmbCharacters.Items.Count > 0)
            {
                this.cmbCharacters.SelectedIndex = 0;
            }
            this.btnApply.Enabled = false;
        }
Exemple #16
0
 internal Character(string ContentID)
 {
     this.ID_      = ContentID;
     this.DataDir_ = Path.Combine(POL.GetApplicationPath(AppID.FFXI), Path.Combine("User", ContentID));
 }
Exemple #17
0
        public void Run()
        {
            Stream InfoData = Assembly.GetExecutingAssembly().GetManifestResourceStream(this.ResourceName_);

            if (InfoData != null)
            {
                XmlReader XR = new XmlTextReader(InfoData);
                try
                {
                    XmlDocument XD = new XmlDocument();
                    XD.Load(XR);
                    XmlNodeList Apps = XD.SelectNodes("/pol-audio-data/application");
                    this.txtApplication.Text    = null;
                    this.prbApplication.Value   = 0;
                    this.prbApplication.Maximum = Apps.Count;
                    foreach (XmlNode App in Apps)
                    {
                        try
                        {
                            string AppName = App.Attributes["name"].InnerText;
                            this.txtApplication.Text = String.Format("[{0}/{1}] {2}", this.prbApplication.Value + 1,
                                                                     this.prbApplication.Maximum, AppName);
                            this.txtDirectory.Text  = "Scanning...";
                            this.txtFile.Text       = "Scanning...";
                            this.prbDirectory.Value = 0;
                            this.prbFile.Value      = 0;
                            Application.DoEvents();
                            string AppPath = POL.GetApplicationPath(App.Attributes["id"].InnerText);
                            if (AppPath != null)
                            {
                                TreeNode AppNode = new TreeNode(AppName);
                                AppNode.ImageIndex         = 1;
                                AppNode.SelectedImageIndex = 1;
                                AppNode.Tag = AppPath;
                                XmlNodeList DataPaths = App.SelectNodes("data-path");
                                // Precompute totals for directories/files
                                this.prbDirectory.Maximum = 0;
                                this.prbFile.Maximum      = 0;
                                foreach (XmlNode DataPath in DataPaths)
                                {
                                    this.PreScanDataPath(Path.Combine(AppPath,
                                                                      DataPath.InnerText.Replace('/', Path.DirectorySeparatorChar)));
                                }
                                ++this.prbApplication.Value;
                                // Now do a full scan
                                foreach (XmlNode DataPath in DataPaths)
                                {
                                    this.ScanDataPath(App,
                                                      Path.Combine(AppPath, DataPath.InnerText.Replace('/', Path.DirectorySeparatorChar)), AppNode);
                                }
                                if (AppNode.Nodes.Count > 0)
                                {
                                    this.TargetNode_.Nodes.Add(AppNode);
                                }
                            }
                            else
                            {
                                ++this.prbApplication.Value;
                            }
                        }
                        catch (Exception E)
                        {
                            Console.WriteLine(E.ToString());
                        }
                    }
                }
                catch (Exception E)
                {
                    Console.WriteLine(E.ToString());
                }
                XR.Close();
                InfoData.Close();
            }
        }
Exemple #18
0
        private void Run()
        {
            var asm  = Assembly.GetExecutingAssembly();
            var info = asm.GetManifestResourceStream(this.ResourceName_);

            if (info == null)
            {
                return;
            }
            var xr = new XmlTextReader(info);

            try {
                var xd = new XmlDocument();
                xd.Load(xr);
                var apps = xd.SelectNodes("/pol-audio-data/application");
                if (apps == null)
                {
                    return;
                }
                this.txtApplication.Text    = null;
                this.prbApplication.Value   = 0;
                this.prbApplication.Maximum = apps.Count;
                foreach (XmlNode app in apps)
                {
                    try {
                        var name = app.Attributes["name"].InnerText;
                        this.txtApplication.Text = String.Format("[{0}/{1}] {2}", this.prbApplication.Value + 1, this.prbApplication.Maximum, name);
                        this.txtDirectory.Text   = "Scanning...";
                        this.txtFile.Text        = "Scanning...";
                        this.prbDirectory.Value  = 0;
                        this.prbFile.Value       = 0;
                        Application.DoEvents();
                        var applicationPath = POL.GetApplicationPath(app.Attributes["id"].InnerText);
                        if (applicationPath != null)
                        {
                            var tn = new TreeNode(name);
                            tn.ImageIndex         = 1;
                            tn.SelectedImageIndex = 1;
                            tn.Tag = applicationPath;
                            var dataPaths = app.SelectNodes("data-path");
                            // Precompute totals for directories/files
                            this.prbDirectory.Maximum = 0;
                            this.prbFile.Maximum      = 0;
                            foreach (XmlNode dataPath in dataPaths)
                            {
                                this.PreScanDataPath(Path.Combine(applicationPath, dataPath.InnerText.Replace('/', Path.DirectorySeparatorChar)));
                            }
                            ++this.prbApplication.Value;
                            // Now do a full scan
                            foreach (XmlNode dataPath in dataPaths)
                            {
                                this.ScanDataPath(app, Path.Combine(applicationPath, dataPath.InnerText.Replace('/', Path.DirectorySeparatorChar)), tn);
                            }
                            if (tn.Nodes.Count > 0)
                            {
                                this.TargetNode_.Nodes.Add(tn);
                            }
                        }
                        else
                        {
                            ++this.prbApplication.Value;
                        }
                    }
                    catch (Exception e) {
                        Debug.WriteLine("Exception: " + e);
                    }
                }
            }
            catch (Exception e) {
                Debug.WriteLine("Exception: " + e);
            }
            finally {
                xr.Close();
                info.Close();
            }
        }
Exemple #19
0
        private static int Main()
        {
            Console.Title           = I18N.GetText("ConsoleTitle");
            Console.ForegroundColor = ConsoleColor.White;
            try
            {
                string FFXIFolder = null;
                if (FFXIFolder == null)
                {
                    FFXIFolder = POL.GetApplicationPath(AppID.FFXI, POL.Region.Japan);
                }
                if (FFXIFolder == null)
                {
                    FFXIFolder = POL.GetApplicationPath(AppID.FFXI, POL.Region.NorthAmerica);
                }
                if (FFXIFolder == null)
                {
                    FFXIFolder = POL.GetApplicationPath(AppID.FFXI, POL.Region.Europe);
                }
                if (FFXIFolder == null)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(I18N.GetText("NoFFXI"));
                    return(1);
                }
                string OutputFolder = null;
                bool   ScanAllFiles = false;
                {
                    string[] Args = Environment.GetCommandLineArgs();
                    for (int count = 0; count < Args.Length; count++)
                    {
                        if (Args[count].ToLower() == "-test")
                        {
                            useTest = true;
                            try
                            {
                                FFXIFolder = null;
                                if (FFXIFolder == null)
                                {
                                    FFXIFolder = POL.GetApplicationPath(AppID.FFXITC, POL.Region.Japan);
                                }
                                if (FFXIFolder == null)
                                {
                                    FFXIFolder = POL.GetApplicationPath(AppID.FFXITC, POL.Region.NorthAmerica);
                                }
                                if (FFXIFolder == null)
                                {
                                    FFXIFolder = POL.GetApplicationPath(AppID.FFXITC, POL.Region.Europe);
                                }
                                if (FFXIFolder == null)
                                {
                                    Console.ForegroundColor = ConsoleColor.Red;
                                    Console.WriteLine(I18N.GetText("NoFFXITC"));
                                    return(1);
                                }
                            }
                            catch (Exception E)
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine(I18N.GetText("Exception"), E.Message);
                                return(1);
                            }
                            finally
                            {
                                Console.ResetColor();
                            }
                        }
                        else if (Args[count].ToLower() == "-full-scan")
                        {
                            ScanAllFiles = true;
                        }
                        else
                        {
                            OutputFolder = Args[count];
                        }
                    }

                    /*if (Args.Length > 1) {
                     * OutputFolder = Args[1];
                     * if (OutputFolder == "-full-scan") {
                     * OutputFolder = null;
                     * ScanAllFiles = true;
                     * if (Args.Length > 2)
                     * OutputFolder = Args[2];
                     * }
                     * }*/
                    if (OutputFolder == null)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(I18N.GetText("Usage"), Args[0]);
                        return(1);
                    }
                    OutputFolder = Path.GetFullPath(OutputFolder);
                    if (!Directory.Exists(OutputFolder))
                    {
                        Console.WriteLine(I18N.GetText("Creating"), OutputFolder);
                        Directory.CreateDirectory(OutputFolder);
                    }
                }
                DateTime ExtractionStart = DateTime.Now;
                Console.WriteLine(I18N.GetText("SourceFolder"), FFXIFolder);
                Console.WriteLine(I18N.GetText("TargetFolder"), OutputFolder);
                Console.WriteLine(String.Format(I18N.GetText("StartTime"), ExtractionStart));
                if (ScanAllFiles)
                {
                    Program.DoFullFileScan(FFXIFolder, OutputFolder);
                }
                else
                {
                    // Process "known" files
                    Directory.SetCurrentDirectory(OutputFolder);
                    Console.Write(I18N.GetText("DumpFileTable"));
                    {
                        // Dump File Table
                        StreamWriter FileTable = new StreamWriter("file-table.csv", false, Encoding.UTF8);
                        FileTable.WriteLine("\"File ID\"\t\"ROMDir\"\t\"Dir\"\t\"File\"");
                        for (byte i = 1; i < 20; ++i)
                        {
                            string Suffix  = "";
                            string DataDir = FFXIFolder;
                            if (i > 1)
                            {
                                Suffix  = i.ToString();
                                DataDir = Path.Combine(DataDir, "Rom" + Suffix);
                            }
                            string VTableFile = Path.Combine(DataDir, String.Format("VTABLE{0}.DAT", Suffix));
                            string FTableFile = Path.Combine(DataDir, String.Format("FTABLE{0}.DAT", Suffix));
                            if (i == 1) // add the Rom now (not needed for the *TABLE.DAT, but needed for the other DAT paths)
                            {
                                DataDir = Path.Combine(DataDir, "Rom");
                            }
                            if (System.IO.File.Exists(VTableFile) && System.IO.File.Exists(FTableFile))
                            {
                                try
                                {
                                    BinaryReader VBR =
                                        new BinaryReader(new FileStream(VTableFile, FileMode.Open, FileAccess.Read, FileShare.Read));
                                    BinaryReader FBR =
                                        new BinaryReader(new FileStream(FTableFile, FileMode.Open, FileAccess.Read, FileShare.Read));
                                    long FileCount = VBR.BaseStream.Length;
                                    for (long j = 0; j < FileCount; ++j)
                                    {
                                        if (VBR.ReadByte() == i)
                                        {
                                            FBR.BaseStream.Seek(2 * j, SeekOrigin.Begin);
                                            ushort FileDir = FBR.ReadUInt16();
                                            short  Dir     = (short)(FileDir / 0x80);
                                            byte   File    = (byte)(FileDir % 0x80);
                                            FileTable.WriteLine("{0}\t\"{1}\"\t\"{2}\"\t\"{3}\"", j, Path.GetFileName(DataDir),
                                                                Dir.ToString(), Path.ChangeExtension(File.ToString(), ".dat"));
                                        }
                                    }
                                    FBR.Close();
                                    VBR.Close();
                                }
                                catch {}
                            }
                        }
                        FileTable.Close();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine(I18N.GetText("OK"));
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    //resources files
                    if (!Directory.Exists("resources"))
                    {
                        Directory.CreateDirectory("resources");
                    }

                    Program.ExtractFile(81, "resources/spellAbilCommon.xml");

                    Program.ExtractFile(73, "resources/generalE.xml");
                    Program.ExtractFile(74, "resources/usableE.xml");
                    Program.ExtractFile(75, "resources/weaponE.xml");
                    Program.ExtractFile(76, "resources/armorE.xml");
                    Program.ExtractFile(55668, "resources/armor2E.xml");
                    Program.ExtractFile(77, "resources/puppetE.xml");
                    Program.ExtractFile(91, "resources/currencyE.xml");
                    Program.ExtractFile(55667, "resources/slipE.xml");
                    Program.ExtractFile(55701, "resources/abilE.xml");
                    Program.ExtractFile(55465, "resources/areaE.xml");
                    Program.ExtractFile(55702, "resources/spellE.xml");
                    Program.ExtractFile(55726, "resources/statusE.xml");

                    Program.ExtractFile(56235, "resources/generalF.xml");
                    Program.ExtractFile(56211, "resources/general2F.xml");
                    Program.ExtractFile(56236, "resources/usableF.xml");
                    Program.ExtractFile(56237, "resources/weaponF.xml");
                    Program.ExtractFile(56238, "resources/armorF.xml");
                    Program.ExtractFile(56208, "resources/armor2F.xml");
                    Program.ExtractFile(56239, "resources/puppetF.xml");
                    Program.ExtractFile(56240, "resources/currencyF.xml");
                    Program.ExtractFile(56207, "resources/slipF.xml");
                    Program.ExtractFile(56241, "resources/abilF.xml");
                    Program.ExtractFile(56195, "resources/areaF.xml");
                    Program.ExtractFile(56242, "resources/spellF.xml");
                    Program.ExtractFile(56272, "resources/statusF.xml");

                    Program.ExtractFile(55815, "resources/generalD.xml");
                    Program.ExtractFile(55791, "resources/general2D.xml");
                    Program.ExtractFile(55816, "resources/usableD.xml");
                    Program.ExtractFile(55817, "resources/weaponD.xml");
                    Program.ExtractFile(55818, "resources/armorD.xml");
                    Program.ExtractFile(55788, "resources/armor2D.xml");
                    Program.ExtractFile(55819, "resources/puppetD.xml");
                    Program.ExtractFile(55820, "resources/currencyD.xml");
                    Program.ExtractFile(55787, "resources/slipD.xml");
                    Program.ExtractFile(55821, "resources/abilD.xml");
                    Program.ExtractFile(55775, "resources/areaD.xml");
                    Program.ExtractFile(55822, "resources/spellD.xml");
                    Program.ExtractFile(55852, "resources/statusD.xml");

                    Program.ExtractFile(4, "resources/generalJ.xml");
                    Program.ExtractFile(55551, "resources/general2J.xml");
                    Program.ExtractFile(5, "resources/usableJ.xml");
                    Program.ExtractFile(6, "resources/weaponJ.xml");
                    Program.ExtractFile(7, "resources/armorJ.xml");
                    Program.ExtractFile(55548, "resources/armor2J.xml");
                    Program.ExtractFile(8, "resources/puppetJ.xml");
                    Program.ExtractFile(9, "resources/currencyJ.xml");
                    Program.ExtractFile(55547, "resources/slipJ.xml");
                    Program.ExtractFile(55581, "resources/abilJ.xml");
                    Program.ExtractFile(55535, "resources/areaJ.xml");
                    Program.ExtractFile(55582, "resources/spellJ.xml");
                    Program.ExtractFile(55605, "resources/statusJ.xml");
                    // Interesting Data
                    Program.ExtractFile(11, "old-spells-1.xml");
                    Program.ExtractFile(73, "items-general.xml");
                    Program.ExtractFile(55671, "items-general2.xml");
                    Program.ExtractFile(74, "items-usable.xml");
                    Program.ExtractFile(75, "items-weapons.xml");
                    Program.ExtractFile(76, "items-armor.xml");
                    Program.ExtractFile(55668, "items-armor2.xml");
                    Program.ExtractFile(77, "items-puppet.xml");
                    Program.ExtractFile(82, "quests.xml");
                    Program.ExtractFile(85, "old-abilities.xml");
                    Program.ExtractFile(86, "old-spells-2.xml");
                    Program.ExtractFile(87, "old-statuses.xml");
                    Program.ExtractFile(91, "items-currency.xml");
                    Program.ExtractFile(55667, "items-voucher-slip.xml");
                    // Dialog Tables
                    for (ushort i = 0; i < 0x100; ++i)
                    {
                        Program.ExtractFile(6420 + i, String.Format("dialog-table-{0:000}.xml", i));
                    }
                    // Whitegate's 2nd dialog table
                    Program.ExtractFile(57945, "dialog-table-50-2.xml");
                    for (ushort i = 0; i < 0x100; ++i)
                    {
                        Program.ExtractFile(85590 + i, String.Format("dialog-table-{0:000}.xml", i + 255));
                    }
                    // Mob Lists
                    for (ushort i = 0; i < 0x100; ++i)
                    {
                        Program.ExtractFile(6720 + i, String.Format("mob-list-{0:000}.xml", i));
                    }
                    for (ushort i = 0; i < 0x100; ++i)
                    {
                        Program.ExtractFile(86490 + i, String.Format("mob-list-{0:000}.xml", i + 255));
                    }
                    for (ushort i = 0; i < 0x100; ++i)
                    {
                        Program.ExtractFile(67910 + i, String.Format("mob-list2-{0:000}.xml", i));
                    }
                    // String Tables
                    Program.ExtractFile(55465, "area-names.xml");
                    Program.ExtractFile(55466, "area-names-search.xml");
                    Program.ExtractFile(55467, "job-names.xml");
                    Program.ExtractFile(55468, "job-names-short.xml");
                    Program.ExtractFile(55469, "race-names.xml");
                    Program.ExtractFile(55470, "character-selection-strings.xml");
                    Program.ExtractFile(55471, "equipment-locations.xml");
                    // More String Tables
                    Program.ExtractFile(55645, "various-1.xml");
                    Program.ExtractFile(55646, "error-messages.xml");
                    Program.ExtractFile(55647, "pol-messages.xml");
                    Program.ExtractFile(55648, "ingame-messages-1.xml");
                    Program.ExtractFile(55649, "ingame-messages-2.xml");
                    Program.ExtractFile(55650, "chat-filter-types.xml");
                    Program.ExtractFile(55651, "menu-item-description.xml");
                    Program.ExtractFile(55652, "menu-item-text.xml");
                    Program.ExtractFile(55653, "various-2.xml");
                    Program.ExtractFile(55654, "region-names.xml");
                    Program.ExtractFile(55657, "weather-types.xml");
                    Program.ExtractFile(55658, "day-names.xml");
                    Program.ExtractFile(55659, "directions.xml");
                    Program.ExtractFile(55660, "moon-phases.xml");
                    Program.ExtractFile(55661, "area-names-alternate.xml");
                    // String Tables That Used To Be Special Formats
                    Program.ExtractFile(55695, "key-items.xml");
                    Program.ExtractFile(55701, "ability-names.xml");
                    Program.ExtractFile(55702, "spell-names.xml");
                    Program.ExtractFile(55704, "titles.xml");
                    Program.ExtractFile(55706, "quests-sandoria.xml");
                    Program.ExtractFile(55707, "quests-bastok.xml");
                    Program.ExtractFile(55708, "quests-windurst.xml");
                    Program.ExtractFile(55709, "quests-jeuno.xml");
                    Program.ExtractFile(55710, "quests-other.xml");
                    Program.ExtractFile(55711, "quests-zilart.xml");
                    Program.ExtractFile(55712, "quests-ahtuhrgan.xml");
                    Program.ExtractFile(55715, "missions-sandoria.xml");
                    Program.ExtractFile(55716, "missions-bastok.xml");
                    Program.ExtractFile(55717, "missions-windurst.xml");
                    Program.ExtractFile(55718, "missions-zilart.xml");
                    Program.ExtractFile(55719, "missions-promathia.xml");
                    Program.ExtractFile(55720, "missions-assault.xml");
                    Program.ExtractFile(55721, "missions-ahtuhrgan.xml");
                    Program.ExtractFile(55722, "quests-goddess.xml");
                    Program.ExtractFile(55723, "missions-goddess.xml");
                    Program.ExtractFile(55724, "missions-campaign.xml");
                    Program.ExtractFile(55713, "quests-abyssea.xml");
                    Program.ExtractFile(55735, "missions-prophecy.xml");
                    Program.ExtractFile(55736, "missions-moogle.xml");
                    Program.ExtractFile(55737, "missions-shantotto.xml");
                    Program.ExtractFile(55725, "status-names.xml");
                    Program.ExtractFile(55733, "ability-descriptions.xml");
                    Program.ExtractFile(55734, "spell-descriptions.xml");
                }
                DateTime ExtractionEnd = DateTime.Now;
                Console.WriteLine(String.Format(I18N.GetText("EndTime"), ExtractionEnd));
                Console.WriteLine(String.Format(I18N.GetText("ElapsedTime"), ExtractionEnd - ExtractionStart));
                return(0);
            }
            catch (Exception E)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(I18N.GetText("Exception"), E.Message);
                return(1);
            }
            finally
            {
                Console.ResetColor();
            }
        }
Exemple #20
0
 private void btnChooseRegion_Click(object sender, System.EventArgs e)
 {
     POL.ChooseRegion(this);
     this.UpdateSelectedRegion();
 }