Save default texture pack, use default pack in launcher.

This commit is contained in:
UnknownShadow200 2015-11-07 06:34:26 +11:00
parent 5218124c6c
commit 14daffe9f0
5 changed files with 19 additions and 5 deletions

View File

@ -77,9 +77,13 @@ namespace ClassicalSharp {
string defTexturePack = "default.zip";
public string DefaultTexturePack {
get { return File.Exists( defTexturePack )
get {
return File.Exists( defTexturePack )
? defTexturePack : "default.zip"; }
set { defTexturePack = value; }
set {
defTexturePack = value;
Options.Set( OptionsKey.DefaultTexturePack, value );
}
}
void LoadAtlas( Bitmap bmp ) {

View File

@ -13,6 +13,7 @@ namespace ClassicalSharp {
public const string Speed = "speedmultiplier";
public const string ChatLines = "chatlines";
public const string ArialChatFont = "arialchatfont";
public const string DefaultTexturePack = "defaulttexpack";
public const string MouseLeft = "mouseleft";
public const string MouseMiddle = "mousemiddle";

View File

@ -69,7 +69,7 @@ namespace Launcher2 {
MakeButtonAt( "Singleplayer", Anchor.Centre, Anchor.Centre,
buttonWidth, buttonHeight, 0, 0,
(x, y) => Client.Start( "default.zip" ) );
(x, y) => Client.Start( "" ) );
MakeButtonAt( "Check for updates", Anchor.Centre, Anchor.Centre,
buttonWidth, buttonHeight, 0, 100,

View File

@ -12,9 +12,15 @@ namespace Launcher2 {
bool useTexture = false;
internal void TryLoadTexturePack() {
if( !File.Exists( "default.zip" ) ) return;
Options.Load();
string texPack = Options.Get( OptionsKey.DefaultTexturePack ) ?? "default.zip";
using( Stream fs = new FileStream( "default.zip", FileMode.Open, FileAccess.Read, FileShare.Read ) ) {
if( !File.Exists( texPack ) )
texPack = "default.zip";
if( !File.Exists( texPack ) )
return;
using( Stream fs = new FileStream( texPack, FileMode.Open, FileAccess.Read, FileShare.Read ) ) {
ZipReader reader = new ZipReader();
reader.ShouldProcessZipEntry = (f) => f == "terrain.png";

View File

@ -18,6 +18,9 @@ namespace Launcher2 {
public static bool Start( string args ) {
Process process = null;
Options.Load();
string texPack = Options.Get( OptionsKey.DefaultTexturePack ) ?? "default.zip";
args = args + " " + texPack;
if( !File.Exists( "ClassicalSharp.exe" ) )
return false;