Ejemplo n.º 1
0
        /// <summary>
        ///     Search and return the correct <see cref="ScTexture" /> according to the given <see cref="ScInfo" /> file, and the
        ///     specified resolution.
        /// </summary>
        /// <param name="Path">The path.</param>
        public static ScTexture GetScTextureFile(ScInfo ScInfo)
        {
            ScTexture ScFile = ScFiles.Textures.Find(T => ScInfo.ScName == T.ScName);

            if (ScFile != null)
            {
                return(ScFile);
            }

            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Search and return the correct <see cref="ScTexture" /> according to the given <see cref="ScInfo" /> file, and the
        ///     specified resolution.
        /// </summary>
        /// <param name="Path">The path.</param>
        /// <param name="HighRes">The resolution.</param>
        public static ScTexture GetScTextureFile(ScInfo ScInfo, bool HighRes)
        {
            ScTexture ScFile = ScFiles.Textures.Find(T => ScInfo.ScName == T.ScName && T.IsHighRes == HighRes);

            if (ScFile != null)
            {
                return(ScFile);
            }

            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Initializes this instance.
        /// </summary>
        public static void Initialize()
        {
            if (ScFiles.Initialized)
            {
                return;
            }

            string[] Files = Directory.GetFiles("Gamefiles/sc/", "*.sc");

            ScFiles.Textures = new List <ScTexture>(Files.Length);
            ScFiles.Infos    = new List <ScInfo>(Files.Length);

            foreach (string FilePath in Files)
            {
                FileInfo File = new FileInfo(FilePath);

                if (FilePath.EndsWith("_tex.sc"))
                {
                    ScFiles.Textures.Add(new ScTexture(File));
                }
                else
                {
                    ScFiles.Infos.Add(new ScInfo(File));
                }
            }

            Task.Run(() =>
            {
                foreach (ScTexture ScTexture in ScFiles.Textures)
                {
                    ScTexture.Read();
                }

                foreach (ScInfo ScInfo in ScFiles.Infos)
                {
                    ScInfo.Read();
                }
            });

            ScFiles.Initialized = true;

            Logging.Info(typeof(ScFiles), "Loaded " + Files.Length + " SC files.");
        }