Move strings to resources.

This commit is contained in:
2019-02-10 16:25:24 +00:00
parent 51c4d039aa
commit 67401dc47f
5 changed files with 256 additions and 20 deletions

View File

@@ -8,6 +8,8 @@
<e p=".git/info/exclude" t="IncludeRecursive" />
<e p="DiscImageChef.VideoNow" t="IncludeRecursive">
<e p="DiscImageChef.VideoNow.csproj" t="IncludeRecursive" />
<e p="Localization.Designer.cs" t="Include" />
<e p="Localization.resx" t="Include" />
<e p="Program.cs" t="Include" />
<e p="Properties" t="Include">
<e p="AssemblyInfo.cs" t="Include" />

View File

@@ -38,6 +38,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Localization.Designer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@@ -52,6 +53,9 @@
<ItemGroup>
<PackageReference Include="SharpAvi" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization.resx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,157 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DiscImageChef.VideoNow {
using System;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Localization {
private static System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Localization() {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public static System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("DiscImageChef.VideoNow.Localization", typeof(Localization).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
public static string Usage {
get {
return ResourceManager.GetString("Usage", resourceCulture);
}
}
public static string FileDoesNotExist {
get {
return ResourceManager.GetString("FileDoesNotExist", resourceCulture);
}
}
public static string FileCannotBeOpened {
get {
return ResourceManager.GetString("FileCannotBeOpened", resourceCulture);
}
}
public static string FileIsTooBig {
get {
return ResourceManager.GetString("FileIsTooBig", resourceCulture);
}
}
public static string FileName {
get {
return ResourceManager.GetString("FileName", resourceCulture);
}
}
public static string SearchingFirstFrame {
get {
return ResourceManager.GetString("SearchingFirstFrame", resourceCulture);
}
}
public static string NoFrameFound {
get {
return ResourceManager.GetString("NoFrameFound", resourceCulture);
}
}
public static string FirstFrameFoundAt {
get {
return ResourceManager.GetString("FirstFrameFoundAt", resourceCulture);
}
}
public static string FirstFrameIsAtSectorBoundary {
get {
return ResourceManager.GetString("FirstFrameIsAtSectorBoundary", resourceCulture);
}
}
public static string FirstFrameIsNotAtSectorBoundary {
get {
return ResourceManager.GetString("FirstFrameIsNotAtSectorBoundary", resourceCulture);
}
}
public static string ExtractingAudio {
get {
return ResourceManager.GetString("ExtractingAudio", resourceCulture);
}
}
public static string LookingForMoreFrames {
get {
return ResourceManager.GetString("LookingForMoreFrames", resourceCulture);
}
}
public static string FrameAndNextAreNotAligned {
get {
return ResourceManager.GetString("FrameAndNextAreNotAligned", resourceCulture);
}
}
public static string FrameFoundAtPosition {
get {
return ResourceManager.GetString("FrameFoundAtPosition", resourceCulture);
}
}
public static string FrameIsAtSectorBoundary {
get {
return ResourceManager.GetString("FrameIsAtSectorBoundary", resourceCulture);
}
}
public static string FrameIsNotAtSectorBoundary {
get {
return ResourceManager.GetString("FrameIsNotAtSectorBoundary", resourceCulture);
}
}
public static string FramesFound {
get {
return ResourceManager.GetString("FramesFound", resourceCulture);
}
}
public static string ExtractingVideo {
get {
return ResourceManager.GetString("ExtractingVideo", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Usage" xml:space="preserve">
<value>Usage: DiscImageChef.VideoNow dump.raw</value>
</data>
<data name="FileDoesNotExist" xml:space="preserve">
<value>Specified file does not exist.</value>
</data>
<data name="FileCannotBeOpened" xml:space="preserve">
<value>Could not open specified file.</value>
</data>
<data name="FileIsTooBig" xml:space="preserve">
<value>File is too big, not continuing.</value>
</data>
<data name="FileName" xml:space="preserve">
<value>File: {0}</value>
</data>
<data name="SearchingFirstFrame" xml:space="preserve">
<value>Searching for first frame....</value>
</data>
<data name="NoFrameFound" xml:space="preserve">
<value>Could not find any frame!</value>
</data>
<data name="FirstFrameFoundAt" xml:space="preserve">
<value>First frame found at {0}</value>
</data>
<data name="FirstFrameIsAtSectorBoundary" xml:space="preserve">
<value>First frame is at a sector boundary</value>
</data>
<data name="FirstFrameIsNotAtSectorBoundary" xml:space="preserve">
<value>First frame is not at a sector boundary</value>
</data>
<data name="ExtractingAudio" xml:space="preserve">
<value>Extracting audio {0} </value>
</data>
<data name="LookingForMoreFrames" xml:space="preserve">
<value>Looking for more frames {0}</value>
</data>
<data name="FrameAndNextAreNotAligned" xml:space="preserve">
<value>Frame {0} and the next one are not aligned...</value>
</data>
<data name="FrameFoundAtPosition" xml:space="preserve">
<value>Frame {1} found at {0}, {2} bytes apart</value>
</data>
<data name="FrameIsAtSectorBoundary" xml:space="preserve">
<value>Frame {0} is at a sector boundary</value>
</data>
<data name="FrameIsNotAtSectorBoundary" xml:space="preserve">
<value>Frame {0} is not at a sector boundary</value>
</data>
<data name="FramesFound" xml:space="preserve">
<value>Found {0} frames</value>
</data>
<data name="ExtractingVideo" xml:space="preserve">
<value>Extracting video {0} </value>
</data>
</root>

View File

@@ -36,6 +36,7 @@ using System.Linq;
using System.Reflection;
using SharpAvi;
using SharpAvi.Output;
// ReSharper disable LocalizableElement
namespace DiscImageChef.VideoNow
{
@@ -120,14 +121,14 @@ namespace DiscImageChef.VideoNow
if(args.Length != 1)
{
Console.WriteLine("Usage: DiscImageChef.VideoNow dump.raw");
Console.WriteLine(Localization.Usage);
return;
}
if(!File.Exists(args[0]))
{
Console.WriteLine("Specified file does not exist.");
Console.WriteLine(Localization.FileDoesNotExist);
return;
}
@@ -140,20 +141,20 @@ namespace DiscImageChef.VideoNow
}
catch
{
Console.WriteLine("Could not open specified file.");
Console.WriteLine(Localization.FileCannotBeOpened);
return;
}
if(fs.Length > MAX_SIZE)
{
Console.WriteLine("File is too big, not continuing.");
Console.WriteLine(Localization.FileIsTooBig);
return;
}
Console.WriteLine("File: {0}", args[0]);
Console.WriteLine("Searching for first frame....");
Console.WriteLine(Localization.FileName, args[0]);
Console.WriteLine(Localization.SearchingFirstFrame);
long framePosition = 0;
byte[] buffer = new byte[FrameMarker.Length];
@@ -196,13 +197,13 @@ namespace DiscImageChef.VideoNow
if(!buffer.SequenceEqual(FrameMarker) &&
!swappedBuffer.SequenceEqual(SwappedFrameMarker))
{
Console.WriteLine("Could not find any frame!");
Console.WriteLine(Localization.NoFrameFound);
return;
}
Console.WriteLine("First frame found at {0}", framePosition);
Console.WriteLine("First frame {0} at a sector boundary", framePosition % 2352 == 0 ? "is" : "is not");
Console.WriteLine(Localization.FirstFrameFoundAt, framePosition);
Console.WriteLine(framePosition % 2352 == 0 ? Localization.FirstFrameIsAtSectorBoundary : Localization.FirstFrameIsNotAtSectorBoundary);
char progress = ' ';
var aviWriter = new AviWriter(args[0] + ".avi")
@@ -248,7 +249,7 @@ namespace DiscImageChef.VideoNow
break;
}
Console.Write("\rExtracting audio {0} ", progress);
Console.Write($"\r{Localization.ExtractingAudio}", progress);
outFs.WriteByte(frameBuffer[i]);
}
@@ -282,7 +283,7 @@ namespace DiscImageChef.VideoNow
break;
}
Console.Write("\rLooking for more frames {0}", progress);
Console.Write($"\r{Localization.LookingForMoreFrames}", progress);
for(int ab = audioStart; ab < buffer.Length; ab += 10)
buffer[ab] = 0;
@@ -290,7 +291,7 @@ namespace DiscImageChef.VideoNow
if(!buffer.SequenceEqual(frameMarkerToUse))
{
Console.Write("\r \r");
Console.WriteLine("Frame {0} and the next one are not aligned...", totalFrames);
Console.WriteLine(Localization.FrameAndNextAreNotAligned, totalFrames);
long expectedFramePosition = framePosition;
while(framePosition < fs.Length)
@@ -336,7 +337,7 @@ namespace DiscImageChef.VideoNow
break;
}
Console.Write("\rExtracting audio {0} ", progress);
Console.Write($"\r{Localization.ExtractingAudio}", progress);
outFs.WriteByte(frameBuffer[i]);
}
@@ -347,11 +348,10 @@ namespace DiscImageChef.VideoNow
totalFrames++;
Console.Write("\r \r");
Console.WriteLine("Frame {1} found at {0}, {2} bytes apart", framePosition, totalFrames,
Console.WriteLine(Localization.FrameFoundAtPosition, framePosition, totalFrames,
framePosition - expectedFramePosition);
Console.WriteLine("Frame {1} {0} at a sector boundary",
framePosition % 2352 == 0 ? "is" : "is not", totalFrames);
Console.WriteLine(framePosition % 2352 == 0 ? Localization.FrameIsAtSectorBoundary:Localization.FrameIsNotAtSectorBoundary, totalFrames);
framePosition += 19600;
@@ -367,7 +367,7 @@ namespace DiscImageChef.VideoNow
if(framePosition % 2352 == 0)
{
Console.Write("\r \r");
Console.WriteLine("Frame {0} is at a sector boundary", totalFrames);
Console.WriteLine(Localization.FrameIsAtSectorBoundary, totalFrames);
}
Console.Write("\r \r");
@@ -402,7 +402,7 @@ namespace DiscImageChef.VideoNow
break;
}
Console.Write("\rExtracting audio {0} ", progress);
Console.Write($"\r{Localization.ExtractingAudio}", progress);
outFs.WriteByte(frameBuffer[i]);
}
@@ -417,7 +417,7 @@ namespace DiscImageChef.VideoNow
}
Console.Write("\r \r");
Console.WriteLine("Found {0} frames", totalFrames);
Console.WriteLine(Localization.FramesFound, totalFrames);
fs.Close();
outFs.Close();
@@ -482,7 +482,7 @@ namespace DiscImageChef.VideoNow
break;
}
Console.Write("\rExtracting video {0} ", progress);
Console.Write($"\r{Localization.ExtractingVideo}", progress);
r = (byte)((frameBuffer[index] & 0xF0) + ((frameBuffer[index] & 0xF0) >> 4));
b = (byte)((frameBuffer[indexBlock2] & 0xF0) + ((frameBuffer[indexBlock2] & 0xF0) >> 4));
g = (byte)((frameBuffer[indexBlock2] & 0x0F) + ((frameBuffer[indexBlock2] & 0x0F) << 4));