diff --git a/TrueCraft.Client/Rendering/TextureMapper.cs b/TrueCraft.Client/Rendering/TextureMapper.cs index f442291..0d2020a 100644 --- a/TrueCraft.Client/Rendering/TextureMapper.cs +++ b/TrueCraft.Client/Rendering/TextureMapper.cs @@ -96,7 +96,7 @@ namespace TrueCraft.Client.Rendering // they're unimportant as we can just use default textures. try { - var archive = new ZipFile(Path.Combine(TexturePack.TexturePackPath, texturePack.Name)); + var archive = new ZipFile(Path.Combine(Paths.TexturePacks, texturePack.Name)); foreach (var entry in archive.Entries) { var key = entry.FileName; diff --git a/TrueCraft.Client/TrueCraftGame.cs b/TrueCraft.Client/TrueCraftGame.cs index a81e455..86f138c 100644 --- a/TrueCraft.Client/TrueCraftGame.cs +++ b/TrueCraft.Client/TrueCraftGame.cs @@ -208,7 +208,8 @@ namespace TrueCraft.Client // Load any custom textures if needed. TextureMapper = new TextureMapper(GraphicsDevice); if (UserSettings.Local.SelectedTexturePack != TexturePack.Default.Name) - TextureMapper.AddTexturePack(TexturePack.FromArchive(Path.Combine(TexturePack.TexturePackPath, UserSettings.Local.SelectedTexturePack))); + TextureMapper.AddTexturePack(TexturePack.FromArchive(Path.Combine(Paths.TexturePacks, + UserSettings.Local.SelectedTexturePack))); Pixel = new FontRenderer( new Font(Content, "Fonts/Pixel"), diff --git a/TrueCraft.Core/Paths.cs b/TrueCraft.Core/Paths.cs index 5f33ff2..e655362 100644 --- a/TrueCraft.Core/Paths.cs +++ b/TrueCraft.Core/Paths.cs @@ -61,5 +61,13 @@ namespace TrueCraft.Core return Path.Combine(Base, "screenshots"); } } + + public static string TexturePacks + { + get + { + return Path.Combine(Base, "texturepacks"); + } + } } } \ No newline at end of file diff --git a/TrueCraft.Core/TexturePack.cs b/TrueCraft.Core/TexturePack.cs index e9c735a..dd2c1be 100644 --- a/TrueCraft.Core/TexturePack.cs +++ b/TrueCraft.Core/TexturePack.cs @@ -9,38 +9,16 @@ namespace TrueCraft.Core /// public class TexturePack { - /// - /// - /// public static readonly TexturePack Unknown = new TexturePack( "?", File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/default-pack.png")), File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/default-pack.txt"))); - /// - /// - /// public static readonly TexturePack Default = new TexturePack( "Default", File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/pack.png")), File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/pack.txt"))); - /// - /// - /// - public static string TexturePackPath - { - get - { - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), - ".truecraft/texturepacks/"); - } - } - - /// - /// - /// - /// public static TexturePack FromArchive(string path) { if (string.IsNullOrEmpty(path)) @@ -82,27 +60,12 @@ namespace TrueCraft.Core return new TexturePack(name, image, description); } - /// - /// - /// public string Name { get; private set; } - /// - /// - /// public Stream Image { get; private set; } - /// - /// - /// public string Description { get; private set; } - /// - /// - /// - /// - /// - /// public TexturePack(string name, Stream image, string description) { Name = name; diff --git a/TrueCraft.Launcher/Views/OptionView.cs b/TrueCraft.Launcher/Views/OptionView.cs index f9d4a62..703ccac 100644 --- a/TrueCraft.Launcher/Views/OptionView.cs +++ b/TrueCraft.Launcher/Views/OptionView.cs @@ -118,7 +118,7 @@ namespace TrueCraft.Launcher.Views OpenFolderButton.Clicked += (sender, e) => { - var dir = new DirectoryInfo(TexturePack.TexturePackPath); + var dir = new DirectoryInfo(Paths.TexturePacks); Process.Start(dir.FullName); }; @@ -188,11 +188,12 @@ namespace TrueCraft.Launcher.Views CopyBetweenZips("terrain.png", jar, zip); CopyBetweenZips("particles.png", jar, zip); - zip.Save(Path.Combine(TexturePack.TexturePackPath, "Minecraft.zip")); + zip.Save(Path.Combine(Paths.TexturePacks, "Minecraft.zip")); Application.Invoke(() => { OfficialAssetsProgress.Visible = false; - var texturePack = TexturePack.FromArchive(Path.Combine(TexturePack.TexturePackPath, "Minecraft.zip")); + var texturePack = TexturePack.FromArchive( + Path.Combine(Paths.TexturePacks, "Minecraft.zip")); _texturePacks.Add(texturePack); AddTexturePackRow(texturePack); }); @@ -239,10 +240,10 @@ namespace TrueCraft.Launcher.Views AddTexturePackRow(TexturePack.Default); // Make sure to create the texture pack directory if there is none. - if (!Directory.Exists(TexturePack.TexturePackPath)) - Directory.CreateDirectory(TexturePack.TexturePackPath); + if (!Directory.Exists(Paths.TexturePacks)) + Directory.CreateDirectory(Paths.TexturePacks); - var zips = Directory.EnumerateFiles(TexturePack.TexturePackPath); + var zips = Directory.EnumerateFiles(Paths.TexturePacks); bool officialPresent = false; foreach (var zip in zips) {