diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs index 103ad19ad..a08ce5bc3 100644 --- a/DiscImageChef.Core/Statistics.cs +++ b/DiscImageChef.Core/Statistics.cs @@ -322,6 +322,10 @@ namespace DiscImageChef.Core AllStats.Commands.ListDevices++; CurrentStats.Commands.ListDevices++; break; + case "list-encodings": + AllStats.Commands.ListEncodings++; + CurrentStats.Commands.ListEncodings++; + break; } } } diff --git a/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj b/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj index 745e18fcc..d979b67d0 100644 --- a/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj +++ b/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj @@ -34,7 +34,7 @@ - ..\packages\Claunia.Encoding.1.0.1\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll + ..\packages\Claunia.Encoding.1.1.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll diff --git a/DiscImageChef.Filesystems/packages.config b/DiscImageChef.Filesystems/packages.config index eca164f70..2774a864c 100644 --- a/DiscImageChef.Filesystems/packages.config +++ b/DiscImageChef.Filesystems/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/DiscImageChef.Metadata/Statistics.cs b/DiscImageChef.Metadata/Statistics.cs index 95cc154a5..cf8dc7e06 100644 --- a/DiscImageChef.Metadata/Statistics.cs +++ b/DiscImageChef.Metadata/Statistics.cs @@ -80,6 +80,7 @@ namespace DiscImageChef.Metadata public long PrintHex; public long Verify; public long ListDevices; + public long ListEncodings; } public class VerifiedItems diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs index 36eb35cb3..08190bab0 100644 --- a/DiscImageChef.Server/Controllers/UploadStatsController.cs +++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs @@ -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; } } diff --git a/DiscImageChef.Server/Statistics.aspx b/DiscImageChef.Server/Statistics.aspx index 8cca4b8c0..ea23e9a84 100644 --- a/DiscImageChef.Server/Statistics.aspx +++ b/DiscImageChef.Server/Statistics.aspx @@ -50,6 +50,7 @@ extract-files command has been run times
formats command has been run times
list-devices command has been run times
+ list-encodings command has been run times
ls command has been run times
media-info command has been run times
media-scan command has been run times
diff --git a/DiscImageChef.Server/Statistics.aspx.cs b/DiscImageChef.Server/Statistics.aspx.cs index 2af80a15b..5f1c756ec 100644 --- a/DiscImageChef.Server/Statistics.aspx.cs +++ b/DiscImageChef.Server/Statistics.aspx.cs @@ -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 = "Could not load statistics"; #if DEBUG diff --git a/DiscImageChef.Server/Statistics.aspx.designer.cs b/DiscImageChef.Server/Statistics.aspx.designer.cs index 0af048212..5fe480945 100644 --- a/DiscImageChef.Server/Statistics.aspx.designer.cs +++ b/DiscImageChef.Server/Statistics.aspx.designer.cs @@ -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; diff --git a/DiscImageChef/Commands/ListEncodings.cs b/DiscImageChef/Commands/ListEncodings.cs new file mode 100644 index 000000000..634e82e6b --- /dev/null +++ b/DiscImageChef/Commands/ListEncodings.cs @@ -0,0 +1,65 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : ListEncodings.cs +// Author(s) : Natalia Portillo +// +// 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 . +// +// ---------------------------------------------------------------------------- +// 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 encodings = new List(); + + 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"); + } + } +} + diff --git a/DiscImageChef/DiscImageChef.csproj b/DiscImageChef/DiscImageChef.csproj index e34c8ddd1..35627f04a 100644 --- a/DiscImageChef/DiscImageChef.csproj +++ b/DiscImageChef/DiscImageChef.csproj @@ -40,6 +40,9 @@ ..\packages\CommandLineParser.2.1.1-beta\lib\net40\CommandLine.dll
+ + ..\packages\Claunia.Encoding.1.1.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll + @@ -69,6 +72,7 @@ + @@ -143,7 +147,7 @@ - + diff --git a/DiscImageChef/Main.cs b/DiscImageChef/Main.cs index 104e0a336..ccbd12347 100644 --- a/DiscImageChef/Main.cs +++ b/DiscImageChef/Main.cs @@ -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(opts => { if(opts.Debug) @@ -236,6 +236,16 @@ namespace DiscImageChef Commands.ListDevices.doListDevices(opts); }) + .WithParsed(opts => + { + if(opts.Debug) + DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) + DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.ListEncodings.DoList(opts); + }) + .WithParsed(opts => { PrintCopyright(); Commands.Configure.doConfigure(); }) .WithParsed(opts => { PrintCopyright(); Commands.Statistics.showStats(); }) .WithNotParsed(errs => Environment.Exit(1)); diff --git a/DiscImageChef/Options.cs b/DiscImageChef/Options.cs index 2e3560e4c..7302c6447 100644 --- a/DiscImageChef/Options.cs +++ b/DiscImageChef/Options.cs @@ -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 + { + } } diff --git a/DiscImageChef/packages.config b/DiscImageChef/packages.config index d34c13364..641a58156 100644 --- a/DiscImageChef/packages.config +++ b/DiscImageChef/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file