fixed code to work with new resource settings interface.

This commit is contained in:
morkt 2018-01-08 20:04:23 +04:00
parent 2e2e447c42
commit cd4e1174af
56 changed files with 179 additions and 158 deletions

View File

@ -28,7 +28,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -161,7 +160,7 @@ namespace GameRes.Formats.AZSys
public override ResourceOptions GetDefaultOptions ()
{
return new AsbOptions { AsbKey = GetAsbKey (Settings.Default.AZScriptScheme) };
return new AsbOptions { AsbKey = GetAsbKey (Properties.Settings.Default.AZScriptScheme) };
}
public override object GetAccessWidget ()

View File

@ -40,7 +40,7 @@ namespace GameRes.Formats.Abel
}
[Export(typeof(ImageFormat))]
public class GpsFormat : BmpFormat
public class GpsFormat : ImageFormat
{
public override string Tag { get { return "GPS"; } }
public override string Description { get { return "ADVEngine compressed bitmap"; } }
@ -69,7 +69,7 @@ namespace GameRes.Formats.Abel
using (var stream = OpenGpsStream (file, gps.Compression, 0x54))
using (var input = BinaryStream.FromStream (stream, file.Name))
{
var bmp_info = base.ReadMetaData (input);
var bmp_info = Bmp.ReadMetaData (input);
if (null == bmp_info)
return null;
gps.BPP = bmp_info.BPP;
@ -83,7 +83,7 @@ namespace GameRes.Formats.Abel
file.Position = 0x29;
using (var stream = OpenGpsStream (file, gps.Compression, gps.UnpackedSize))
using (var input = BinaryStream.FromStream (stream, file.Name))
return base.Read (input, info);
return Bmp.Read (input, info);
}
public override void Write (Stream file, ImageData image)

View File

@ -32,7 +32,6 @@ using System.ComponentModel.Composition;
using System.Globalization;
using GameRes.Compression;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
namespace GameRes.Formats.Amaterasu
{
@ -322,8 +321,8 @@ namespace GameRes.Formats.Amaterasu
public override ResourceOptions GetDefaultOptions ()
{
return new AmiOptions {
UseBaseArchive = Settings.Default.AMIUseBaseArchive,
BaseArchive = Settings.Default.AMIBaseArchive,
UseBaseArchive = Properties.Settings.Default.AMIUseBaseArchive,
BaseArchive = Properties.Settings.Default.AMIBaseArchive,
};
}

View File

@ -27,9 +27,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
namespace GameRes.Formats.Ags
{
@ -101,7 +99,7 @@ namespace GameRes.Formats.Ags
public override ResourceOptions GetDefaultOptions ()
{
return new AgsOptions { Scheme = GetScheme (Settings.Default.AGSTitle) };
return new AgsOptions { Scheme = GetScheme (Properties.Settings.Default.AGSTitle) };
}
public override object GetAccessWidget ()

View File

@ -168,6 +168,7 @@
<Compile Include="Qlie\Encryption.cs" />
<Compile Include="RealLive\ArcKOE.cs" />
<Compile Include="RealLive\ArcSEEN.cs" />
<Compile Include="ResourceSettings.cs" />
<Compile Include="RPGMaker\ArcRGSS.cs" />
<Compile Include="RPM\ArcZENOS.cs" />
<Compile Include="rUGP\AudioRHA.cs" />
@ -774,7 +775,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="Properties\Settings.cs" />
<Compile Include="Strings\arcStrings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>

View File

@ -30,7 +30,6 @@ using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
namespace GameRes.Formats.PkWare
@ -154,14 +153,14 @@ namespace GameRes.Formats.PkWare
Encoding enc;
try
{
enc = Encoding.GetEncoding (Settings.Default.ZIPEncodingCP);
enc = Encoding.GetEncoding (Properties.Settings.Default.ZIPEncodingCP);
}
catch
{
enc = Encodings.cp932;
}
return new ZipOptions {
CompressionLevel = Settings.Default.ZIPCompression,
CompressionLevel = Properties.Settings.Default.ZIPCompression,
FileNameEncoding = enc,
};
}

View File

@ -29,7 +29,7 @@ using System.IO;
namespace GameRes.Formats.BeF
{
[Export(typeof(ImageFormat))]
public class AloFormat : BmpFormat
public class AloFormat : ImageFormat
{
public override string Tag { get { return "ALO"; } }
public override string Description { get { return "Obfuscated bitmap"; } }
@ -44,13 +44,13 @@ namespace GameRes.Formats.BeF
if (0 != header[0] || 0 != header[1])
return null;
using (var bmp = OpenAsBitmap (stream))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
public override ImageData Read (IBinaryStream stream, ImageMetaData info)
{
using (var bmp = OpenAsBitmap (stream))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
IBinaryStream OpenAsBitmap (IBinaryStream input)
@ -65,7 +65,7 @@ namespace GameRes.Formats.BeF
{
using (var bmp = new MemoryStream())
{
base.Write (bmp, image);
Bmp.Write (bmp, image);
file.WriteByte (0);
file.WriteByte (0);
bmp.Position = 2;

View File

@ -32,7 +32,7 @@ using GameRes.Compression;
namespace GameRes.Formats.BlackRainbow
{
[Export(typeof(ImageFormat))]
public class BmzFormat : BmpFormat
public class BmzFormat : ImageFormat
{
public override string Tag { get { return "BMZ"; } }
public override string Description { get { return "Compressed bitmap format"; } }
@ -43,7 +43,7 @@ namespace GameRes.Formats.BlackRainbow
{
using (var bmp = new MemoryStream())
{
base.Write (bmp, image);
Bmp.Write (bmp, image);
using (var output = new BinaryWriter (file, Encoding.ASCII, true))
{
output.Write (Signature);
@ -60,7 +60,7 @@ namespace GameRes.Formats.BlackRainbow
var header = file.ReadHeader (8);
using (var zstream = new ZLibStream (file.AsStream, CompressionMode.Decompress, true))
using (var bmp = new BinaryStream (zstream, file.Name))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
public override ImageData Read (IBinaryStream file, ImageMetaData info)
@ -69,7 +69,7 @@ namespace GameRes.Formats.BlackRainbow
using (var zstream = new ZLibStream (file.AsStream, CompressionMode.Decompress, true))
using (var input = new SeekableStream (zstream))
using (var bmp = new BinaryStream (input, file.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
}
}

View File

@ -32,7 +32,6 @@ using System.ComponentModel.Composition;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
using GameRes.Cryptography;
using GameRes.Utility;
@ -249,7 +248,7 @@ namespace GameRes.Formats.CatSystem
public override ResourceOptions GetDefaultOptions ()
{
return new IntOptions {
EncryptionInfo = Settings.Default.INTEncryption ?? new IntEncryptionInfo(),
EncryptionInfo = Properties.Settings.Default.INTEncryption ?? new IntEncryptionInfo(),
};
}
@ -258,7 +257,7 @@ namespace GameRes.Formats.CatSystem
var widget = w as GUI.WidgetINT;
if (null != widget)
{
Settings.Default.INTEncryption = widget.Info;
Properties.Settings.Default.INTEncryption = widget.Info;
return new IntOptions { EncryptionInfo = widget.Info };
}
return this.GetDefaultOptions();

View File

@ -32,7 +32,7 @@ using GameRes.Utility;
namespace GameRes.Formats.Crowd
{
[Export(typeof(ImageFormat))]
public class ZbmFormat : BmpFormat
public class ZbmFormat : ImageFormat
{
public override string Tag { get { return "ZBM"; } }
public override string Description { get { return "Crowd LZ-compressed bitmap"; } }
@ -52,7 +52,7 @@ namespace GameRes.Formats.Crowd
for (int i = 0; i < 54; ++i)
header[i] ^= 0xff;
using (var bmp = new BinMemoryStream (header, stream.Name))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
}
@ -74,7 +74,7 @@ namespace GameRes.Formats.Crowd
for (int i = 0; i < count; ++i)
data[i] ^= 0xff;
using (var bmp = new BinMemoryStream (data, stream.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
}

View File

@ -31,7 +31,6 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -321,7 +320,7 @@ namespace GameRes.Formats.Cyberworks
public override ResourceOptions GetDefaultOptions ()
{
return new BellOptions { Scheme = GetScheme (Settings.Default.BELLTitle) };
return new BellOptions { Scheme = GetScheme (Properties.Settings.Default.BELLTitle) };
}
public override object GetAccessWidget ()

View File

@ -28,7 +28,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Globalization;
using System.IO;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -193,8 +192,8 @@ namespace GameRes.Formats.Dac
public override ResourceOptions GetDefaultOptions ()
{
return new DpkOptions {
Key1 = Settings.Default.DPKKey1,
Key2 = Settings.Default.DPKKey2,
Key1 = Properties.Settings.Default.DPKKey1,
Key2 = Properties.Settings.Default.DPKKey2,
};
}
@ -205,9 +204,9 @@ namespace GameRes.Formats.Dac
{
uint result_key;
if (uint.TryParse (widget.Key1.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out result_key))
Settings.Default.DPKKey1 = result_key;
Properties.Settings.Default.DPKKey1 = result_key;
if (uint.TryParse (widget.Key2.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out result_key))
Settings.Default.DPKKey2 = result_key;
Properties.Settings.Default.DPKKey2 = result_key;
}
return this.GetDefaultOptions();
}

View File

@ -27,7 +27,6 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -168,7 +167,7 @@ namespace GameRes.Formats.DxLib
public override ResourceOptions GetDefaultOptions ()
{
return new MedOptions {
Encryption = GetEncryption (Settings.Default.MEDScriptScheme),
Encryption = GetEncryption (Properties.Settings.Default.MEDScriptScheme),
};
}

View File

@ -28,7 +28,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Text;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -179,8 +178,8 @@ namespace GameRes.Formats.Eagls
public override ResourceOptions GetDefaultOptions ()
{
IEntryEncryption enc = null;
if (!string.IsNullOrEmpty (Settings.Default.EAGLSEncryption))
KnownSchemes.TryGetValue (Settings.Default.EAGLSEncryption, out enc);
if (!string.IsNullOrEmpty (Properties.Settings.Default.EAGLSEncryption))
KnownSchemes.TryGetValue (Properties.Settings.Default.EAGLSEncryption, out enc);
return new EaglsOptions { Encryption = enc };
}

View File

@ -38,7 +38,7 @@ namespace GameRes.Formats.Eagls
}
[Export(typeof(ImageFormat))]
public class GrFormat : BmpFormat
public class GrFormat : ImageFormat
{
public override string Tag { get { return "GR"; } }
public override string Description { get { return "EAGLS engine compressed bitmap"; } }
@ -78,7 +78,7 @@ namespace GameRes.Formats.Eagls
using (var bmp = new BinaryStream (lzs, file.Name))
{
if (32 != info.BPP)
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
int stride = (int)info.Width*4;
var pixels = new byte[Math.Max (0x36, stride*info.Height)];
bmp.Read (pixels, 0, 0x36); // skip header

View File

@ -31,7 +31,6 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -244,8 +243,8 @@ namespace GameRes.Formats.Entis
public override ResourceOptions GetDefaultOptions ()
{
return new NoaOptions {
Scheme = Settings.Default.NOAScheme,
PassPhrase = Settings.Default.NOAPassPhrase,
Scheme = Properties.Settings.Default.NOAScheme,
PassPhrase = Properties.Settings.Default.NOAPassPhrase,
};
}

View File

@ -34,7 +34,6 @@ using GameRes.Utility;
using GameRes.Compression;
using GameRes.Cryptography;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
namespace GameRes.Formats.ExHibit
{
@ -130,7 +129,7 @@ namespace GameRes.Formats.ExHibit
public override ResourceOptions GetDefaultOptions ()
{
return new GyuOptions { Scheme = GetScheme (Settings.Default.GYUTitle) };
return new GyuOptions { Scheme = GetScheme (Properties.Settings.Default.GYUTitle) };
}
public override object GetAccessWidget ()

View File

@ -23,7 +23,6 @@
// IN THE SOFTWARE.
//
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using System;
using System.Collections.Generic;
@ -114,14 +113,14 @@ namespace GameRes.Formats.FC01
public override ResourceOptions GetDefaultOptions ()
{
return new McgOptions { Key = Settings.Default.MCGLastKey };
return new McgOptions { Key = Properties.Settings.Default.MCGLastKey };
}
public override ResourceOptions GetOptions (object widget)
{
var w = widget as GUI.WidgetMCG;
if (null != w)
Settings.Default.MCGLastKey = w.GetKey();
Properties.Settings.Default.MCGLastKey = w.GetKey ();
return GetDefaultOptions();
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -102,7 +101,7 @@ namespace GameRes.Formats.FC01
public override ImageData Read (IBinaryStream stream, ImageMetaData info)
{
var meta = (McgMetaData)info;
byte key = Settings.Default.MCGLastKey;
byte key = Properties.Settings.Default.MCGLastKey;
if (101 == meta.Version)
{
if (null == LastKey)
@ -127,14 +126,14 @@ namespace GameRes.Formats.FC01
public override ResourceOptions GetDefaultOptions ()
{
return new McgOptions { Key = Settings.Default.MCGLastKey };
return new McgOptions { Key = Properties.Settings.Default.MCGLastKey };
}
public override ResourceOptions GetOptions (object widget)
{
var w = widget as GUI.WidgetMCG;
if (null != w)
Settings.Default.MCGLastKey = w.GetKey();
Properties.Settings.Default.MCGLastKey = w.GetKey ();
return GetDefaultOptions();
}
@ -272,10 +271,10 @@ namespace GameRes.Formats.FC01
continue;
}
Transform();
Settings.Default.MCGLastKey = m_key;
Properties.Settings.Default.MCGLastKey = m_key;
return;
}
while (m_key != Settings.Default.MCGLastKey);
while (m_key != Properties.Settings.Default.MCGLastKey);
throw new UnknownEncryptionScheme();
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -94,7 +93,7 @@ namespace GameRes.Formats.Fs
public override ResourceOptions GetDefaultOptions ()
{
return new PdOptions { ScrambleContents = Settings.Default.PDScrambleContents };
return new PdOptions { ScrambleContents = Properties.Settings.Default.PDScrambleContents };
}
public override object GetCreationWidget ()

View File

@ -31,7 +31,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using GameRes.Utility;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
namespace GameRes.Formats.Ikura
{
@ -219,7 +218,7 @@ namespace GameRes.Formats.Ikura
public override ResourceOptions GetDefaultOptions ()
{
return new IsfOptions {
Secret = GetSecret (Settings.Default.ISFScheme) ?? new byte[0]
Secret = GetSecret (Properties.Settings.Default.ISFScheme) ?? new byte[0]
};
}

View File

@ -42,7 +42,7 @@ namespace GameRes.Formats.Unknown
}
[Export(typeof(ImageFormat))]
public class EgnFormat : BmpFormat
public class EgnFormat : ImageFormat
{
public override string Tag { get { return "EGN"; } }
public override string Description { get { return "LZSS-compressed BMP image"; } }
@ -73,7 +73,7 @@ namespace GameRes.Formats.Unknown
reader.Unpack();
using (var bmp = new BinMemoryStream (reader.Data, stream.Name))
{
var info = base.ReadMetaData (bmp);
var info = Bmp.ReadMetaData (bmp);
if (null == info)
return null;
return new EgnMetaData
@ -96,7 +96,7 @@ namespace GameRes.Formats.Unknown
var reader = new Reader (stream, meta.UnpackedSize, meta.Mode, meta.Flag);
reader.Unpack();
using (var bmp = new BinMemoryStream (reader.Data, stream.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
internal class Reader

View File

@ -31,7 +31,7 @@ using GameRes.Compression;
namespace GameRes.Formats
{
[Export(typeof(ImageFormat))]
public class Bm_Format : BmpFormat
public class Bm_Format : ImageFormat
{
public override string Tag { get { return "BM_"; } }
public override string Description { get { return "LZ-compressed bitmap"; } }
@ -52,7 +52,7 @@ namespace GameRes.Formats
lz.Config.FrameFill = 0x20;
lz.Config.FrameInitPos = 0x1000 - 0x10;
using (var bmp = new BinaryStream (lz, stream.Name))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
}
@ -65,7 +65,7 @@ namespace GameRes.Formats
lz.Config.FrameFill = 0x20;
lz.Config.FrameInitPos = 0x1000 - 0x10;
using (var bmp = new BinaryStream (lz, stream.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
}

View File

@ -29,7 +29,7 @@ using System.IO;
namespace GameRes.Formats
{
[Export(typeof(ImageFormat))]
public class MbImageFormat : BmpFormat
public class MbImageFormat : ImageFormat
{
public override string Tag { get { return "BMP/MB"; } }
public override string Description { get { return "Obfuscated bitmap"; } }
@ -43,13 +43,13 @@ namespace GameRes.Formats
if ('M' != c1 || 'B' != c2)
return null;
using (var bmp = OpenAsBitmap (stream))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
public override ImageData Read (IBinaryStream stream, ImageMetaData info)
{
using (var bmp = OpenAsBitmap (stream))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
protected IBinaryStream OpenAsBitmap (IBinaryStream input)
@ -64,7 +64,7 @@ namespace GameRes.Formats
{
using (var bmp = new MemoryStream())
{
base.Write (bmp, image);
Bmp.Write (bmp, image);
file.WriteByte ((byte)'M');
file.WriteByte ((byte)'B');
bmp.Position = 2;

View File

@ -30,7 +30,7 @@ using GameRes.Utility;
namespace GameRes.Formats.Sprite
{
[Export(typeof(ImageFormat))]
public class PicFormat : BmpFormat
public class PicFormat : ImageFormat
{
public override string Tag { get { return "PIC/SPRITE"; } }
public override string Description { get { return "Soft House Sprite bitmap format"; } }
@ -42,13 +42,13 @@ namespace GameRes.Formats.Sprite
public override ImageMetaData ReadMetaData (IBinaryStream file)
{
using (var bmp = OpenAsBitmap (file))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
public override ImageData Read (IBinaryStream file, ImageMetaData info)
{
using (var bmp = OpenAsBitmap (file))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
IBinaryStream OpenAsBitmap (IBinaryStream input)
@ -66,7 +66,7 @@ namespace GameRes.Formats.Sprite
{
using (var bmp = new MemoryStream())
{
base.Write (bmp, image);
Bmp.Write (bmp, image);
var header = new byte[HeaderSize];
header[0] = (byte)'P';
header[1] = (byte)'I';

View File

@ -30,7 +30,7 @@ using System.IO;
namespace GameRes.Formats.Misc
{
[Export(typeof(ImageFormat))]
public class PtiFormat : BmpFormat
public class PtiFormat : ImageFormat
{
public override string Tag { get { return "PTI"; } }
public override string Description { get { return "Custom BMP image"; } }
@ -43,7 +43,7 @@ namespace GameRes.Formats.Misc
if (null == header)
return null;
using (var bmp = new BinMemoryStream (header, stream.Name))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
byte[] ReadHeader (IBinaryStream stream)
@ -72,7 +72,7 @@ namespace GameRes.Formats.Misc
}
LittleEndian.Pack (length+0x36, image, 2);
using (var bmp = new BinMemoryStream (image, stream.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
public override void Write (Stream file, ImageData image)

View File

@ -37,7 +37,6 @@ using System.Diagnostics;
using GameRes.Compression;
using GameRes.Utility;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
namespace GameRes.Formats.KiriKiri
{
@ -348,11 +347,11 @@ NextEntry:
public override ResourceOptions GetDefaultOptions ()
{
return new Xp3Options {
Version = Settings.Default.XP3Version,
Scheme = GetScheme (Settings.Default.XP3Scheme),
CompressIndex = Settings.Default.XP3CompressHeader,
CompressContents = Settings.Default.XP3CompressContents,
RetainDirs = Settings.Default.XP3RetainStructure,
Version = Properties.Settings.Default.XP3Version,
Scheme = GetScheme (Properties.Settings.Default.XP3Scheme),
CompressIndex = Properties.Settings.Default.XP3CompressHeader,
CompressContents = Properties.Settings.Default.XP3CompressContents,
RetainDirs = Properties.Settings.Default.XP3RetainStructure,
};
}

View File

@ -31,7 +31,6 @@ using System.Linq;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -145,7 +144,7 @@ namespace GameRes.Formats.LiveMaker
public override ResourceOptions GetDefaultOptions ()
{
return new GalOptions { Key = KeyFromString (Settings.Default.GALKey) };
return new GalOptions { Key = KeyFromString (Properties.Settings.Default.GALKey) };
}
public override object GetAccessWidget ()

View File

@ -30,7 +30,6 @@ using System.IO;
using System.Linq;
using System.Text;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -342,7 +341,7 @@ namespace GameRes.Formats.Lucifen
public override ResourceOptions GetDefaultOptions ()
{
return new LuciOptions { Scheme = Settings.Default.LPKScheme };
return new LuciOptions { Scheme = Properties.Settings.Default.LPKScheme };
}
public override object GetAccessWidget ()

View File

@ -33,7 +33,6 @@ using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -61,15 +60,26 @@ namespace GameRes.Formats.Majiro
}
[Export(typeof(ImageFormat))]
public class RctFormat : ImageFormat
public sealed class RctFormat : ImageFormat
{
public override string Tag { get { return "RCT"; } }
public override string Description { get { return "Majiro game engine RGB image format"; } }
public override uint Signature { get { return 0x9a925a98; } }
public override bool CanWrite { get { return true; } }
public bool OverlayFrames = true;
public bool ApplyMask = true;
public RctFormat ()
{
Settings = new[] { OverlayFrames, ApplyMask };
}
LocalResourceSetting OverlayFrames = new LocalResourceSetting {
Name = "RCTOverlayFrames",
Text = "Automatically combine incremental frames",
};
LocalResourceSetting ApplyMask = new LocalResourceSetting {
Name = "RCTApplyMask",
Text = "Automatically load alpha-channel",
};
public const int BaseRecursionLimit = 8;
public static Dictionary<string, string> KnownKeys = new Dictionary<string, string>();
@ -129,11 +139,10 @@ namespace GameRes.Formats.Majiro
{
var meta = (RctMetaData)info;
var pixels = ReadPixelsData (file, meta);
if (ApplyMask)
if (ApplyMask.Get<bool>())
{
var base_name = Path.GetFileNameWithoutExtension (meta.FileName);
var mask_name = base_name + "_.rc8";
mask_name = VFS.CombinePath (VFS.GetDirectoryName (meta.FileName), mask_name);
var mask_name = Path.GetFileNameWithoutExtension (meta.FileName) + "_.rc8";
mask_name = VFS.ChangeFileName (meta.FileName, mask_name);
if (VFS.FileExists (mask_name))
{
try
@ -196,7 +205,7 @@ namespace GameRes.Formats.Majiro
byte[] ReadPixelsData (IBinaryStream file, RctMetaData meta)
{
byte[] base_image = null;
if (meta.FileName != null && meta.BaseNameLength > 0 && OverlayFrames
if (meta.FileName != null && meta.BaseNameLength > 0 && OverlayFrames.Get<bool>()
&& meta.BaseRecursionDepth < BaseRecursionLimit)
base_image = ReadBaseImage (file, meta);
@ -379,14 +388,14 @@ namespace GameRes.Formats.Majiro
public override ResourceOptions GetDefaultOptions ()
{
return new RctOptions { Password = Settings.Default.RCTPassword };
return new RctOptions { Password = Properties.Settings.Default.RCTPassword };
}
public override ResourceOptions GetOptions (object widget)
{
var w = widget as GUI.WidgetRCT;
if (null != w)
Settings.Default.RCTPassword = w.Password.Text;
Properties.Settings.Default.RCTPassword = w.Password.Text;
return GetDefaultOptions();
}

View File

@ -28,7 +28,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Text;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -178,7 +177,7 @@ namespace GameRes.Formats.Mg
public override ResourceOptions GetDefaultOptions ()
{
return new MgOptions { Key = GetKey (Settings.Default.MGPKTitle) };
return new MgOptions { Key = GetKey (Properties.Settings.Default.MGPKTitle) };
}
public override object GetAccessWidget ()

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
namespace GameRes.Formats.Marble
@ -206,7 +205,7 @@ namespace GameRes.Formats.Marble
public override ResourceOptions GetDefaultOptions ()
{
return new MblOptions { PassPhrase = Settings.Default.MBLPassPhrase };
return new MblOptions { PassPhrase = Properties.Settings.Default.MBLPassPhrase };
}
public override object GetAccessWidget ()

View File

@ -86,7 +86,7 @@ namespace GameRes.Formats.Mokopro
}
[Export(typeof(ImageFormat))]
public class NNNNBmpFormat : BmpFormat
public class NNNNBmpFormat : ImageFormat
{
public override string Tag { get { return "BMP/NNNN"; } }
public override string Description { get { return "Mokopro compressed bitmap"; } }
@ -104,7 +104,7 @@ namespace GameRes.Formats.Mokopro
using (var lzss = moko.UnpackStream())
using (var bmp = new BinaryStream (lzss, stream.Name))
{
var info = base.ReadMetaData (bmp);
var info = Bmp.ReadMetaData (bmp);
if (null == info)
return null;
return new NNNNMetaData
@ -123,7 +123,7 @@ namespace GameRes.Formats.Mokopro
var meta = (NNNNMetaData)info;
using (var lzss = meta.Input.UnpackStream())
using (var bmp = new BinaryStream (lzss, stream.Name))
return base.Read (bmp, meta.BmpInfo);
return Bmp.Read (bmp, meta.BmpInfo);
}
public override void Write (Stream file, ImageData image)

View File

@ -26,10 +26,8 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using GameRes.Compression;
using GameRes.Cryptography;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -358,7 +356,7 @@ namespace GameRes.Formats.Musica
public override ResourceOptions GetDefaultOptions ()
{
return new PazOptions { Scheme = GetScheme (Settings.Default.PAZTitle) };
return new PazOptions { Scheme = GetScheme (Properties.Settings.Default.PAZTitle) };
}
public override object GetAccessWidget ()

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
namespace GameRes.Formats.NScripter
@ -150,14 +149,14 @@ namespace GameRes.Formats.NScripter
public override ResourceOptions GetDefaultOptions ()
{
return new NsaOptions { Password = Settings.Default.NSAPassword };
return new NsaOptions { Password = Properties.Settings.Default.NSAPassword };
}
public override ResourceOptions GetOptions (object widget)
{
var w = widget as GUI.WidgetNSA;
if (null != w)
Settings.Default.NSAPassword = w.Password.Text;
Properties.Settings.Default.NSAPassword = w.Password.Text;
return GetDefaultOptions();
}

View File

@ -29,7 +29,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Text;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
using GameRes.Utility;
namespace GameRes.Formats.NScripter
@ -203,8 +202,8 @@ namespace GameRes.Formats.NScripter
public override ResourceOptions GetDefaultOptions ()
{
return new NsaOptions {
CompressionType = Settings.Default.ONSCompression,
Password = Settings.Default.NSAPassword,
CompressionType = Properties.Settings.Default.ONSCompression,
Password = Properties.Settings.Default.NSAPassword,
};
}
@ -212,7 +211,7 @@ namespace GameRes.Formats.NScripter
{
var w = widget as GUI.WidgetNSA;
if (null != w)
Settings.Default.NSAPassword = w.Password.Text;
Properties.Settings.Default.NSAPassword = w.Password.Text;
return GetDefaultOptions();
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -118,7 +117,7 @@ namespace GameRes.Formats.NSystem
public override ResourceOptions GetDefaultOptions ()
{
return new FjsysOptions { MsdPassword = Settings.Default.FJSYSPassword };
return new FjsysOptions { MsdPassword = Properties.Settings.Default.FJSYSPassword };
}
public override object GetAccessWidget ()

View File

@ -382,10 +382,10 @@ namespace GameRes.Formats.NitroPlus
public override ResourceOptions GetDefaultOptions ()
{
return new NpaOptions {
Scheme = GetScheme (Settings.Default.NPAScheme),
CompressContents = Settings.Default.NPACompressContents,
Key1 = (int)Settings.Default.NPAKey1,
Key2 = (int)Settings.Default.NPAKey2,
Scheme = GetScheme (Properties.Settings.Default.NPAScheme),
CompressContents = Properties.Settings.Default.NPACompressContents,
Key1 = (int)Properties.Settings.Default.NPAKey1,
Key2 = (int)Properties.Settings.Default.NPAKey2,
};
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -202,7 +201,7 @@ namespace GameRes.Formats.NitroPlus
public override ResourceOptions GetDefaultOptions ()
{
return new Npk2Options { Key = GetKey (Settings.Default.NPKScheme) };
return new Npk2Options { Key = GetKey (Properties.Settings.Default.NPKScheme) };
}
public override object GetAccessWidget ()

View File

@ -30,7 +30,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using GameRes.Formats.Strings;
using GameRes.Utility;
using GameRes.Formats.Properties;
namespace GameRes.Formats
{
@ -138,7 +137,7 @@ namespace GameRes.Formats
public override ResourceOptions GetDefaultOptions ()
{
return new SteinsGateOptions {
FileNameEncoding = GetEncoding (Settings.Default.SGFileNameEncoding),
FileNameEncoding = GetEncoding (Properties.Settings.Default.SGFileNameEncoding),
};
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using GameRes.Compression;
using GameRes.Utility;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
namespace GameRes.Formats.NonColor
@ -282,7 +281,7 @@ namespace GameRes.Formats.NonColor
public override ResourceOptions GetDefaultOptions ()
{
return new ArcDatOptions { Scheme = Settings.Default.NCARCScheme };
return new ArcDatOptions { Scheme = Properties.Settings.Default.NCARCScheme };
}
public override object GetAccessWidget ()

View File

@ -681,5 +681,29 @@ namespace GameRes.Formats.Properties {
this["PCKTitle"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool RCTOverlayFrames {
get {
return ((bool)(this["RCTOverlayFrames"]));
}
set {
this["RCTOverlayFrames"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool RCTApplyMask {
get {
return ((bool)(this["RCTApplyMask"]));
}
set {
this["RCTApplyMask"] = value;
}
}
}
}

View File

@ -167,5 +167,11 @@
<Setting Name="PCKTitle" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="RCTOverlayFrames" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="RCTApplyMask" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -30,7 +30,6 @@ using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using GameRes.Utility;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Formats.Borland;
@ -281,7 +280,7 @@ namespace GameRes.Formats.Qlie
public override ResourceOptions GetDefaultOptions ()
{
return new QlieOptions {
GameKeyData = GetKeyData (Settings.Default.QLIEScheme)
GameKeyData = GetKeyData (Properties.Settings.Default.QLIEScheme)
};
}

View File

@ -30,7 +30,6 @@ using System.IO;
using System.Text;
using GameRes.Compression;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
using GameRes.Utility;
namespace GameRes.Formats.Rpm
@ -126,7 +125,7 @@ namespace GameRes.Formats.Rpm
public override ResourceOptions GetDefaultOptions ()
{
return new RpmOptions {
Scheme = GetScheme (Settings.Default.RPMScheme),
Scheme = GetScheme (Properties.Settings.Default.RPMScheme),
};
}

View File

@ -33,7 +33,6 @@ using System.Numerics;
using System.IO;
using System.Text;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
namespace GameRes.Formats.RenPy
@ -134,7 +133,7 @@ namespace GameRes.Formats.RenPy
public override ResourceOptions GetDefaultOptions ()
{
return new RpaOptions { Key = Settings.Default.RPAKey };
return new RpaOptions { Key = Properties.Settings.Default.RPAKey };
}
public override object GetCreationWidget ()

View File

@ -0,0 +1,15 @@
//! \file ResourceSettings.cs
//! \date 2018 Jan 08
//! \brief Persistent resource settings implementation.
//
namespace GameRes.Formats
{
internal class LocalResourceSetting : ResourceSettingBase
{
public override object Value {
get { return Properties.Settings.Default[Name]; }
set { Properties.Settings.Default[Name] = value; }
}
}
}

View File

@ -32,7 +32,7 @@ using GameRes.Utility;
namespace GameRes.Formats.ScenePlayer
{
[Export(typeof(ImageFormat))]
public class PmpFormat : BmpFormat
public class PmpFormat : ImageFormat
{
public override string Tag { get { return "PMP"; } }
public override string Description { get { return "ScenePlayer compressed bitmap format"; } }
@ -43,7 +43,7 @@ namespace GameRes.Formats.ScenePlayer
{
using (var output = new XoredStream (file, 0x21, true))
using (var zstream = new ZLibStream (output, CompressionMode.Compress, CompressionLevel.Level9))
base.Write (zstream, image);
Bmp.Write (zstream, image);
}
public override ImageMetaData ReadMetaData (IBinaryStream stream)
@ -55,7 +55,7 @@ namespace GameRes.Formats.ScenePlayer
using (var input = new XoredStream (stream.AsStream, 0x21, true))
using (var zstream = new ZLibStream (input, CompressionMode.Decompress))
using (var bmp = new BinaryStream (zstream, stream.Name))
return base.ReadMetaData (bmp);
return Bmp.ReadMetaData (bmp);
}
public override ImageData Read (IBinaryStream stream, ImageMetaData info)
@ -63,7 +63,7 @@ namespace GameRes.Formats.ScenePlayer
using (var input = new XoredStream (stream.AsStream, 0x21, true))
using (var zstream = new ZLibStream (input, CompressionMode.Decompress))
using (var bmp = new BinaryStream (zstream, stream.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
}
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.Security.Cryptography;
using System.IO;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
namespace GameRes.Formats.Selene
{
@ -145,7 +144,7 @@ namespace GameRes.Formats.Selene
public override ResourceOptions GetDefaultOptions ()
{
return new KcapOptions {
PassPhrase = Settings.Default.KCAPPassPhrase,
PassPhrase = Properties.Settings.Default.KCAPPassPhrase,
};
}

View File

@ -29,7 +29,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -285,7 +284,7 @@ namespace GameRes.Formats.ShiinaRio // 椎名里緒
public override ResourceOptions GetDefaultOptions ()
{
return new WarOptions {
Scheme = GetScheme (Settings.Default.WARCScheme),
Scheme = GetScheme (Properties.Settings.Default.WARCScheme),
};
}

View File

@ -28,9 +28,7 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using GameRes.Compression;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -384,10 +382,10 @@ namespace GameRes.Formats.Tactics
public override ResourceOptions GetDefaultOptions ()
{
string title = Settings.Default.TacticsArcTitle;
string title = Properties.Settings.Default.TacticsArcTitle;
ArcScheme scheme = null;
if (!KnownSchemes.TryGetValue (title, out scheme) && !string.IsNullOrEmpty (Settings.Default.TacticsArcPassword))
scheme = new ArcScheme (Settings.Default.TacticsArcPassword);
if (!KnownSchemes.TryGetValue (title, out scheme) && !string.IsNullOrEmpty (Properties.Settings.Default.TacticsArcPassword))
scheme = new ArcScheme (Properties.Settings.Default.TacticsArcPassword);
return new TacticsOptions { Scheme = scheme };
}

View File

@ -28,12 +28,10 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using GameRes.Cryptography;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
namespace GameRes.Formats.Tamamo
@ -209,7 +207,7 @@ namespace GameRes.Formats.Tamamo
public override ResourceOptions GetDefaultOptions ()
{
return new PckOptions {
Key = GetKeyForTitle (Settings.Default.PCKTitle)
Key = GetKeyForTitle (Properties.Settings.Default.PCKTitle)
};
}

View File

@ -41,7 +41,7 @@ namespace GameRes.Formats.Triangle
}
[Export(typeof(ImageFormat))]
public class IafFormat : BmpFormat
public class IafFormat : ImageFormat
{
public override string Tag { get { return "IAF"; } }
public override string Description { get { return "Triangle compressed bitmap format"; } }
@ -152,7 +152,7 @@ namespace GameRes.Formats.Triangle
}
}
using (var bmp = new BinMemoryStream (bitmap, stream.Name))
return base.Read (bmp, info);
return Bmp.Read (bmp, info);
}
internal static byte[] UnpackBitmap (Stream stream, int pack_type, int packed_size, int unpacked_size)

View File

@ -28,7 +28,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using GameRes.Formats.Properties;
using GameRes.Formats.Strings;
using GameRes.Utility;
@ -145,7 +144,7 @@ namespace GameRes.Formats.Will
public override ResourceOptions GetDefaultOptions ()
{
return new ArcOptions { NameLength = Settings.Default.ARCNameLength };
return new ArcOptions { NameLength = Properties.Settings.Default.ARCNameLength };
}
public override object GetCreationWidget ()

View File

@ -30,7 +30,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using GameRes.Compression;
using GameRes.Formats.Strings;
using GameRes.Formats.Properties;
using GameRes.Utility;
namespace GameRes.Formats.YuRis
@ -159,9 +158,9 @@ namespace GameRes.Formats.YuRis
{
return new YpfOptions
{
Key = Settings.Default.YPFKey,
Version = Settings.Default.YPFVersion,
Scheme = Settings.Default.YPFScheme,
Key = Properties.Settings.Default.YPFKey,
Version = Properties.Settings.Default.YPFVersion,
Scheme = Properties.Settings.Default.YPFScheme,
};
}

View File

@ -169,6 +169,12 @@
<setting name="PCKTitle" serializeAs="String">
<value />
</setting>
<setting name="RCTOverlayFrames" serializeAs="String">
<value>True</value>
</setting>
<setting name="RCTApplyMask" serializeAs="String">
<value>True</value>
</setting>
</GameRes.Formats.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>