mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(ArcFile.OpenView): ensure that length supplied to ArcView is always greater than zero.
This commit is contained in:
parent
da42dcdd9d
commit
08cd673408
@ -161,9 +161,22 @@ namespace GameRes
|
||||
if (stream.CanSeek)
|
||||
size = (uint)stream.Length;
|
||||
else if (null != packed_entry && packed_entry.IsPacked)
|
||||
{
|
||||
size = packed_entry.UnpackedSize;
|
||||
if (0 == size)
|
||||
{
|
||||
using (var copy = new MemoryStream())
|
||||
{
|
||||
stream.CopyTo (copy);
|
||||
copy.Position = 0;
|
||||
return new ArcView (copy, entry.Name, (uint)copy.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
size = entry.Size;
|
||||
if (0 == size)
|
||||
throw new FileSizeException (Strings.garStrings.MsgFileIsEmpty);
|
||||
return new ArcView (stream, entry.Name, size);
|
||||
}
|
||||
}
|
||||
|
11
GameRes/Strings/garStrings.Designer.cs
generated
11
GameRes/Strings/garStrings.Designer.cs
generated
@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@ -60,6 +60,15 @@ namespace GameRes.Strings {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File is empty.
|
||||
/// </summary>
|
||||
public static string MsgFileIsEmpty {
|
||||
get {
|
||||
return ResourceManager.GetString("MsgFileIsEmpty", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File is too large.
|
||||
/// </summary>
|
||||
|
@ -117,6 +117,10 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||
<value>File is empty</value>
|
||||
<comment>translation pending</comment>
|
||||
</data>
|
||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||
<value>파일이 너무 큽니다</value>
|
||||
</data>
|
||||
@ -135,4 +139,4 @@
|
||||
<data name="MsgUnknownFormat" xml:space="preserve">
|
||||
<value>파일을 리소스 아카이브로 열지 못하였습니다</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||
<value>File is empty</value>
|
||||
</data>
|
||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||
<value>File is too large</value>
|
||||
</data>
|
||||
|
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||
<value>Файл пуст</value>
|
||||
</data>
|
||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||
<value>Слишком большой размер файла</value>
|
||||
</data>
|
||||
|
@ -117,6 +117,10 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||
<value>File is empty</value>
|
||||
<comment>translation pending</comment>
|
||||
</data>
|
||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||
<value>文件尺寸太大。</value>
|
||||
</data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user