mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(EncodingSetting): fallback to CP932.
This commit is contained in:
@@ -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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user