コード例 #1
0
ファイル: UI.cs プロジェクト: goaaats/xivModdingFramework
        /// <summary>
        /// Gets a list of UI elements from the Uld Files
        /// </summary>
        /// <remarks>
        /// The uld files are in the 06 files
        /// They contain refrences to textures among other unknown things (likely placement data)
        /// </remarks>
        /// <returns>A list containing XivUi data</returns>
        public List <XivUi> GetUldList()
        {
            var uldList = new List <XivUi>();

            var uld      = new Uld(_gameDirectory);
            var uldPaths = uld.GetTexFromUld();

            // Loops through the list of uld paths
            foreach (var uldPath in uldPaths)
            {
                var xivUi = new XivUi
                {
                    Name         = Path.GetFileNameWithoutExtension(uldPath),
                    Category     = "UI",
                    ItemCategory = "HUD",
                    UiPath       = "ui/uld"
                };

                uldList.Add(xivUi);
            }

            uldList.Sort();

            return(uldList);
        }
コード例 #2
0
        /// <summary>
        /// Gets a list of UI elements from the Uld Files
        /// </summary>
        /// <remarks>
        /// The uld files are in the 06 files
        /// They contain refrences to textures among other unknown things (likely placement data)
        /// </remarks>
        /// <returns>A list containing XivUi data</returns>
        public async Task <List <XivUi> > GetUldList()
        {
            var uldLock = new object();
            var uldList = new List <XivUi>();

            var uld      = new Uld(_gameDirectory);
            var uldPaths = await uld.GetTexFromUld();

            await Task.Run(() => Parallel.ForEach(uldPaths, (uldPath) =>
            {
                var xivUi = new XivUi
                {
                    Name              = Path.GetFileNameWithoutExtension(uldPath),
                    PrimaryCategory   = "UI",
                    SecondaryCategory = "HUD",
                    UiPath            = "ui/uld"
                };

                if (xivUi.Name.Equals(string.Empty))
                {
                    return;
                }

                lock (uldLock)
                {
                    uldList.Add(xivUi);
                }
            }));

            uldList.Sort();

            return(uldList);
        }