mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Add support for choosing character encoding in appropiate command.
This commit is contained in:
@@ -39,6 +39,7 @@ using DiscImageChef.Filesystems;
|
||||
using DiscImageChef.Filters;
|
||||
using DiscImageChef.ImagePlugins;
|
||||
using DiscImageChef.PartPlugins;
|
||||
using System.Text;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
@@ -61,8 +62,26 @@ namespace DiscImageChef.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Encoding encoding = null;
|
||||
|
||||
if(options.EncodingName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName);
|
||||
if(options.Verbose)
|
||||
DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName);
|
||||
}
|
||||
catch(ArgumentException)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Specified encoding is not supported.");
|
||||
encoding = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = new PluginBase();
|
||||
plugins.RegisterAllPlugins();
|
||||
plugins.RegisterAllPlugins(encoding);
|
||||
|
||||
List<string> id_plugins;
|
||||
Filesystem _plugin;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Core;
|
||||
using DiscImageChef.Filters;
|
||||
@@ -53,6 +54,25 @@ namespace DiscImageChef.Commands
|
||||
Sidecar.EndProgressEvent2 += Progress.EndProgress2;
|
||||
Sidecar.UpdateStatusEvent += Progress.UpdateStatus;
|
||||
|
||||
|
||||
Encoding encoding = null;
|
||||
|
||||
if(options.EncodingName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName);
|
||||
if(options.Verbose)
|
||||
DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName);
|
||||
}
|
||||
catch(ArgumentException)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Specified encoding is not supported.");
|
||||
encoding = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(File.Exists(options.InputFile))
|
||||
{
|
||||
if(options.Tape)
|
||||
@@ -110,7 +130,7 @@ namespace DiscImageChef.Commands
|
||||
Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat());
|
||||
Core.Statistics.AddFilter(inputFilter.Name);
|
||||
|
||||
CICMMetadataType sidecar = Sidecar.Create(_imageFormat, options.InputFile, inputFilter.UUID);
|
||||
CICMMetadataType sidecar = Sidecar.Create(_imageFormat, options.InputFile, inputFilter.UUID, encoding);
|
||||
|
||||
DicConsole.WriteLine("Writing metadata sidecar");
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ using System.IO;
|
||||
using DiscImageChef.Filters;
|
||||
using DiscImageChef.Core;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using System.Text;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
@@ -62,8 +63,26 @@ namespace DiscImageChef.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Encoding encoding = null;
|
||||
|
||||
if(options.EncodingName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName);
|
||||
if(options.Verbose)
|
||||
DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName);
|
||||
}
|
||||
catch(ArgumentException)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Specified encoding is not supported.");
|
||||
encoding = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = new PluginBase();
|
||||
plugins.RegisterAllPlugins();
|
||||
plugins.RegisterAllPlugins(encoding);
|
||||
|
||||
List<string> id_plugins;
|
||||
Filesystem _plugin;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Core;
|
||||
@@ -58,9 +59,27 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.ErrorWriteLine("Cannot open specified file.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Encoding encoding = null;
|
||||
|
||||
if(options.EncodingName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName);
|
||||
if(options.Verbose)
|
||||
DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName);
|
||||
}
|
||||
catch(ArgumentException)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Specified encoding is not supported.");
|
||||
encoding = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = new PluginBase();
|
||||
plugins.RegisterAllPlugins();
|
||||
plugins.RegisterAllPlugins(encoding);
|
||||
|
||||
List<string> id_plugins;
|
||||
Filesystem _plugin;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Claunia.Encoding">
|
||||
<HintPath>..\packages\Claunia.Encoding.1.1.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
|
||||
<HintPath>..\packages\Claunia.Encoding.1.2.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -147,7 +147,7 @@
|
||||
</NameConventionPolicy>
|
||||
<StandardHeader IncludeInNewFiles="True" Text="/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
 
Filename : ${FileName}
Author(s) : ${AuthorName} <${AuthorEmail}>

Component : Component
 
--[ Description ] ----------------------------------------------------------
 
 Description
 
--[ License ] --------------------------------------------------------------
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as
 published by the Free Software Foundation, either version 3 of the
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>.

----------------------------------------------------------------------------
Copyright © 2011-${Year} ${CopyrightHolder}
****************************************************************************/" />
|
||||
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" PlaceSystemDirectiveFirst="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" scope="text/x-csharp" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
|
||||
@@ -56,6 +56,9 @@ namespace DiscImageChef
|
||||
|
||||
[Option('i', "input", Required = true, HelpText = "Disc image.")]
|
||||
public string InputFile { get; set; }
|
||||
|
||||
[Option('e', "encoding", Default = null, HelpText = "Name of character encoding to use.")]
|
||||
public string EncodingName { get; set; }
|
||||
}
|
||||
|
||||
[Verb("compare", HelpText = "Compares two disc images.")]
|
||||
@@ -272,8 +275,12 @@ namespace DiscImageChef
|
||||
public bool Tape { get; set; }
|
||||
[Option('b', "block-size", Required = false, Default = 512, HelpText = "Only used for tapes, indicates block size. Files in the folder whose size is not a multiple of this value will simply be ignored.")]
|
||||
public int BlockSize { get; set; }
|
||||
|
||||
[Option('e', "encoding", Default = null, HelpText = "Name of character encoding to use.")]
|
||||
public string EncodingName { get; set; }
|
||||
}
|
||||
|
||||
// TODO: Add encoding
|
||||
[Verb("dump-media", HelpText = "Dumps the media inserted on a device to a media image.")]
|
||||
public class DumpMediaOptions : CommonOptions
|
||||
{
|
||||
@@ -337,6 +344,9 @@ namespace DiscImageChef
|
||||
|
||||
[Option('l', "long", Default = false, HelpText = "Uses long format.")]
|
||||
public bool Long { get; set; }
|
||||
|
||||
[Option('e', "encoding", Default = null, HelpText = "Name of character encoding to use.")]
|
||||
public string EncodingName { get; set; }
|
||||
}
|
||||
|
||||
[Verb("extract-files", HelpText = "Extracts all files in disc image.")]
|
||||
@@ -350,6 +360,9 @@ namespace DiscImageChef
|
||||
|
||||
[Option('x', "xattrs", Default = false, HelpText = "Extract extended attributes if present.")]
|
||||
public bool Xattrs { get; set; }
|
||||
|
||||
[Option('e', "encoding", Default = null, HelpText = "Name of character encoding to use.")]
|
||||
public string EncodingName { get; set; }
|
||||
}
|
||||
|
||||
[Verb("list-devices", HelpText = "Lists all connected devices.")]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Claunia.Encoding" version="1.1.0" targetFramework="net40" />
|
||||
<package id="Claunia.Encoding" version="1.2.0" targetFramework="net40" />
|
||||
<package id="CommandLineParser" version="2.1.1-beta" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user