mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 20:39:29 +08:00
(EncodingSetting): fallback to CP932.
This commit is contained in:
parent
a7241004f5
commit
44e74d68b3
@ -186,18 +186,9 @@ namespace GameRes.Formats.PkWare
|
|||||||
|
|
||||||
public override ResourceOptions GetDefaultOptions ()
|
public override ResourceOptions GetDefaultOptions ()
|
||||||
{
|
{
|
||||||
Encoding enc;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
enc = ZipEncoding.Get<Encoding>();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
enc = Encodings.cp932;
|
|
||||||
}
|
|
||||||
return new ZipOptions {
|
return new ZipOptions {
|
||||||
CompressionLevel = Properties.Settings.Default.ZIPCompression,
|
CompressionLevel = Properties.Settings.Default.ZIPCompression,
|
||||||
FileNameEncoding = enc,
|
FileNameEncoding = ZipEncoding.Get<Encoding>(),
|
||||||
Password = Properties.Settings.Default.ZIPPassword,
|
Password = Properties.Settings.Default.ZIPPassword,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
//! \brief Persistent resource settings implementation.
|
//! \brief Persistent resource settings implementation.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GameRes.Formats.Strings;
|
using GameRes.Formats.Strings;
|
||||||
|
|
||||||
@ -27,8 +29,20 @@ namespace GameRes.Formats
|
|||||||
|
|
||||||
internal class EncodingSetting : LocalResourceSetting
|
internal class EncodingSetting : LocalResourceSetting
|
||||||
{
|
{
|
||||||
|
static readonly Encoding DefaultEncoding = Encodings.cp932;
|
||||||
|
|
||||||
public override object Value {
|
public override object Value {
|
||||||
get { return Encoding.GetEncoding ((int)base.Value); }
|
get {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Encoding.GetEncoding ((int)base.Value);
|
||||||
|
}
|
||||||
|
catch // fallback to CP932
|
||||||
|
{
|
||||||
|
Trace.WriteLine (string.Format ("Unknown encoding code page {0}", base.Value));
|
||||||
|
return DefaultEncoding;
|
||||||
|
}
|
||||||
|
}
|
||||||
set { base.Value = ((Encoding)value).CodePage; }
|
set { base.Value = ((Encoding)value).CodePage; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user