implemented archive creation frontend.

This commit is contained in:
morkt
2014-07-25 07:05:55 +04:00
parent 0442ac5761
commit 3a7d2111be
11 changed files with 278 additions and 223 deletions

View File

@@ -144,10 +144,10 @@ namespace GameRes
}
/// <summary>
/// Create resource archive named <paramref name="filename"/> containing entries from the
/// Create resource wihin stream <paramref name="file"/> containing entries from the
/// supplied <paramref name="list"/> and applying necessary <paramref name="options"/>.
/// </summary>
public virtual void Create (string filename, IEnumerable<Entry> list, ResourceOptions options = null)
public virtual void Create (Stream file, IEnumerable<Entry> list, ResourceOptions options = null)
{
throw new NotImplementedException ("ArchiveFormat.Create is not implemented");
}
@@ -329,7 +329,7 @@ namespace GameRes
}
}
public class InvalidFormatException : Exception
public class InvalidFormatException : FileFormatException
{
public InvalidFormatException() : base(garStrings.MsgInvalidFormat) { }
public InvalidFormatException (string msg) : base (msg) { }
@@ -346,4 +346,37 @@ namespace GameRes
public InvalidEncryptionScheme() : base(garStrings.MsgInvalidEncryption) { }
public InvalidEncryptionScheme (string msg) : base (msg) { }
}
public class FileSizeException : Exception
{
public FileSizeException () : base (garStrings.MsgFileTooLarge) { }
public FileSizeException (string msg) : base (msg) { }
}
public class InvalidFileName : Exception
{
public string FileName { get; set; }
public InvalidFileName (string filename)
: this (filename, garStrings.MsgInvalidFileName)
{
}
public InvalidFileName (string filename, string message)
: base (message)
{
FileName = filename;
}
public InvalidFileName (string filename, Exception X)
: this (filename, garStrings.MsgInvalidFileName, X)
{
}
public InvalidFileName (string filename, string message, Exception X)
: base (message, X)
{
FileName = filename;
}
}
}

View File

@@ -60,6 +60,15 @@ namespace GameRes.Strings {
}
}
/// <summary>
/// Looks up a localized string similar to File is too large.
/// </summary>
public static string MsgFileTooLarge {
get {
return ResourceManager.GetString("MsgFileTooLarge", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Inappropriate encryption scheme.
/// </summary>
@@ -69,6 +78,15 @@ namespace GameRes.Strings {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid file name.
/// </summary>
public static string MsgInvalidFileName {
get {
return ResourceManager.GetString("MsgInvalidFileName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid file format.
/// </summary>

View File

@@ -117,9 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MsgFileTooLarge" xml:space="preserve">
<value>File is too large</value>
</data>
<data name="MsgInvalidEncryption" xml:space="preserve">
<value>Inappropriate encryption scheme</value>
</data>
<data name="MsgInvalidFileName" xml:space="preserve">
<value>Invalid file name</value>
</data>
<data name="MsgInvalidFormat" xml:space="preserve">
<value>Invalid file format</value>
</data>

View File

@@ -117,9 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MsgFileTooLarge" xml:space="preserve">
<value>Слишком большой размер файла</value>
</data>
<data name="MsgInvalidEncryption" xml:space="preserve">
<value>Неподходящий метод шифрования</value>
</data>
<data name="MsgInvalidFileName" xml:space="preserve">
<value>Недопустимое имя файла</value>
</data>
<data name="MsgInvalidFormat" xml:space="preserve">
<value>Некорректный формат файла</value>
</data>