mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added list-encodings command.
This commit is contained in:
@@ -322,6 +322,10 @@ namespace DiscImageChef.Core
|
||||
AllStats.Commands.ListDevices++;
|
||||
CurrentStats.Commands.ListDevices++;
|
||||
break;
|
||||
case "list-encodings":
|
||||
AllStats.Commands.ListEncodings++;
|
||||
CurrentStats.Commands.ListEncodings++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Claunia.Encoding">
|
||||
<HintPath>..\packages\Claunia.Encoding.1.0.1\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
|
||||
<HintPath>..\packages\Claunia.Encoding.1.1.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Claunia.Encoding" version="1.0.1" targetFramework="net40" />
|
||||
<package id="Claunia.Encoding" version="1.1.0" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -80,6 +80,7 @@ namespace DiscImageChef.Metadata
|
||||
public long PrintHex;
|
||||
public long Verify;
|
||||
public long ListDevices;
|
||||
public long ListEncodings;
|
||||
}
|
||||
|
||||
public class VerifiedItems
|
||||
|
||||
@@ -111,6 +111,7 @@ namespace DiscImageChef.Server.Controllers
|
||||
oldStats.Commands.Ls += newStats.Commands.Ls;
|
||||
oldStats.Commands.ExtractFiles += newStats.Commands.ExtractFiles;
|
||||
oldStats.Commands.ListDevices += newStats.Commands.ListDevices;
|
||||
oldStats.Commands.ListEncodings += newStats.Commands.ListEncodings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<i>extract-files</i> command has been run <asp:Label id="lblExtractFiles" runat="server"/> times<br/>
|
||||
<i>formats</i> command has been run <asp:Label id="lblFormats" runat="server"/> times<br/>
|
||||
<i>list-devices</i> command has been run <asp:Label id="lblListDevices" runat="server"/> times<br/>
|
||||
<i>list-encodings</i> command has been run <asp:Label id="lblListEncodings" runat="server"/> times<br/>
|
||||
<i>ls</i> command has been run <asp:Label id="lblLs" runat="server"/> times<br/>
|
||||
<i>media-info</i> command has been run <asp:Label id="lblMediaInfo" runat="server"/> times<br/>
|
||||
<i>media-scan</i> command has been run <asp:Label id="lblMediaScan" runat="server"/> times<br/>
|
||||
|
||||
@@ -107,6 +107,7 @@ namespace DiscImageChef.Server
|
||||
lblLs.Text = statistics.Commands.Ls.ToString();
|
||||
lblExtractFiles.Text = statistics.Commands.ExtractFiles.ToString();
|
||||
lblListDevices.Text = statistics.Commands.ListDevices.ToString();
|
||||
lblListEncodings.Text = statistics.Commands.ListEncodings.ToString();
|
||||
}
|
||||
else
|
||||
divCommands.Visible = false;
|
||||
@@ -237,7 +238,7 @@ namespace DiscImageChef.Server
|
||||
divDevices.Visible = false;
|
||||
|
||||
}
|
||||
catch(Exception)
|
||||
catch(Exception ex)
|
||||
{
|
||||
content.InnerHtml = "<b>Could not load statistics</b>";
|
||||
#if DEBUG
|
||||
|
||||
2
DiscImageChef.Server/Statistics.aspx.designer.cs
generated
2
DiscImageChef.Server/Statistics.aspx.designer.cs
generated
@@ -55,6 +55,8 @@ namespace DiscImageChef.Server {
|
||||
|
||||
protected System.Web.UI.WebControls.Label lblListDevices;
|
||||
|
||||
protected System.Web.UI.WebControls.Label lblListEncodings;
|
||||
|
||||
protected System.Web.UI.WebControls.Label lblLs;
|
||||
|
||||
protected System.Web.UI.WebControls.Label lblMediaInfo;
|
||||
|
||||
65
DiscImageChef/Commands/ListEncodings.cs
Normal file
65
DiscImageChef/Commands/ListEncodings.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : ListEncodings.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// 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-2017 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef.Console;
|
||||
using System.Linq;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
public static class ListEncodings
|
||||
{
|
||||
struct CommonEncodingInfo
|
||||
{
|
||||
public string Name;
|
||||
public string DisplayName;
|
||||
}
|
||||
|
||||
public static void DoList(ListEncodingsOptions EncodingOptions)
|
||||
{
|
||||
List<CommonEncodingInfo> encodings = new List<CommonEncodingInfo>();
|
||||
|
||||
foreach(System.Text.EncodingInfo info in System.Text.Encoding.GetEncodings())
|
||||
encodings.Add(new CommonEncodingInfo { Name = info.Name, DisplayName = info.GetEncoding().EncodingName });
|
||||
foreach(Claunia.Encoding.EncodingInfo info in Claunia.Encoding.Encoding.GetEncodings())
|
||||
encodings.Add(new CommonEncodingInfo { Name = info.Name, DisplayName = info.DisplayName });
|
||||
|
||||
DicConsole.WriteLine("{0,-16} {1,-8}", "Name", "Description");
|
||||
|
||||
foreach(CommonEncodingInfo info in encodings.OrderBy(t => t.DisplayName))
|
||||
DicConsole.WriteLine("{0,-16} {1,-8}", info.Name, info.DisplayName);
|
||||
|
||||
Core.Statistics.AddCommand("list-encodings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
<HintPath>..\packages\CommandLineParser.2.1.1-beta\lib\net40\CommandLine.dll</HintPath>
|
||||
</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>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
@@ -69,6 +72,7 @@
|
||||
<Compile Include="Commands\ExtractFiles.cs" />
|
||||
<Compile Include="Progress.cs" />
|
||||
<Compile Include="Commands\ListDevices.cs" />
|
||||
<Compile Include="Commands\ListEncodings.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
@@ -143,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" 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" />
|
||||
<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" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace DiscImageChef
|
||||
typeof(CreateSidecarOptions),
|
||||
typeof(DumpMediaOptions), typeof(DeviceReportOptions),
|
||||
typeof(ConfigureOptions), typeof(StatsOptions), typeof(LsOptions),
|
||||
typeof(ExtractFilesOptions), typeof(ListDevicesOptions)})
|
||||
typeof(ExtractFilesOptions), typeof(ListDevicesOptions), typeof(ListEncodingsOptions)})
|
||||
.WithParsed<AnalyzeOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug)
|
||||
@@ -236,6 +236,16 @@ namespace DiscImageChef
|
||||
Commands.ListDevices.doListDevices(opts);
|
||||
})
|
||||
|
||||
.WithParsed<ListEncodingsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug)
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.ListEncodings.DoList(opts);
|
||||
})
|
||||
|
||||
.WithParsed<ConfigureOptions>(opts => { PrintCopyright(); Commands.Configure.doConfigure(); })
|
||||
.WithParsed<StatsOptions>(opts => { PrintCopyright(); Commands.Statistics.showStats(); })
|
||||
.WithNotParsed(errs => Environment.Exit(1));
|
||||
|
||||
@@ -356,5 +356,10 @@ namespace DiscImageChef
|
||||
public class ListDevicesOptions : CommonOptions
|
||||
{
|
||||
}
|
||||
|
||||
[Verb("list-encodings", HelpText = "Lists all supported text encodings and code pages.")]
|
||||
public class ListEncodingsOptions : CommonOptions
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Claunia.Encoding" version="1.1.0" targetFramework="net40" />
|
||||
<package id="CommandLineParser" version="2.1.1-beta" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user