Ejemplo n.º 1
0
        private async void Menu_ModConverter_Click(object sender, RoutedEventArgs e)
        {
            var modPackDirectory = new DirectoryInfo(Settings.Default.ModPack_Directory);
            var openFileDialog   = new OpenFileDialog {
                InitialDirectory = modPackDirectory.FullName, Filter = "TexToolsModPack TTMP (*.ttmp;*.ttmp2)|*.ttmp;*.ttmp2"
            };

            if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            var ttmpFileName = openFileDialog.FileName;
            var ttmp         = new TTMP(modPackDirectory, XivStrings.TexTools);

            (ModPackJson ModPackJson, Dictionary <string, Image> ImageDictionary)ttmpData;
            var progressController = await this.ShowProgressAsync(UIStrings.Mod_Converter, UIMessages.PleaseStandByMessage);

            var modsJsonList = await ttmp.GetOriginalModPackJsonData(new DirectoryInfo(ttmpFileName));

            if (modsJsonList == null)
            {
                ttmpData = await ttmp.GetModPackJsonData(new DirectoryInfo(ttmpFileName));
            }
            else
            {
                ttmpData = (ModPackJson : new ModPackJson(), ImageDictionary : new Dictionary <string, Image>());
                ttmpData.ModPackJson.Author         = "Mod Converter";
                ttmpData.ModPackJson.Version        = "1.0.0";
                ttmpData.ModPackJson.Name           = Path.GetFileNameWithoutExtension(ttmpFileName);
                ttmpData.ModPackJson.TTMPVersion    = "s";
                ttmpData.ModPackJson.SimpleModsList = new List <ModsJson>();
                foreach (var mod in modsJsonList)
                {
                    var modsJson = new ModsJson();
                    modsJson.Category     = mod.Category;
                    modsJson.DatFile      = mod.DatFile;
                    modsJson.FullPath     = mod.FullPath;
                    modsJson.ModOffset    = mod.ModOffset;
                    modsJson.ModPackEntry = null;
                    modsJson.ModSize      = mod.ModSize;
                    modsJson.Name         = mod.Name;
                    ttmpData.ModPackJson.SimpleModsList.Add(modsJson);
                }
            }
            var gameDir  = new DirectoryInfo(Settings.Default.FFXIV_Directory);
            var lang     = XivLanguages.GetXivLanguage(Settings.Default.Application_Language);
            var gear     = new Gear(gameDir, lang);
            var gearList = await gear.GetGearList();

            var modConverterView = new ModConverterView(gearList, ttmpFileName, ttmpData)
            {
                Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner
            };
            await progressController.CloseAsync();

            modConverterView.ShowDialog();
        }
Ejemplo n.º 2
0
        private async void Menu_ModConverter_Click(object sender, RoutedEventArgs e)
        {
            var modPackDirectory = new DirectoryInfo(Settings.Default.ModPack_Directory);
            var openFileDialog   = new OpenFileDialog {
                InitialDirectory = modPackDirectory.FullName, Filter = "TexToolsModPack TTMP (*.ttmp;*.ttmp2)|*.ttmp;*.ttmp2"
            };

            if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            var ttmpFileName = openFileDialog.FileName;
            var ttmp         = new TTMP(modPackDirectory, XivStrings.TexTools);

            (ModPackJson ModPackJson, Dictionary <string, Image> ImageDictionary)ttmpData;
            var progressController = await this.ShowProgressAsync(UIStrings.Mod_Converter, UIMessages.PleaseStandByMessage);

            var modsJsonList = await ttmp.GetOriginalModPackJsonData(new DirectoryInfo(ttmpFileName));

            if (modsJsonList == null)
            {
                ttmpData = await ttmp.GetModPackJsonData(new DirectoryInfo(ttmpFileName));
            }
            else
            {
                ttmpData = (ModPackJson : new ModPackJson(), ImageDictionary : new Dictionary <string, Image>());
                ttmpData.ModPackJson.Author         = "Mod Converter";
                ttmpData.ModPackJson.Version        = "1.0.0";
                ttmpData.ModPackJson.Name           = Path.GetFileNameWithoutExtension(ttmpFileName);
                ttmpData.ModPackJson.TTMPVersion    = "s";
                ttmpData.ModPackJson.SimpleModsList = new List <ModsJson>();
                foreach (var mod in modsJsonList)
                {
                    var modsJson = new ModsJson();
                    modsJson.Category     = mod.Category;
                    modsJson.DatFile      = mod.DatFile;
                    modsJson.FullPath     = mod.FullPath;
                    modsJson.ModOffset    = mod.ModOffset;
                    modsJson.ModPackEntry = null;
                    modsJson.ModSize      = mod.ModSize;
                    modsJson.Name         = mod.Name;
                    ttmpData.ModPackJson.SimpleModsList.Add(modsJson);
                }
            }
            var categorys = ItemTreeView.ItemsSource as ObservableCollection <Category>;
            var list      = new List <xivModdingFramework.Items.Interfaces.IItem>();
            var ctgs1     = categorys[0];

            foreach (var ctgs2 in ctgs1.Categories)
            {
                if (ctgs2.Item != null)
                {
                    list.Add(ctgs2.Item);
                    continue;
                }
                foreach (var ctgs3 in ctgs2.Categories)
                {
                    if (ctgs3.Item != null)
                    {
                        list.Add(ctgs3.Item);
                    }
                }
            }
            var modConverterView = new ModConverterView(list, ttmpFileName, ttmpData)
            {
                Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner
            };
            await progressController.CloseAsync();

            modConverterView.ShowDialog();
        }