Exemplo n.º 1
0
        /// <summary>
        /// Will attempt to get a skin element from the skin, if no element is found return null
        /// </summary>
        /// <param name="skin"></param>
        /// <param name="fileName"></param>
        /// <param name="storage"></param>
        /// <returns></returns>
        public static Texture GetElement(Bindable <string> skin, string fileName, Storage storage)
        {
            Texture texture = null;

            string fileNameHd = fileName + "@2x";

            Storage skinStorage = storage.GetStorageForDirectory("Skins\\" + skin);

            if (loadedSkin != skin.ToString())
            {
                loadedSkin    = skin.ToString();
                skinResources = new ResourceStore <byte[]>(new StorageBackedResourceStore(skinStorage));
                //skinTextures = new TextureStore(new RawTextureLoaderStore(skinResources));
            }

            if (skinStorage.Exists(fileNameHd + ".png"))
            {
                texture = skinTextures.Get(fileNameHd + ".png");
            }
            else if (skinStorage.Exists(fileName + ".png"))
            {
                texture             = skinTextures.Get(fileName + ".png");
                texture.ScaleAdjust = 1f;
            }
            else
            {
                texture = null;
            }

            return(texture);
        }
Exemplo n.º 2
0
        private string getFilename()
        {
            var    dt      = DateTime.Now;
            string fileExt = screenshotFormat.ToString().ToLowerInvariant();

            string withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}";

            if (!storage.Exists(withoutIndex))
            {
                return(withoutIndex);
            }

            for (ulong i = 1; i < ulong.MaxValue; i++)
            {
                string indexedName = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}-{i}.{fileExt}";
                if (!storage.Exists(indexedName))
                {
                    return(indexedName);
                }
            }

            return(null);
        }