Esempio n. 1
0
        /// <summary>
        /// Gets the path to the default blank texture for a given texture format.
        /// For use when making new texture files.
        /// </summary>
        /// <param name="format"></param>
        /// <returns></returns>
        public static DirectoryInfo GetDefaultTexturePath(XivTexType usageType)
        {
            //new DirectoryInfo(Directory.GetFiles("AddNewTexturePartTexTmps", $"{Path.GetFileNameWithoutExtension(oldTexPath)}.dds", SearchOption.AllDirectories)[0]);
            var strings = Directory.GetFiles("Resources\\DefaultTextures", usageType.ToString() + ".dds", SearchOption.AllDirectories);

            if (strings.Length == 0)
            {
                strings = Directory.GetFiles("Resources\\DefaultTextures", XivTexType.Other.ToString() + ".dds", SearchOption.AllDirectories);
            }
            return(new DirectoryInfo(strings[0]));
        }
        /// <summary>
        /// Gets the map from the path
        /// </summary>
        /// <param name="modPath">The mod path</param>
        /// <returns>The map</returns>
        private string GetMap(string modPath)
        {
            XivTexType xivTexType = XivTexType.Other;

            if (modPath.Contains(".mdl"))
            {
                return("3D");
            }

            if (modPath.Contains(".mtrl"))
            {
                return("ColorSet");
            }

            if (modPath.Contains("ui/"))
            {
                string subString = modPath.Substring(modPath.IndexOf("/") + 1);
                return(subString.Substring(0, subString.IndexOf("/")));
            }

            if (modPath.Contains("_s.tex") || modPath.Contains("skin_m"))
            {
                xivTexType = XivTexType.Specular;
            }
            else if (modPath.Contains("_d.tex"))
            {
                xivTexType = XivTexType.Diffuse;
            }
            else if (modPath.Contains("_n.tex"))
            {
                xivTexType = XivTexType.Normal;
            }
            else if (modPath.Contains("_m.tex"))
            {
                xivTexType = XivTexType.Multi;
            }
            else if (modPath.Contains(".atex"))
            {
                string atex = Path.GetFileNameWithoutExtension(modPath);
                return(atex.Substring(0, 4));
            }
            else if (modPath.Contains("decal"))
            {
                xivTexType = XivTexType.Mask;
            }

            return(xivTexType.ToString());
        }