Example #1
0
        /// <summary>
        /// Creates the simple mod pack data list
        /// </summary>
        /// <returns>Task</returns>
        private async Task MakeSimpleDataList()
        {
            DirectoryInfo modListDirectory = new DirectoryInfo(Path.Combine(_gameDirectory.Parent.Parent.FullName, XivStrings.ModlistFilePath));
            Modding       modding          = new Modding(_gameDirectory);

            this.ModList           = modding.GetModList();
            this.ParentsDictionary = XivCache.GetModListParents();


            List <SimpleModpackEntry> entries = new List <SimpleModpackEntry>();

            for (int i = 0; i < this.ModList.Mods.Count; i++)
            {
                SimpleModpackEntry entry = MakeEntry(i);
                if (entry == null)
                {
                    continue;
                }

                entries.Add(entry);
            }

            await System.Windows.Application.Current.Dispatcher.InvokeAsync(() =>
            {
                foreach (SimpleModpackEntry entry in entries)
                {
                    this.Entries.Add(entry);
                }
            });
        }
Example #2
0
        /// <summary>
        /// Creates the simple mod pack data list
        /// </summary>
        /// <returns>Task</returns>
        private async Task MakeSimpleDataList()
        {
            DirectoryInfo modListDirectory = new DirectoryInfo(Path.Combine(_gameDirectory.Parent.Parent.FullName, XivStrings.ModlistFilePath));
            Modding       modding          = new Modding(_gameDirectory);

            this.ModList = modding.GetModList();

            // Don't show or list internal mods at all in this menu.
            this.ModList.Mods.RemoveAll(x => x.IsInternal());

            // Rip through the mod list and get the correct raw compressed sizes for all the mods.
            var _dat = new Dat(XivCache.GameInfo.GameDirectory);

            foreach (var mod in ModList.Mods)
            {
                var compressedSize = mod.data.modSize;
                try
                {
                    compressedSize = await _dat.GetCompressedFileSize(mod.data.modOffset, IOUtil.GetDataFileFromPath(mod.fullPath));

                    mod.data.modSize = compressedSize;
                }
                catch
                {
                    // If the calculation failed, just use the original size I guess?
                    // The main way this happens though is if the data is broken, so maybe we should error?
                    // Though there's possibly filetypes from other framework applications in here that we don't know how to measure?
                }
            }

            this.ParentsDictionary = XivCache.GetModListParents();


            List <SimpleModpackEntry> entries = new List <SimpleModpackEntry>();

            for (int i = 0; i < this.ModList.Mods.Count; i++)
            {
                SimpleModpackEntry entry = MakeEntry(i);
                if (entry == null)
                {
                    continue;
                }

                entries.Add(entry);
            }

            await System.Windows.Application.Current.Dispatcher.InvokeAsync(() =>
            {
                foreach (SimpleModpackEntry entry in entries)
                {
                    this.Entries.Add(entry);
                }
            });
        }
Example #3
0
        private SimpleModpackEntry MakeEntry(int i)
        {
            var mod = this.ModList.Mods[i];

            if (mod.fullPath.Equals(string.Empty))
            {
                return(null);
            }

            SimpleModpackEntry entry = new SimpleModpackEntry(i, this);

            return(entry);
        }
Example #4
0
        public static string MakeFriendlyFileName(string path)
        {
            var    filename = Path.GetFileName(path);
            var    ext      = Path.GetExtension(path);
            string niceName = null;

            if (ext == ".mtrl")
            {
                // Include material set identifier for materials.
                var rex = new Regex("v[0-9]{4}/");
                var m   = rex.Match(path);

                if (m.Success)
                {
                    filename = m.Value + filename;
                }

                niceName = "Material";
            }
            else if (ext == ".atex")
            {
                niceName = "VFX";
            }
            else if (ext == ".mdl")
            {
                niceName = "Model";
            }
            else if (ext == ".tex")
            {
                var type = SimpleModpackEntry.GuessTextureUsage(path);
                niceName = type.ToString() + " Texture";
            }
            else if (ext == ".meta")
            {
                niceName = "Metadata";
            }



            var ret = filename;

            if (niceName != null)
            {
                ret = niceName + " (" + filename + ")";
            }
            return(ret);
        }