mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04: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)
|
if (stream.CanSeek)
|
||||||
size = (uint)stream.Length;
|
size = (uint)stream.Length;
|
||||||
else if (null != packed_entry && packed_entry.IsPacked)
|
else if (null != packed_entry && packed_entry.IsPacked)
|
||||||
|
{
|
||||||
size = packed_entry.UnpackedSize;
|
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
|
else
|
||||||
size = entry.Size;
|
size = entry.Size;
|
||||||
|
if (0 == size)
|
||||||
|
throw new FileSizeException (Strings.garStrings.MsgFileIsEmpty);
|
||||||
return new ArcView (stream, entry.Name, size);
|
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>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// 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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to File is too large.
|
/// Looks up a localized string similar to File is too large.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -117,6 +117,10 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||||
|
<value>File is empty</value>
|
||||||
|
<comment>translation pending</comment>
|
||||||
|
</data>
|
||||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||||
<value>파일이 너무 큽니다</value>
|
<value>파일이 너무 큽니다</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -117,6 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||||
|
<value>File is empty</value>
|
||||||
|
</data>
|
||||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||||
<value>File is too large</value>
|
<value>File is too large</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -117,6 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||||
|
<value>Файл пуст</value>
|
||||||
|
</data>
|
||||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||||
<value>Слишком большой размер файла</value>
|
<value>Слишком большой размер файла</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -117,6 +117,10 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="MsgFileIsEmpty" xml:space="preserve">
|
||||||
|
<value>File is empty</value>
|
||||||
|
<comment>translation pending</comment>
|
||||||
|
</data>
|
||||||
<data name="MsgFileTooLarge" xml:space="preserve">
|
<data name="MsgFileTooLarge" xml:space="preserve">
|
||||||
<value>文件尺寸太大。</value>
|
<value>文件尺寸太大。</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user