Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b211b4aea0 | ||
|
|
93b38182d5 | ||
|
|
82728aefba | ||
|
|
3d6315ce58 | ||
|
|
ef02cde9b9 | ||
|
|
ead28a613d | ||
|
|
4ee60445f0 | ||
|
|
409d726d35 | ||
|
|
cbaf6ca437 | ||
|
|
8494cb5f1e | ||
|
|
4a058052d4 | ||
|
|
d610f08a5e | ||
|
|
1de3c3e0af | ||
|
|
141d113c07 | ||
|
|
e2016f6ac2 | ||
|
|
1b7db8e9b4 | ||
|
|
df5db67aa4 | ||
|
|
d34d3cb4ce | ||
|
|
292c9b3414 | ||
|
|
c86d1b75ce | ||
|
|
edef60c66a | ||
|
|
9204b7fb3c | ||
|
|
e5e1c78135 | ||
|
|
e82f0af2cc | ||
|
|
11e579d5b9 | ||
|
|
64ace9c4d6 | ||
|
|
749c794771 | ||
|
|
38c2ee2a1d | ||
|
|
1853b83c8f | ||
|
|
040192f3fb | ||
|
|
ce4f18a7f4 | ||
|
|
2d455e7b4b | ||
|
|
aa7d4fa3c2 | ||
|
|
981c306e2a | ||
|
|
44d477a446 | ||
|
|
ec4d5cb81c | ||
|
|
950faaa00b | ||
|
|
5c1826e760 | ||
|
|
9f241b83fa | ||
|
|
ddc603582d | ||
|
|
420e62763c | ||
|
|
4a7a15e453 | ||
|
|
ca9bdaf474 | ||
|
|
a47ea62c83 | ||
|
|
4ff01248ad | ||
|
|
92b5629956 | ||
|
|
c9b07e7162 | ||
|
|
92c96f03e8 | ||
|
|
962f29d35a | ||
|
|
f57e9ce7ac | ||
|
|
5d328b08b7 | ||
|
|
1fdf0893de | ||
|
|
fa019b1d19 | ||
|
|
50d0008558 | ||
|
|
a1b70b1238 | ||
|
|
ec16879572 | ||
|
|
f5290b0537 | ||
|
|
5a9a00d153 | ||
|
|
b34eec5327 | ||
|
|
d24c3327f2 | ||
|
|
dc54a7eae0 | ||
|
|
83d85cb93c | ||
|
|
72305ad71f | ||
|
|
4e1999d2af | ||
|
|
91b75338c4 | ||
|
|
1513aa19df | ||
|
|
569dedcf65 | ||
|
|
cfa6757312 | ||
|
|
897c9c5fcb | ||
|
|
9ba447e122 | ||
|
|
b01d577f6b | ||
|
|
7daa49e95d | ||
|
|
8831babb8c | ||
|
|
30574c8bb1 | ||
|
|
fc000f36b2 | ||
|
|
77d33cbb95 | ||
|
|
0b3ccca685 | ||
|
|
010a68c2c0 | ||
|
|
2f1fa29b5c | ||
|
|
4e3ce764c1 | ||
|
|
831e8d31f7 | ||
|
|
ce5efaf408 | ||
|
|
b766aeb757 | ||
|
|
4acb0b38b6 | ||
|
|
f037d74645 | ||
|
|
d2fac27419 | ||
|
|
89985015b0 | ||
|
|
73e6e5d2f1 | ||
|
|
b1015cd6b5 | ||
|
|
a532db7677 | ||
|
|
4073a921ff | ||
|
|
22e03b59df | ||
|
|
9ccc7d11a9 | ||
|
|
6a559fcad8 | ||
|
|
0fe5a832c7 | ||
|
|
c71be372f9 | ||
|
|
49264646fd | ||
|
|
85d7a8ce23 | ||
|
|
85b8eee165 | ||
|
|
1d6f089466 | ||
|
|
eb80b97799 | ||
|
|
e712eb9a50 | ||
|
|
a0d4db4c71 | ||
|
|
d9da885de2 | ||
|
|
185a32727d | ||
|
|
95a5854f82 | ||
|
|
7d5cfb5109 | ||
|
|
182b195d08 | ||
|
|
ee1ff06637 | ||
|
|
9a369be509 | ||
|
|
de51973e70 | ||
|
|
12c7a3b4c2 | ||
|
|
8ebddd9f0c | ||
|
|
68ba31632a | ||
|
|
67bb44c7c9 | ||
|
|
c6059f1596 | ||
|
|
39e623411a | ||
|
|
548f04a3f0 | ||
|
|
5d7924f6f7 | ||
|
|
4ded0b0e5e | ||
|
|
a687114ded | ||
|
|
432b53ae68 | ||
|
|
9946f82bcc | ||
|
|
b2bf4b7793 | ||
|
|
c01e618c55 | ||
|
|
944565ce3b | ||
|
|
db847ef182 | ||
|
|
27be265436 | ||
|
|
4e81f4637d | ||
|
|
36645b4a12 | ||
|
|
fdc16468cc | ||
|
|
d029311217 | ||
|
|
7e8e7526e6 | ||
|
|
dfb05980e6 | ||
|
|
8d8666e1e1 | ||
|
|
61dff1f5e2 | ||
|
|
83920a2310 | ||
|
|
2fd8d86aa1 | ||
|
|
b02da10dbc | ||
|
|
342c828721 | ||
|
|
b980dcda77 | ||
|
|
aa335a7aa0 | ||
|
|
fb69d060cb | ||
|
|
c0e55398a2 | ||
|
|
10114acba7 | ||
|
|
ea522531cf | ||
|
|
89d637a1be | ||
|
|
99b3f0dd8d | ||
|
|
7e13e9a100 | ||
|
|
03f23a0cfe | ||
|
|
e6670702a5 | ||
|
|
0c6c073cea | ||
|
|
b73b62e104 | ||
|
|
271fd489cc | ||
|
|
ab34ef9c48 | ||
|
|
6f55bd85f6 | ||
|
|
064aad972e | ||
|
|
44ec6d0cf9 | ||
|
|
c13249fdc7 | ||
|
|
680a45427c | ||
|
|
fc78c264a9 | ||
|
|
5323055e9c | ||
|
|
823cec2671 | ||
|
|
a28fdef080 | ||
|
|
1586917a2c | ||
|
|
ae009e0749 | ||
|
|
8397e40e52 | ||
|
|
a6baaba462 | ||
|
|
22655e58a5 | ||
|
|
d19a8f19d0 | ||
|
|
7c2e97d6c1 | ||
|
|
1b5484f5d7 | ||
|
|
9467da8dd0 | ||
|
|
020ee655dd | ||
|
|
279c075790 | ||
|
|
1c91123ccb | ||
|
|
a38c1bb338 | ||
|
|
647f04b1ee | ||
|
|
e9035fc43f | ||
|
|
538eea34f3 | ||
|
|
17cc4c8dcf | ||
|
|
357a3b6d6c | ||
|
|
bbd893e46f | ||
|
|
04b1bbdd06 | ||
|
|
ce1ad3181e | ||
|
|
15235a6382 | ||
|
|
b3e26812f3 | ||
|
|
2bc4cbddaa | ||
|
|
e447410a1e | ||
|
|
c0d7c404b2 | ||
|
|
23dcc2067d | ||
|
|
093c5a1c6d | ||
|
|
acaba53b3f | ||
|
|
946b6fc3f4 | ||
|
|
e0beb08a09 | ||
|
|
a8741693f5 | ||
|
|
03fa599a9b | ||
|
|
4a87c62992 | ||
|
|
fe7c3d37a7 | ||
|
|
0ac9af89ec | ||
|
|
a48917614e | ||
|
|
c5aa5efca4 | ||
|
|
49520eb2f6 | ||
|
|
3ae020866d | ||
|
|
df7834dec8 | ||
|
|
666af8a37b | ||
|
|
8e1f73f745 | ||
|
|
569d4198ed | ||
|
|
73ae27644d | ||
|
|
780ca19ae3 | ||
|
|
35fa417695 | ||
|
|
6f06f2943b | ||
|
|
9d648d7975 | ||
|
|
95d141dd69 | ||
|
|
bf724d0dd3 | ||
|
|
a51d07a893 | ||
|
|
a583053379 | ||
|
|
37f976f65b | ||
|
|
ff20b26a03 | ||
|
|
af4c708652 | ||
|
|
7539a7e448 | ||
|
|
beb64eb1de | ||
|
|
585ea47702 | ||
|
|
9dee8067a0 | ||
|
|
6728cdd509 | ||
|
|
2cf4c690be | ||
|
|
560364d320 | ||
|
|
c59ff01a73 | ||
|
|
245411bd8b | ||
|
|
73fface5cb | ||
|
|
c53a886353 | ||
|
|
0abd3da8d6 | ||
|
|
04adacee45 | ||
|
|
f4f4a4c357 | ||
|
|
5c9a931558 | ||
|
|
2161f170fc | ||
|
|
7674071fce | ||
|
|
6a1dc7a847 | ||
|
|
347d34ff28 | ||
|
|
ffc81bc378 | ||
|
|
0fd9e3d801 | ||
|
|
7a4666aa15 | ||
|
|
6594d95120 | ||
|
|
ad051308e1 | ||
|
|
dda464c64e | ||
|
|
7fc4646c19 | ||
|
|
424abe9aa4 | ||
|
|
21b6187812 | ||
|
|
b2501a1a04 | ||
|
|
e8a01c91f2 | ||
|
|
efed37b4dc | ||
|
|
1289db0bfa | ||
|
|
6fdb5f2e7a | ||
|
|
6f4b3f85ba | ||
|
|
0f8bcfab57 | ||
|
|
4718c0a9dc | ||
|
|
63633eb3a5 | ||
|
|
571ee4bec5 | ||
|
|
a735eab698 | ||
|
|
dd4389eb24 | ||
|
|
64f9f66724 | ||
|
|
dac4f092ae | ||
|
|
32514af57c | ||
|
|
d3ea351731 | ||
|
|
b13e2621c9 | ||
|
|
42ccbdb8fa | ||
|
|
939d6db778 | ||
|
|
375e8dbb26 | ||
|
|
f5172223b8 | ||
|
|
250ec2f7d3 | ||
|
|
34138ef00c | ||
|
|
3f9b0a0f32 | ||
|
|
b4061a7bdf | ||
|
|
801e1a415f | ||
|
|
8e6db881ea | ||
|
|
5b975fb463 | ||
|
|
36792c31ab | ||
|
|
07f2f9a2dd | ||
|
|
b6980780a8 | ||
|
|
4f38accc9e | ||
|
|
1d64c778e7 | ||
|
|
9ea7abd160 | ||
|
|
7f27737481 | ||
|
|
54d8c4094e | ||
|
|
4fa0863fe7 | ||
|
|
15bef45d4f | ||
|
|
ee1e04f3ff | ||
|
|
6166bd60d5 | ||
|
|
db86b6c372 | ||
|
|
d2b05c9933 | ||
|
|
386e61fec4 | ||
|
|
c0a1ac18e8 | ||
|
|
c327eae1f6 | ||
|
|
ee791bcc11 | ||
|
|
8990efddda | ||
|
|
3a2950190f | ||
|
|
45162328a9 | ||
|
|
1e05944566 | ||
|
|
f58cc625a1 | ||
|
|
09e60f7fa5 | ||
|
|
5732007afb | ||
|
|
69d06f5cde | ||
|
|
dd1d5da176 | ||
|
|
aad9deb7e6 | ||
|
|
40272e58e4 | ||
|
|
8434b00fe6 | ||
|
|
a6d2786749 | ||
|
|
9d659a0178 | ||
|
|
73cecd2722 | ||
|
|
8ca9734298 | ||
|
|
866844e369 | ||
|
|
8007b723a5 | ||
|
|
673f715ed0 | ||
|
|
43cfa7cd11 | ||
|
|
1f94578556 | ||
|
|
73d3255e76 | ||
|
|
9b0777d54d | ||
|
|
fedd6fa02d | ||
|
|
8343bc3e6c | ||
|
|
e656462c11 | ||
|
|
181578ef62 | ||
|
|
3ee0587d24 | ||
|
|
d4d8e175e8 | ||
|
|
fb15d8e833 | ||
|
|
c6e88b320d | ||
|
|
e804355034 | ||
|
|
34a2990e9d | ||
|
|
24f999d859 | ||
|
|
bfa8fd7d4f | ||
|
|
3da4e0ea84 | ||
|
|
28c9ae94b0 | ||
|
|
1210637f59 | ||
|
|
509d47fb91 | ||
|
|
1b4e39df45 | ||
|
|
8dbf692855 | ||
|
|
7b0af841ab | ||
|
|
d66723d510 | ||
|
|
8963bdb6c0 | ||
|
|
4cd9a851e8 | ||
|
|
77c5d94b74 | ||
|
|
5f7b2911da | ||
|
|
96a2d4f52f | ||
|
|
12cfaaefc6 | ||
|
|
d4cf9d9649 | ||
|
|
e0d290306b | ||
|
|
1d66f9fef0 | ||
|
|
6f7b0386cd | ||
|
|
228217e79b | ||
|
|
06589d6cf8 | ||
|
|
b88bdcb8be | ||
|
|
06f5b818bb | ||
|
|
8a7e8b0262 | ||
|
|
a223ee1610 | ||
|
|
19e9e1d50a | ||
|
|
afe7c4048a | ||
|
|
a0fbf28e42 | ||
|
|
915f93defd | ||
|
|
3e7c7a4a30 | ||
|
|
5db9c09cff | ||
|
|
82be95fb43 | ||
|
|
132e254f25 | ||
|
|
7352f2a0e3 | ||
|
|
a3a930d44c | ||
|
|
ae3328b029 | ||
|
|
c9d2c77340 | ||
|
|
890ed87cf8 | ||
|
|
f6547941bc | ||
|
|
00d380f92e | ||
|
|
d7f25f6ab2 | ||
|
|
ef566be2bf | ||
|
|
c5b73b32b3 | ||
|
|
359a445126 | ||
|
|
a3cddcc75c | ||
|
|
b8a46ac0ef | ||
|
|
3b2adcc941 | ||
|
|
b4058b2ed6 | ||
|
|
18d616050a | ||
|
|
1b6984c378 | ||
|
|
a589aa53a4 | ||
|
|
0793a25ebc | ||
|
|
4a02a02083 | ||
|
|
c929221c60 | ||
|
|
ec98a107e4 | ||
|
|
68327299c0 | ||
|
|
4c7ff20193 | ||
|
|
5b49da745a | ||
|
|
6944180acd | ||
|
|
fbb1146931 | ||
|
|
81ea226e84 | ||
|
|
b0a1c57dd8 | ||
|
|
45625d18e4 | ||
|
|
6d1c8f3ff3 | ||
|
|
fbc080f935 | ||
|
|
9400f742d8 | ||
|
|
6dfd1f4bbf | ||
|
|
96988cd131 | ||
|
|
df80137624 | ||
|
|
03e975b371 | ||
|
|
43f5cb91cd | ||
|
|
be875bdf03 | ||
|
|
7147d670c1 | ||
|
|
390cfdc81b | ||
|
|
62636bd730 |
No files matched your search
@@ -15,8 +15,6 @@
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
@@ -194,3 +192,9 @@ FakesAssemblies/
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Ignore the installer signing commands file
|
||||
Installer/Installer.sign
|
||||
|
||||
# Ignore the installer languages file because it is automatically generated
|
||||
Installer/Languages.wxs
|
||||
@@ -3,4 +3,9 @@
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="Languages"/>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,8 +1,57 @@
|
||||
<Application x:Class="FileConverter.Application"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml" ShutdownMode="OnMainWindowClose">
|
||||
xmlns:xaml="clr-namespace:Markdown.Xaml;assembly=Markdown.Xaml"
|
||||
xmlns:valueConverters="clr-namespace:FileConverter.ValueConverters"
|
||||
xmlns:generic="clr-namespace:FileConverter.ValueConverters.Generic"
|
||||
StartupUri="Windows/MainWindow.xaml" ShutdownMode="OnMainWindowClose">
|
||||
<Application.Resources>
|
||||
|
||||
<!-- Converters -->
|
||||
<valueConverters:ApplicationVersionToApplicationName x:Key="ApplicationVersionToApplicationName"/>
|
||||
<generic:BoolToVisibility x:Key="BoolToVisibility"/>
|
||||
|
||||
<generic:ValueConverterGroup x:Key="InvBoolToVisibility">
|
||||
<generic:BoolInverterConverter/>
|
||||
<generic:BoolToVisibility/>
|
||||
</generic:ValueConverterGroup>
|
||||
|
||||
<!-- Markdown style -->
|
||||
<Style TargetType="FlowDocument" x:Key="DocumentStyle">
|
||||
<Setter Property="FontFamily" Value="Segoe UI" />
|
||||
<Setter Property="TextAlignment" Value="Left" />
|
||||
<Setter Property="Foreground" Value="#786C71" />
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="LineHeight" Value="9"/>
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="PageHeader" TargetType="Paragraph">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Foreground" Value="#1E6BB8" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SubHeader"
|
||||
TargetType="Paragraph">
|
||||
<Setter Property="FontSize"
|
||||
Value="20" />
|
||||
<Setter Property="Foreground"
|
||||
Value="#DF3900" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SubHeaderSecondary"
|
||||
TargetType="Paragraph">
|
||||
<Setter Property="FontSize"
|
||||
Value="20" />
|
||||
<Setter Property="Foreground"
|
||||
Value="#DF3900" />
|
||||
</Style>
|
||||
|
||||
<xaml:Markdown x:Key="Markdown"
|
||||
DocumentStyle="{StaticResource DocumentStyle}"
|
||||
Heading1Style="{StaticResource PageHeader}"
|
||||
Heading2Style="{StaticResource SubHeader}"
|
||||
Heading3Style="{StaticResource SubHeaderSecondary}"/>
|
||||
|
||||
<xaml:TextToFlowDocumentConverter x:Key="TextToFlowDocumentConverter" Markdown="{StaticResource Markdown}"/>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,7 +1,7 @@
|
||||
// <copyright file="Application.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
/* File Converter - This program allow you to convert file format to another.
|
||||
Copyright (C) 2015 Adrien Allard
|
||||
Copyright (C) 2017 Adrien Allard
|
||||
email: adrien.allard.pro@gmail.com
|
||||
|
||||
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
|
||||
@@ -18,30 +18,43 @@ namespace FileConverter
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
using FileConverter.ConversionJobs;
|
||||
using FileConverter.Diagnostics;
|
||||
using FileConverter.Windows;
|
||||
|
||||
public partial class Application : System.Windows.Application
|
||||
{
|
||||
public static readonly Version Version = new Version()
|
||||
private static readonly Version Version = new Version()
|
||||
{
|
||||
Major = 0,
|
||||
Minor = 1,
|
||||
Major = 1,
|
||||
Minor = 2,
|
||||
Patch = 3,
|
||||
};
|
||||
|
||||
private readonly List<ConversionJob> conversionJobs = new List<ConversionJob>();
|
||||
|
||||
private bool debugMode;
|
||||
private bool initialized;
|
||||
private int numberOfConversionThread = 1;
|
||||
|
||||
private bool needToRunConversionThread;
|
||||
private bool cancelAutoExit;
|
||||
private bool isSessionEnding;
|
||||
|
||||
public Application()
|
||||
{
|
||||
this.Initialize();
|
||||
this.ConvertionJobs = this.conversionJobs.AsReadOnly();
|
||||
}
|
||||
|
||||
if (this.initialized)
|
||||
public event EventHandler<ApplicationTerminateArgs> OnApplicationTerminate;
|
||||
|
||||
public static Version ApplicationVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
Thread fileConvertionThread = new Thread(this.ConvertFiles);
|
||||
fileConvertionThread.Start();
|
||||
return Application.Version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,50 +64,168 @@ namespace FileConverter
|
||||
private set;
|
||||
}
|
||||
|
||||
public Settings Settings
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool ShowSettings
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool HideMainWindow
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public UpgradeVersionDescription UpgradeVersionDescription
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool Verbose
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public void CancelAutoExit()
|
||||
{
|
||||
this.cancelAutoExit = true;
|
||||
|
||||
if (this.OnApplicationTerminate != null)
|
||||
{
|
||||
this.OnApplicationTerminate.Invoke(this, new ApplicationTerminateArgs(float.NaN));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
this.Initialize();
|
||||
|
||||
if (this.needToRunConversionThread)
|
||||
{
|
||||
Thread fileConvertionThread = Helpers.InstantiateThread("ConversionQueueThread", this.ConvertFiles);
|
||||
fileConvertionThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
base.OnExit(e);
|
||||
|
||||
Debug.Log("Exit application.");
|
||||
|
||||
if (!this.isSessionEnding && this.UpgradeVersionDescription != null && this.UpgradeVersionDescription.NeedToUpgrade)
|
||||
{
|
||||
Debug.Log("A new version of file converter has been found: {0}.", this.UpgradeVersionDescription.LatestVersion);
|
||||
|
||||
if (string.IsNullOrEmpty(this.UpgradeVersionDescription.InstallerPath))
|
||||
{
|
||||
Debug.LogError("Invalid installer path.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Wait for the end of the installer download.");
|
||||
while (this.UpgradeVersionDescription.InstallerDownloadInProgress)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
string installerPath = this.UpgradeVersionDescription.InstallerPath;
|
||||
if (!System.IO.File.Exists(installerPath))
|
||||
{
|
||||
Debug.LogError("Can't find upgrade installer ({0}). Try to restart the application.", installerPath);
|
||||
return;
|
||||
}
|
||||
|
||||
// Start process.
|
||||
Debug.Log("Start file converter upgrade from version {0} to {1}.", ApplicationVersion, this.UpgradeVersionDescription.LatestVersion);
|
||||
|
||||
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(installerPath)
|
||||
{
|
||||
UseShellExecute = true,
|
||||
};
|
||||
|
||||
Debug.Log("Start upgrade process: {0}{1}.", System.IO.Path.GetFileName(startInfo.FileName), startInfo.Arguments);
|
||||
System.Diagnostics.Process process = new System.Diagnostics.Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
|
||||
process.Start();
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Release();
|
||||
}
|
||||
|
||||
protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
|
||||
{
|
||||
base.OnSessionEnding(e);
|
||||
|
||||
this.isSessionEnding = true;
|
||||
this.Shutdown();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
this.ConvertionJobs = this.conversionJobs.AsReadOnly();
|
||||
#if BUILD32
|
||||
Diagnostics.Debug.Log("File Converter v" + ApplicationVersion.ToString() + " (32 bits)");
|
||||
#else
|
||||
Diagnostics.Debug.Log("File Converter v" + ApplicationVersion.ToString() + " (64 bits)");
|
||||
#endif
|
||||
|
||||
Diagnostics.Log("Retrieve arguments...");
|
||||
// Retrieve arguments.
|
||||
Debug.Log("Retrieve arguments...");
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
|
||||
#if (DEBUG)
|
||||
if (args.Length <= 1)
|
||||
{
|
||||
this.debugMode = true;
|
||||
System.Array.Resize(ref args, 9);
|
||||
args[1] = "--output-type";
|
||||
args[2] = "Flac";
|
||||
args[3] = @"D:\Projects\FileConverter\TestFiles\Herbie Hancock - Speak Like A Child [RVG Edition].flac";
|
||||
args[3] = @"D:\Projects\FileConverter\TestFiles\01 - Le Bruit Du Bang.wma";
|
||||
args[4] = @"D:\Projects\FileConverter\TestFiles\test\Toccata.wav";
|
||||
args[5] = @"D:\Projects\FileConverter\TestFiles\test\Toccata - Copie (4).wav";
|
||||
args[5] = "--verbose";
|
||||
args[6] = @"D:\Projects\FileConverter\TestFiles\test\Toccata - Copie (3).wav";
|
||||
args[7] = @"D:\Projects\FileConverter\TestFiles\test\Toccata - Copie (2).wav";
|
||||
args[8] = @"D:\Projects\FileConverter\TestFiles\test\Toccata - Copie (5).wav";
|
||||
////System.Array.Resize(ref args, 5);
|
||||
////args[1] = "--conversion-preset";
|
||||
////args[2] = "To Png";
|
||||
////args[3] = "--verbose";
|
||||
////args[4] = @"D:\Test\images\Mario Big.png";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Log arguments.
|
||||
for (int index = 0; index < args.Length; index++)
|
||||
{
|
||||
string argument = args[index];
|
||||
Diagnostics.Log("Arg{0}: {1}", index, argument);
|
||||
Debug.Log("Arg{0}: {1}", index, argument);
|
||||
}
|
||||
|
||||
Diagnostics.Log(string.Empty);
|
||||
Debug.Log(string.Empty);
|
||||
|
||||
OutputType outputType = OutputType.None;
|
||||
if (args.Length == 1)
|
||||
{
|
||||
// Diplay help windows to explain that this application is a context menu extension.
|
||||
ApplicationStartHelp applicationStartHelp = new ApplicationStartHelp();
|
||||
applicationStartHelp.Show();
|
||||
this.HideMainWindow = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse arguments.
|
||||
List<string> filePaths = new List<string>();
|
||||
string conversionPresetName = null;
|
||||
for (int index = 1; index < args.Length; index++)
|
||||
{
|
||||
string argument = args[index];
|
||||
if (string.IsNullOrEmpty(argument))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argument.StartsWith("--"))
|
||||
{
|
||||
// This is an optional parameter.
|
||||
@@ -102,42 +233,38 @@ namespace FileConverter
|
||||
|
||||
switch (parameterTitle)
|
||||
{
|
||||
case "output-type":
|
||||
case "post-install-init":
|
||||
Settings.PostInstallationInitialization();
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
return;
|
||||
|
||||
case "version":
|
||||
Console.Write(ApplicationVersion.ToString());
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
return;
|
||||
|
||||
case "settings":
|
||||
this.ShowSettings = true;
|
||||
this.HideMainWindow = true;
|
||||
break;
|
||||
|
||||
case "apply-settings":
|
||||
Settings.ApplyTemporarySettings();
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
return;
|
||||
|
||||
case "conversion-preset":
|
||||
if (index >= args.Length - 1)
|
||||
{
|
||||
if (index >= args.Length - 1)
|
||||
{
|
||||
Diagnostics.Log("ERROR ! Invalid format.");
|
||||
return;
|
||||
}
|
||||
|
||||
string outputTypeName = args[index + 1].ToLowerInvariant();
|
||||
switch (outputTypeName)
|
||||
{
|
||||
case "mp3":
|
||||
outputType = OutputType.Mp3;
|
||||
break;
|
||||
|
||||
case "ogg":
|
||||
outputType = OutputType.Ogg;
|
||||
break;
|
||||
|
||||
case "wav":
|
||||
outputType = OutputType.Wav;
|
||||
break;
|
||||
|
||||
case "flac":
|
||||
outputType = OutputType.Flac;
|
||||
break;
|
||||
|
||||
default:
|
||||
Diagnostics.Log("ERROR ! Unknown output type {0}.", outputType);
|
||||
return;
|
||||
}
|
||||
|
||||
index++;
|
||||
continue;
|
||||
Debug.LogError("Invalid format. (code 0x01)");
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
return;
|
||||
}
|
||||
|
||||
conversionPresetName = args[index + 1];
|
||||
index++;
|
||||
continue;
|
||||
|
||||
case "verbose":
|
||||
{
|
||||
this.Verbose = true;
|
||||
@@ -146,7 +273,7 @@ namespace FileConverter
|
||||
break;
|
||||
|
||||
default:
|
||||
Diagnostics.Log("ERROR ! Unknown option {0}.", parameterTitle);
|
||||
Debug.LogError("Unknown application argument: '--{0}'.", parameterTitle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -156,75 +283,230 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
if (outputType == OutputType.None)
|
||||
// Load settigns.
|
||||
Debug.Log("Load settings...");
|
||||
this.Settings = Settings.Load();
|
||||
if (this.Settings == null)
|
||||
{
|
||||
Diagnostics.Log("ERROR ! Can't retrieve the output type from arguments.");
|
||||
Diagnostics.Debug.LogError("The application will now shutdown. If you want to fix the problem yourself please edit or delete the file: C:\\Users\\UserName\\AppData\\Local\\FileConverter\\Settings.user.xml.");
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create convertion jobs.
|
||||
for (int index = 0; index < filePaths.Count; index++)
|
||||
if (this.Settings.MaximumNumberOfSimultaneousConversions <= 0)
|
||||
{
|
||||
ConversionJob conversionJob = new ConversionJob();
|
||||
|
||||
string inputFilePath = filePaths[index];
|
||||
string extension = System.IO.Path.GetExtension(inputFilePath);
|
||||
string outputFilePath = inputFilePath.Substring(0, inputFilePath.Length - extension.Length) + "."
|
||||
+ outputType.ToString().ToLowerInvariant();
|
||||
|
||||
conversionJob.Initialize(outputType, inputFilePath, outputFilePath);
|
||||
|
||||
this.conversionJobs.Add(conversionJob);
|
||||
this.Settings.MaximumNumberOfSimultaneousConversions = System.Math.Max(1, Environment.ProcessorCount / 2);
|
||||
Diagnostics.Debug.Log("The number of processors on this computer is {0}. Set the default number of conversion threads to {0}", this.Settings.MaximumNumberOfSimultaneousConversions);
|
||||
}
|
||||
|
||||
this.initialized = true;
|
||||
this.numberOfConversionThread = this.Settings.MaximumNumberOfSimultaneousConversions;
|
||||
Diagnostics.Debug.Log("Maximum number of conversion threads: {0}", this.numberOfConversionThread);
|
||||
|
||||
// Check upgrade.
|
||||
if (this.Settings.CheckUpgradeAtStartup)
|
||||
{
|
||||
#if DEBUG
|
||||
Task<UpgradeVersionDescription> task = Upgrade.Helpers.GetLatestVersionDescriptionAsync(this.OnGetLatestVersionDescription);
|
||||
#else
|
||||
long fileTime = Registry.GetValue<long>(Registry.Keys.LastUpdateCheckDate);
|
||||
DateTime lastUpdateDateTime = DateTime.FromFileTime(fileTime);
|
||||
|
||||
TimeSpan durationSinceLastUpdate = DateTime.Now.Subtract(lastUpdateDateTime);
|
||||
if (durationSinceLastUpdate > new TimeSpan(1, 0, 0, 0))
|
||||
{
|
||||
Task<UpgradeVersionDescription> task = Upgrade.Helpers.GetLatestVersionDescriptionAsync(this.OnGetLatestVersionDescription);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ConversionPreset conversionPreset = null;
|
||||
if (!string.IsNullOrEmpty(conversionPresetName))
|
||||
{
|
||||
conversionPreset = this.Settings.GetPresetFromName(conversionPresetName);
|
||||
if (conversionPreset == null)
|
||||
{
|
||||
Debug.LogError("Invalid conversion preset '{0}'. (code 0x02)", conversionPresetName);
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (conversionPreset != null)
|
||||
{
|
||||
// Create convertion jobs.
|
||||
Debug.Log("Create jobs for conversion preset: '{0}'", conversionPreset.Name);
|
||||
try
|
||||
{
|
||||
for (int index = 0; index < filePaths.Count; index++)
|
||||
{
|
||||
string inputFilePath = filePaths[index];
|
||||
ConversionJob conversionJob = ConversionJobFactory.Create(conversionPreset, inputFilePath);
|
||||
|
||||
this.conversionJobs.Add(conversionJob);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError(exception.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
this.needToRunConversionThread = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConvertFiles()
|
||||
{
|
||||
for (int index = 0; index < this.conversionJobs.Count; index++)
|
||||
// Prepare conversions.
|
||||
for (int index = 0; index < this.ConvertionJobs.Count; index++)
|
||||
{
|
||||
ConversionJob conversionJob = this.conversionJobs[index];
|
||||
conversionJob.StartConvertion();
|
||||
|
||||
if (System.IO.File.Exists(conversionJob.OutputFilePath))
|
||||
this.ConvertionJobs[index].PrepareConversion();
|
||||
}
|
||||
|
||||
// Convert!
|
||||
Thread[] jobThreads = new Thread[this.numberOfConversionThread];
|
||||
while (true)
|
||||
{
|
||||
// Compute conversion flags.
|
||||
ConversionFlags conversionFlags = ConversionFlags.None;
|
||||
bool allJobAreFinished = true;
|
||||
for (int jobIndex = 0; jobIndex < this.conversionJobs.Count; jobIndex++)
|
||||
{
|
||||
Diagnostics.Log("Success!");
|
||||
ConversionJob conversionJob = this.conversionJobs[jobIndex];
|
||||
allJobAreFinished &= !(conversionJob.State == ConversionJob.ConversionState.Ready ||
|
||||
conversionJob.State == ConversionJob.ConversionState.InProgress);
|
||||
|
||||
if (this.debugMode)
|
||||
if (conversionJob.State == ConversionJob.ConversionState.InProgress)
|
||||
{
|
||||
Diagnostics.Log("Delete file {0}.", conversionJob.OutputFilePath);
|
||||
try
|
||||
{
|
||||
System.IO.File.Delete(conversionJob.OutputFilePath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
conversionFlags |= conversionJob.StateFlags;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (allJobAreFinished)
|
||||
{
|
||||
Diagnostics.Log("Fail!");
|
||||
break;
|
||||
}
|
||||
|
||||
// Start job if possible.
|
||||
for (int jobIndex = 0; jobIndex < this.conversionJobs.Count; jobIndex++)
|
||||
{
|
||||
ConversionJob conversionJob = this.conversionJobs[jobIndex];
|
||||
if (conversionJob.State == ConversionJob.ConversionState.Ready &&
|
||||
conversionJob.CanStartConversion(conversionFlags))
|
||||
{
|
||||
// Find a thread to execute the job.
|
||||
Thread jobThread = null;
|
||||
for (int threadIndex = 0; threadIndex < jobThreads.Length; threadIndex++)
|
||||
{
|
||||
Thread thread = jobThreads[threadIndex];
|
||||
if (thread == null || !thread.IsAlive)
|
||||
{
|
||||
jobThread = Helpers.InstantiateThread(conversionJob.GetType().Name, this.ExecuteConversionJob);
|
||||
jobThreads[threadIndex] = jobThread;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (jobThread != null)
|
||||
{
|
||||
jobThread.Start(conversionJob);
|
||||
|
||||
while (conversionJob.State == ConversionJob.ConversionState.Ready)
|
||||
{
|
||||
Debug.Log("Wait the launch of the conversion thread before launching any other thread.");
|
||||
Thread.Sleep(20);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
|
||||
if (this.Settings.ExitApplicationWhenConversionsFinished)
|
||||
{
|
||||
bool allConversionsSucceed = true;
|
||||
for (int index = 0; index < this.conversionJobs.Count; index++)
|
||||
{
|
||||
allConversionsSucceed &= this.conversionJobs[index].State == ConversionJob.ConversionState.Done;
|
||||
}
|
||||
|
||||
if (this.cancelAutoExit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (allConversionsSucceed)
|
||||
{
|
||||
float remainingTime = this.Settings.DurationBetweenEndOfConversionsAndApplicationExit;
|
||||
while (remainingTime > 0f)
|
||||
{
|
||||
if (this.OnApplicationTerminate != null)
|
||||
{
|
||||
this.OnApplicationTerminate.Invoke(this, new ApplicationTerminateArgs(remainingTime));
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
remainingTime--;
|
||||
|
||||
if (this.cancelAutoExit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.OnApplicationTerminate != null)
|
||||
{
|
||||
this.OnApplicationTerminate.Invoke(this, new ApplicationTerminateArgs(remainingTime));
|
||||
}
|
||||
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Diagnostics.Log("End of job queue.");
|
||||
|
||||
#if !DEBUG
|
||||
bool allConversionsSucceed = true;
|
||||
for (int index = 0; index < this.conversionJobs.Count; index++)
|
||||
private void ExecuteConversionJob(object parameter)
|
||||
{
|
||||
ConversionJob conversionJob = parameter as ConversionJob;
|
||||
if (conversionJob == null)
|
||||
{
|
||||
allConversionsSucceed &= this.conversionJobs[index].State == ConversionJob.ConversionState.Done;
|
||||
throw new System.ArgumentException("The parameter must be a conversion job.", "parameter");
|
||||
}
|
||||
|
||||
if (allConversionsSucceed)
|
||||
if (conversionJob.State != ConversionJob.ConversionState.Ready)
|
||||
{
|
||||
System.Threading.Thread.Sleep(3000);
|
||||
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
Debug.LogError("Fail to execute conversion job.");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
conversionJob.StartConvertion();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError("Failure during conversion: {0}", exception.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetLatestVersionDescription(UpgradeVersionDescription upgradeVersionDescription)
|
||||
{
|
||||
if (upgradeVersionDescription == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Registry.SetValue(Registry.Keys.LastUpdateCheckDate, DateTime.Now.ToFileTime());
|
||||
|
||||
if (upgradeVersionDescription.LatestVersion <= ApplicationVersion)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.UpgradeVersionDescription = upgradeVersionDescription;
|
||||
(this.MainWindow as MainWindow).OnNewVersionReleased(upgradeVersionDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// <copyright file="ApplicationTerminateArgs.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
public class ApplicationTerminateArgs : System.EventArgs
|
||||
{
|
||||
public ApplicationTerminateArgs(float remainingTimeBeforeTermination)
|
||||
{
|
||||
this.RemainingTimeBeforeTermination = remainingTimeBeforeTermination;
|
||||
}
|
||||
|
||||
public float RemainingTimeBeforeTermination
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// <copyright file="CancelConversionJobCommand.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Commands
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using FileConverter.ConversionJobs;
|
||||
|
||||
public class CancelConversionJobCommand : ICommand
|
||||
{
|
||||
private readonly ConversionJob conversionJob;
|
||||
|
||||
public CancelConversionJobCommand(ConversionJob conversionJob)
|
||||
{
|
||||
this.conversionJob = conversionJob;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (this.conversionJob == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.conversionJob.IsCancelable && this.conversionJob.State == ConversionJob.ConversionState.InProgress;
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
this.conversionJob?.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// <copyright file="DelegateCommand.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Commands
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class DelegateCommand : ICommand
|
||||
{
|
||||
private Action executeMethod;
|
||||
private Func<bool> canExecuteMethod;
|
||||
|
||||
public DelegateCommand(Action executeMethod)
|
||||
{
|
||||
if (executeMethod == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(executeMethod));
|
||||
}
|
||||
|
||||
this.executeMethod = executeMethod;
|
||||
}
|
||||
|
||||
public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod)
|
||||
{
|
||||
this.executeMethod = executeMethod;
|
||||
this.canExecuteMethod = canExecuteMethod;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (this.canExecuteMethod != null)
|
||||
{
|
||||
return this.canExecuteMethod.Invoke();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
this.executeMethod.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// <copyright file="OpenUrlCommand.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Commands
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class OpenUrlCommand : ICommand
|
||||
{
|
||||
public OpenUrlCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
string url = parameter as string;
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Process.Start(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// <copyright file="EncodingMode.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Controls
|
||||
{
|
||||
public enum EncodingMode
|
||||
{
|
||||
Wav8,
|
||||
Wav16,
|
||||
Wav24,
|
||||
Wav32,
|
||||
|
||||
Mp3VBR,
|
||||
Mp3CBR,
|
||||
|
||||
OggVBR,
|
||||
|
||||
AacVBR,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:valueConverters="clr-namespace:FileConverter.ValueConverters"
|
||||
xmlns:project="clr-namespace:FileConverter.Properties"
|
||||
x:Name="userControl"
|
||||
x:Class="FileConverter.Controls.EncodingQualitySliderControl"
|
||||
mc:Ignorable="d" d:DesignWidth="300" Height="50">
|
||||
<UserControl.Resources>
|
||||
<valueConverters:BitrateToString x:Key="BitrateToString"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="65"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Slider Grid.Column="0" x:Name="slider" Margin="0,2,0,0" VerticalAlignment="Top" Maximum="245" AutoToolTipPlacement="TopLeft" SmallChange="8" IsSnapToTickEnabled="True" IsSelectionRangeEnabled="True" SelectionStart="115" SelectionEnd="245" Minimum="65" TickPlacement="BottomRight" LargeChange="32" TickFrequency="8" Ticks="65 85 100 115 130 165 175 190 225 245" Foreground="#004B82" />
|
||||
<Label Grid.Column="1" Content="{Binding Value, Converter={StaticResource BitrateToString}, ElementName=slider, Mode=OneWay}" Width="65" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Content="{x:Static project:Resources.RecommendeBitrateRangeInBlue}" Foreground="#E5004B82" FontSize="11" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,205 @@
|
||||
// <copyright file="EncodingQualitySliderControl.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Controls
|
||||
{
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for EncodingQualitySliderControl.
|
||||
/// </summary>
|
||||
public partial class EncodingQualitySliderControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty BitrateProperty = DependencyProperty.Register(
|
||||
"Bitrate",
|
||||
typeof(double),
|
||||
typeof(EncodingQualitySliderControl),
|
||||
new FrameworkPropertyMetadata(new PropertyChangedCallback(EncodingQualitySliderControl.OnBitrateValueChanged), new CoerceValueCallback(EncodingQualitySliderControl.CoerceBitrateValue)));
|
||||
|
||||
public static readonly DependencyProperty EncodingModeProperty = DependencyProperty.Register(
|
||||
"EncodingMode",
|
||||
typeof(EncodingMode),
|
||||
typeof(EncodingQualitySliderControl),
|
||||
new PropertyMetadata(new PropertyChangedCallback(EncodingQualitySliderControl.OnEncodingModeValueChanged)));
|
||||
|
||||
public EncodingQualitySliderControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.CoerceValue(EncodingQualitySliderControl.BitrateProperty);
|
||||
|
||||
this.slider.ValueChanged += this.Slider_ValueChanged;
|
||||
}
|
||||
|
||||
public EncodingMode EncodingMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return (EncodingMode)this.GetValue(EncodingQualitySliderControl.EncodingModeProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetCurrentValue(EncodingQualitySliderControl.EncodingModeProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public double Bitrate
|
||||
{
|
||||
get
|
||||
{
|
||||
return (double)this.GetValue(EncodingQualitySliderControl.BitrateProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetCurrentValue(EncodingQualitySliderControl.BitrateProperty, this.GetNearestTickValue(value));
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnBitrateValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs)
|
||||
{
|
||||
EncodingQualitySliderControl encodingQualitySliderControl = sender as EncodingQualitySliderControl;
|
||||
encodingQualitySliderControl.slider.Value = (double)eventArgs.NewValue;
|
||||
}
|
||||
|
||||
private static object CoerceBitrateValue(DependencyObject sender, object basevalue)
|
||||
{
|
||||
EncodingQualitySliderControl encodingQualitySliderControl = sender as EncodingQualitySliderControl;
|
||||
return encodingQualitySliderControl.GetNearestTickValue((double)basevalue);
|
||||
}
|
||||
|
||||
private static void OnEncodingModeValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs)
|
||||
{
|
||||
EncodingQualitySliderControl encodingQualitySliderControl = sender as EncodingQualitySliderControl;
|
||||
Slider sliderControl = encodingQualitySliderControl.slider;
|
||||
|
||||
switch (encodingQualitySliderControl.EncodingMode)
|
||||
{
|
||||
case EncodingMode.Mp3VBR:
|
||||
{
|
||||
sliderControl.Minimum = 65;
|
||||
sliderControl.Maximum = 245;
|
||||
sliderControl.SelectionStart = 115;
|
||||
sliderControl.SelectionEnd = 245;
|
||||
sliderControl.Ticks.Clear();
|
||||
sliderControl.Ticks.Add(65);
|
||||
sliderControl.Ticks.Add(85);
|
||||
sliderControl.Ticks.Add(100);
|
||||
sliderControl.Ticks.Add(115);
|
||||
sliderControl.Ticks.Add(130);
|
||||
sliderControl.Ticks.Add(165);
|
||||
sliderControl.Ticks.Add(175);
|
||||
sliderControl.Ticks.Add(190);
|
||||
sliderControl.Ticks.Add(225);
|
||||
sliderControl.Ticks.Add(245);
|
||||
break;
|
||||
}
|
||||
|
||||
case EncodingMode.Mp3CBR:
|
||||
{
|
||||
sliderControl.Minimum = 8;
|
||||
sliderControl.Maximum = 320;
|
||||
sliderControl.SelectionStart = 128;
|
||||
sliderControl.SelectionEnd = 256;
|
||||
sliderControl.Ticks.Clear();
|
||||
sliderControl.Ticks.Add(8);
|
||||
sliderControl.Ticks.Add(16);
|
||||
sliderControl.Ticks.Add(24);
|
||||
sliderControl.Ticks.Add(32);
|
||||
sliderControl.Ticks.Add(40);
|
||||
sliderControl.Ticks.Add(48);
|
||||
sliderControl.Ticks.Add(64);
|
||||
sliderControl.Ticks.Add(80);
|
||||
sliderControl.Ticks.Add(96);
|
||||
sliderControl.Ticks.Add(112);
|
||||
sliderControl.Ticks.Add(128);
|
||||
sliderControl.Ticks.Add(160);
|
||||
sliderControl.Ticks.Add(192);
|
||||
sliderControl.Ticks.Add(224);
|
||||
sliderControl.Ticks.Add(256);
|
||||
sliderControl.Ticks.Add(320);
|
||||
break;
|
||||
}
|
||||
|
||||
case EncodingMode.OggVBR:
|
||||
{
|
||||
sliderControl.Minimum = 32;
|
||||
sliderControl.Maximum = 500;
|
||||
sliderControl.SelectionStart = 80;
|
||||
sliderControl.SelectionEnd = 192;
|
||||
sliderControl.Ticks.Clear();
|
||||
sliderControl.Ticks.Add(32);
|
||||
sliderControl.Ticks.Add(48);
|
||||
sliderControl.Ticks.Add(64);
|
||||
sliderControl.Ticks.Add(80);
|
||||
sliderControl.Ticks.Add(96);
|
||||
sliderControl.Ticks.Add(112);
|
||||
sliderControl.Ticks.Add(128);
|
||||
sliderControl.Ticks.Add(160);
|
||||
sliderControl.Ticks.Add(192);
|
||||
sliderControl.Ticks.Add(224);
|
||||
sliderControl.Ticks.Add(256);
|
||||
sliderControl.Ticks.Add(320);
|
||||
sliderControl.Ticks.Add(500);
|
||||
break;
|
||||
}
|
||||
|
||||
case EncodingMode.AacVBR:
|
||||
{
|
||||
sliderControl.Minimum = 16;
|
||||
sliderControl.Maximum = 460;
|
||||
sliderControl.SelectionStart = 96;
|
||||
sliderControl.SelectionEnd = 256;
|
||||
sliderControl.Ticks.Clear();
|
||||
sliderControl.Ticks.Add(16);
|
||||
sliderControl.Ticks.Add(32);
|
||||
sliderControl.Ticks.Add(48);
|
||||
sliderControl.Ticks.Add(64);
|
||||
sliderControl.Ticks.Add(80);
|
||||
sliderControl.Ticks.Add(96);
|
||||
sliderControl.Ticks.Add(112);
|
||||
sliderControl.Ticks.Add(128);
|
||||
sliderControl.Ticks.Add(155);
|
||||
sliderControl.Ticks.Add(192);
|
||||
sliderControl.Ticks.Add(224);
|
||||
sliderControl.Ticks.Add(256);
|
||||
sliderControl.Ticks.Add(340);
|
||||
sliderControl.Ticks.Add(460);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
encodingQualitySliderControl.CoerceValue(EncodingQualitySliderControl.BitrateProperty);
|
||||
}
|
||||
|
||||
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (this.Bitrate == e.NewValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.SetCurrentValue(EncodingQualitySliderControl.BitrateProperty, e.NewValue);
|
||||
}
|
||||
|
||||
private double GetNearestTickValue(double value)
|
||||
{
|
||||
double minimumDifference = float.PositiveInfinity;
|
||||
double nearestTick = value;
|
||||
for (int index = 0; index < this.slider.Ticks.Count; index++)
|
||||
{
|
||||
double tick = this.slider.Ticks[index];
|
||||
double difference = System.Math.Abs(value - tick);
|
||||
if (difference < minimumDifference)
|
||||
{
|
||||
minimumDifference = difference;
|
||||
nearestTick = tick;
|
||||
}
|
||||
}
|
||||
|
||||
return nearestTick;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
// <copyright file="ConversionJob.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class ConversionJob : INotifyPropertyChanged
|
||||
{
|
||||
private readonly Regex durationRegex = new Regex(@"Duration:\s*([0-9][0-9]):([0-9][0-9]):([0-9][0-9])\.([0-9][0-9]),.*bitrate:\s*([0-9]+) kb\/s");
|
||||
private readonly Regex progressRegex = new Regex(@"size=\s*([0-9]+)kB\s+time=([0-9][0-9]):([0-9][0-9]):([0-9][0-9]).([0-9][0-9])\s+bitrate=\s*([0-9]+.[0-9])kbits\/s");
|
||||
|
||||
private TimeSpan fileDuration;
|
||||
private TimeSpan actualConvertedDuration;
|
||||
|
||||
private ProcessStartInfo ffmpegProcessStartInfo;
|
||||
|
||||
private float progress;
|
||||
|
||||
private ConversionState state;
|
||||
|
||||
private string exitingMessage;
|
||||
|
||||
public ConversionJob()
|
||||
{
|
||||
this.OutputType = OutputType.None;
|
||||
this.progress = 0f;
|
||||
this.InputFilePath = string.Empty;
|
||||
this.OutputFilePath = string.Empty;
|
||||
this.State = ConversionState.Unknown;
|
||||
this.ExitingMessage = string.Empty;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public enum ConversionState
|
||||
{
|
||||
Unknown,
|
||||
|
||||
Ready,
|
||||
InProgress,
|
||||
Done,
|
||||
Failed,
|
||||
}
|
||||
|
||||
public string InputFilePath
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string OutputFilePath
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public OutputType OutputType
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public ConversionState State
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.state = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public float Progress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.progress;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.progress = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string ExitingMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.exitingMessage;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.exitingMessage = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(OutputType outputType, string inputFileName, string outputFileName)
|
||||
{
|
||||
if (outputType == OutputType.None)
|
||||
{
|
||||
throw new ArgumentException("The output type must be valid.", "outputType");
|
||||
}
|
||||
|
||||
this.OutputType = outputType;
|
||||
this.ffmpegProcessStartInfo = null;
|
||||
|
||||
string applicationDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
string ffmpegPath = string.Format("{0}\\ffmpeg.exe", applicationDirectory);
|
||||
if (!System.IO.File.Exists(ffmpegPath))
|
||||
{
|
||||
Diagnostics.Log("Can't find ffmpeg executable ({0}). Try to reinstall the application.", ffmpegPath);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ffmpegProcessStartInfo = new ProcessStartInfo(ffmpegPath);
|
||||
|
||||
this.ffmpegProcessStartInfo.CreateNoWindow = true;
|
||||
this.ffmpegProcessStartInfo.UseShellExecute = false;
|
||||
this.ffmpegProcessStartInfo.RedirectStandardOutput = true;
|
||||
this.ffmpegProcessStartInfo.RedirectStandardError = true;
|
||||
|
||||
this.InputFilePath = inputFileName;
|
||||
this.OutputFilePath = outputFileName;
|
||||
|
||||
this.State = ConversionState.Ready;
|
||||
}
|
||||
|
||||
public void StartConvertion()
|
||||
{
|
||||
if (this.OutputType == OutputType.None)
|
||||
{
|
||||
throw new Exception("The converter is not initialized.");
|
||||
}
|
||||
|
||||
Diagnostics.Log("Convert file {0} to {1}.", this.InputFilePath, this.OutputFilePath);
|
||||
|
||||
string arguments = string.Empty;
|
||||
switch (this.OutputType)
|
||||
{
|
||||
case OutputType.Mp3:
|
||||
arguments = string.Format("-n -stats -i \"{0}\" -qscale:a 5 \"{1}\"", this.InputFilePath, this.OutputFilePath);
|
||||
break;
|
||||
|
||||
case OutputType.Ogg:
|
||||
arguments = string.Format("-n -stats -i \"{0}\" -acodec libvorbis -qscale:a 5 \"{1}\"", this.InputFilePath, this.OutputFilePath);
|
||||
break;
|
||||
|
||||
case OutputType.Flac:
|
||||
arguments = string.Format("-n -stats -i \"{0}\" \"{1}\"", this.InputFilePath, this.OutputFilePath);
|
||||
break;
|
||||
|
||||
case OutputType.Wav:
|
||||
arguments = string.Format("-n -stats -i \"{0}\" \"{1}\"", this.InputFilePath, this.OutputFilePath);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Converter not implemented for output file type " + this.OutputType);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(arguments) || this.ffmpegProcessStartInfo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.State = ConversionState.InProgress;
|
||||
|
||||
try
|
||||
{
|
||||
Diagnostics.Log(string.Empty);
|
||||
this.ffmpegProcessStartInfo.Arguments = arguments;
|
||||
Diagnostics.Log("Execute command: {0} {1}.", this.ffmpegProcessStartInfo.FileName, this.ffmpegProcessStartInfo.Arguments);
|
||||
using (Process exeProcess = Process.Start(this.ffmpegProcessStartInfo))
|
||||
{
|
||||
using (StreamReader reader = exeProcess.StandardError)
|
||||
{
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
string result = reader.ReadLine();
|
||||
|
||||
this.ParseFFMPEGOutput(result);
|
||||
|
||||
Diagnostics.Log("ffmpeg output: {0}", result);
|
||||
}
|
||||
}
|
||||
|
||||
exeProcess.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.State = ConversionState.Failed;
|
||||
throw;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.ExitingMessage))
|
||||
{
|
||||
this.State = ConversionState.Failed;
|
||||
return;
|
||||
}
|
||||
|
||||
this.Progress = 1f;
|
||||
this.State = ConversionState.Done;
|
||||
|
||||
Diagnostics.Log("\nDone!");
|
||||
}
|
||||
|
||||
private void ParseFFMPEGOutput(string input)
|
||||
{
|
||||
Match match = this.durationRegex.Match(input);
|
||||
if (match.Success && match.Groups.Count >= 6)
|
||||
{
|
||||
int hours = int.Parse(match.Groups[1].Value);
|
||||
int minutes = int.Parse(match.Groups[2].Value);
|
||||
int seconds = int.Parse(match.Groups[3].Value);
|
||||
int milliseconds = int.Parse(match.Groups[4].Value);
|
||||
float bitrate = float.Parse(match.Groups[5].Value);
|
||||
this.fileDuration = new TimeSpan(0, hours, minutes, seconds, milliseconds);
|
||||
return;
|
||||
}
|
||||
|
||||
match = this.progressRegex.Match(input);
|
||||
if (match.Success && match.Groups.Count >= 7)
|
||||
{
|
||||
int size = int.Parse(match.Groups[1].Value);
|
||||
int hours = int.Parse(match.Groups[2].Value);
|
||||
int minutes = int.Parse(match.Groups[3].Value);
|
||||
int seconds = int.Parse(match.Groups[4].Value);
|
||||
int milliseconds = int.Parse(match.Groups[5].Value);
|
||||
float bitrate = 0f;
|
||||
float.TryParse(match.Groups[6].Value, out bitrate);
|
||||
|
||||
this.actualConvertedDuration = new TimeSpan(0, hours, minutes, seconds, milliseconds);
|
||||
|
||||
this.Progress = this.actualConvertedDuration.Ticks / (float)this.fileDuration.Ticks;
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.Contains("Exiting."))
|
||||
{
|
||||
this.ExitingMessage = input;
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// // <copyright file="ConversionFlags.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
/// <summary>
|
||||
/// This enum describe the special conversion state that need to be multi-threads prerequisites.
|
||||
/// </summary>
|
||||
[System.Flags]
|
||||
public enum ConversionFlags
|
||||
{
|
||||
None = 0x00,
|
||||
|
||||
CdDriveExtraction = 0x01,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,503 @@
|
||||
// <copyright file="ConversionJob.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
using FileConverter.Commands;
|
||||
using FileConverter.Diagnostics;
|
||||
|
||||
public class ConversionJob : INotifyPropertyChanged
|
||||
{
|
||||
private float progress = 0f;
|
||||
private ConversionState state = ConversionState.Unknown;
|
||||
private string errorMessage = string.Empty;
|
||||
private string userState = string.Empty;
|
||||
private CancelConversionJobCommand cancelCommand;
|
||||
|
||||
private string initialInputPath = string.Empty;
|
||||
private int currentOuputFilePathIndex;
|
||||
|
||||
public ConversionJob()
|
||||
{
|
||||
this.State = ConversionState.Unknown;
|
||||
this.ConversionPreset = null;
|
||||
this.initialInputPath = string.Empty;
|
||||
this.InputFilePath = string.Empty;
|
||||
}
|
||||
|
||||
public ConversionJob(ConversionPreset conversionPreset, string inputFilePath) : this()
|
||||
{
|
||||
if (conversionPreset == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(conversionPreset));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(inputFilePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(inputFilePath));
|
||||
}
|
||||
|
||||
this.initialInputPath = inputFilePath;
|
||||
this.InputFilePath = inputFilePath;
|
||||
this.ConversionPreset = conversionPreset;
|
||||
this.UserState = Properties.Resources.ConversionStatePrepareConversion;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public enum ConversionState
|
||||
{
|
||||
Unknown,
|
||||
|
||||
Ready,
|
||||
InProgress,
|
||||
Done,
|
||||
Failed,
|
||||
}
|
||||
|
||||
public ConversionPreset ConversionPreset
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string InputFilePath
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string OutputFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.OutputFilePaths == null || this.OutputFilePaths.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (this.CurrentOuputFilePathIndex < 0)
|
||||
{
|
||||
return this.OutputFilePaths[0];
|
||||
}
|
||||
|
||||
if (this.CurrentOuputFilePathIndex >= this.OutputFilePaths.Length)
|
||||
{
|
||||
return this.OutputFilePaths[this.OutputFilePaths.Length - 1];
|
||||
}
|
||||
|
||||
return this.OutputFilePaths[this.CurrentOuputFilePathIndex];
|
||||
}
|
||||
}
|
||||
|
||||
public ConversionState State
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.state = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string UserState
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.userState;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
this.userState = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public float Progress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.progress;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
this.progress = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string ErrorMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.errorMessage;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.errorMessage = value;
|
||||
this.NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ConversionFlags StateFlags
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public CancelConversionJobCommand CancelCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.cancelCommand == null)
|
||||
{
|
||||
this.cancelCommand = new CancelConversionJobCommand(this);
|
||||
}
|
||||
|
||||
return this.cancelCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCancelable
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
protected bool CancelIsRequested
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
protected int CurrentOuputFilePathIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currentOuputFilePathIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.currentOuputFilePathIndex = value;
|
||||
this.NotifyPropertyChanged(nameof(this.OutputFilePath));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual InputPostConversionAction InputPostConversionAction
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
return InputPostConversionAction.None;
|
||||
}
|
||||
|
||||
return this.ConversionPreset.InputPostConversionAction;
|
||||
}
|
||||
}
|
||||
|
||||
protected string[] OutputFilePaths
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public virtual bool CanStartConversion(ConversionFlags conversionFlags)
|
||||
{
|
||||
return (conversionFlags & ConversionFlags.CdDriveExtraction) == 0;
|
||||
}
|
||||
|
||||
public void PrepareConversion(params string[] outputFilePaths)
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
this.InputFilePath = this.initialInputPath;
|
||||
|
||||
string extension = System.IO.Path.GetExtension(this.initialInputPath);
|
||||
extension = extension.Substring(1, extension.Length - 1);
|
||||
string extensionCategory = Helpers.GetExtensionCategory(extension);
|
||||
if (!Helpers.IsOutputTypeCompatibleWithCategory(this.ConversionPreset.OutputType, extensionCategory))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorInputTypeIncompatibleWithOutputType);
|
||||
return;
|
||||
}
|
||||
|
||||
this.OutputFilePaths = outputFilePaths;
|
||||
if (this.OutputFilePaths.Length == 0)
|
||||
{
|
||||
int outputFilesCount = this.GetOuputFilesCount();
|
||||
this.OutputFilePaths = new string[outputFilesCount];
|
||||
}
|
||||
|
||||
for (int index = 0; index < this.OutputFilePaths.Length; index++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.OutputFilePaths[index]))
|
||||
{
|
||||
// Don't generate a path if it has already been set.
|
||||
continue;
|
||||
}
|
||||
|
||||
string path = this.ConversionPreset.GenerateOutputFilePath(this.initialInputPath, index + 1, this.OutputFilePaths.Length);
|
||||
|
||||
if (!PathHelpers.IsPathValid(path))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorInvalidOutputPath);
|
||||
Debug.Log($"Invalid output path generated: {path} from input: {this.InputFilePath}.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (path == this.InputFilePath)
|
||||
{
|
||||
// If the input post conversion action is to move or delete the input file, change its name in order to keep the output name intact.
|
||||
if (this.ConversionPreset.InputPostConversionAction == InputPostConversionAction.MoveInArchiveFolder ||
|
||||
this.ConversionPreset.InputPostConversionAction == InputPostConversionAction.Delete)
|
||||
{
|
||||
string inputExtension = System.IO.Path.GetExtension(this.InputFilePath);
|
||||
string pathWithoutExtension = this.InputFilePath.Substring(0, this.InputFilePath.Length - inputExtension.Length);
|
||||
this.InputFilePath = PathHelpers.GenerateUniquePath(pathWithoutExtension + "_TEMP" + inputExtension);
|
||||
System.IO.File.Move(this.initialInputPath, this.InputFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
// Create output folders that doesn't exist.
|
||||
if (!PathHelpers.CreateFolders(path))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailToCreateOutputPathFolders);
|
||||
return;
|
||||
}
|
||||
|
||||
// Make the output path valid.
|
||||
try
|
||||
{
|
||||
path = PathHelpers.GenerateUniquePath(path, this.OutputFilePaths);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailToGenerateUniqueOutputPath);
|
||||
Debug.Log(exception.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
this.OutputFilePaths[index] = path;
|
||||
}
|
||||
|
||||
this.CurrentOuputFilePathIndex = 0;
|
||||
|
||||
// Check if the input file is located on a cd drive.
|
||||
if (PathHelpers.IsOnCDDrive(this.InputFilePath))
|
||||
{
|
||||
this.StateFlags = ConversionFlags.CdDriveExtraction;
|
||||
}
|
||||
|
||||
this.Initialize();
|
||||
|
||||
if (this.State == ConversionState.Unknown)
|
||||
{
|
||||
this.State = ConversionState.Ready;
|
||||
}
|
||||
|
||||
Debug.Log("Job initialized: Preset: '{0}' Input: {1} Output: {2}", this.ConversionPreset.Name, this.InputFilePath, this.OutputFilePath);
|
||||
|
||||
if (this.State != ConversionState.Failed)
|
||||
{
|
||||
this.UserState = Properties.Resources.ConversionStateInQueue;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartConvertion()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
if (this.State != ConversionState.Ready)
|
||||
{
|
||||
throw new Exception("Invalid conversion state.");
|
||||
}
|
||||
|
||||
Debug.Log("Convert file {0} to {1}.", this.InputFilePath, this.OutputFilePath);
|
||||
|
||||
this.State = ConversionState.InProgress;
|
||||
|
||||
try
|
||||
{
|
||||
this.Convert();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
this.ConversionFailed(exception.Message);
|
||||
}
|
||||
|
||||
this.StateFlags = ConversionFlags.None;
|
||||
|
||||
if (this.State == ConversionState.Failed)
|
||||
{
|
||||
this.OnConversionFailed();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.OnConversionSucceed();
|
||||
}
|
||||
|
||||
if (this.State == ConversionJob.ConversionState.Done && !this.AllOuputFilesExists())
|
||||
{
|
||||
Debug.LogError(Properties.Resources.ErrorCantFindOutputFiles);
|
||||
}
|
||||
else if (this.State == ConversionJob.ConversionState.Failed && this.AtLeastOneOuputFilesExists())
|
||||
{
|
||||
Debug.Log(Properties.Resources.ErrorConversionFailedWithOutput);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Cancel()
|
||||
{
|
||||
if (!this.IsCancelable || this.State != ConversionState.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.CancelIsRequested = true;
|
||||
this.ConversionFailed(Properties.Resources.ErrorCanceled);
|
||||
}
|
||||
|
||||
protected virtual int GetOuputFilesCount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected virtual void Convert()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnConversionFailed()
|
||||
{
|
||||
Debug.Log("Conversion Failed.");
|
||||
|
||||
for (int index = 0; index < this.OutputFilePaths.Length; index++)
|
||||
{
|
||||
string outputFilePath = this.OutputFilePaths[index];
|
||||
try
|
||||
{
|
||||
if (System.IO.File.Exists(outputFilePath))
|
||||
{
|
||||
System.IO.File.Delete(outputFilePath);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.Log("Can't delete file '{0}' after conversion job failure.", outputFilePath);
|
||||
Debug.Log("An exception as been thrown: {0}.", exception.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnConversionSucceed()
|
||||
{
|
||||
Debug.Log("Conversion Succeed!");
|
||||
|
||||
// Apply the input post conversion action.
|
||||
switch (this.InputPostConversionAction)
|
||||
{
|
||||
case InputPostConversionAction.None:
|
||||
break;
|
||||
|
||||
case InputPostConversionAction.MoveInArchiveFolder:
|
||||
string basePath = System.IO.Path.GetDirectoryName(this.initialInputPath);
|
||||
string inputFilename = System.IO.Path.GetFileName(this.initialInputPath);
|
||||
string archivePath = basePath + "\\" + this.ConversionPreset.ConversionArchiveFolderName;
|
||||
if (!System.IO.Directory.Exists(archivePath))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(archivePath);
|
||||
}
|
||||
|
||||
string newPath = PathHelpers.GenerateUniquePath(archivePath + "\\" + inputFilename);
|
||||
System.IO.File.Move(this.InputFilePath, newPath);
|
||||
Debug.Log("Input file moved in archive folder: '{0}'", newPath);
|
||||
break;
|
||||
|
||||
case InputPostConversionAction.Delete:
|
||||
System.IO.File.Delete(this.InputFilePath);
|
||||
Debug.Log("Input file deleted: '{0}'", this.initialInputPath);
|
||||
break;
|
||||
}
|
||||
|
||||
Debug.Log(string.Empty);
|
||||
|
||||
this.Progress = 1f;
|
||||
this.State = ConversionState.Done;
|
||||
this.UserState = Properties.Resources.ConversionStateDone;
|
||||
Debug.Log("Conversion Done!");
|
||||
}
|
||||
|
||||
protected void ConversionFailed(string exitingMessage)
|
||||
{
|
||||
Debug.Log("Fail: {0}", exitingMessage);
|
||||
|
||||
if (this.State == ConversionState.Failed)
|
||||
{
|
||||
// Already failed, don't override informations.
|
||||
return;
|
||||
}
|
||||
|
||||
this.State = ConversionState.Failed;
|
||||
this.UserState = Properties.Resources.ConversionStateFailed;
|
||||
this.ErrorMessage = exitingMessage;
|
||||
}
|
||||
|
||||
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
private bool AllOuputFilesExists()
|
||||
{
|
||||
for (int index = 0; index < this.OutputFilePaths.Length; index++)
|
||||
{
|
||||
string outputFilePath = this.OutputFilePaths[index];
|
||||
if (!System.IO.File.Exists(outputFilePath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool AtLeastOneOuputFilesExists()
|
||||
{
|
||||
for (int index = 0; index < this.OutputFilePaths.Length; index++)
|
||||
{
|
||||
string outputFilePath = this.OutputFilePaths[index];
|
||||
if (System.IO.File.Exists(outputFilePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// <copyright file="ConversionJobFactory.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
public static class ConversionJobFactory
|
||||
{
|
||||
public static ConversionJob Create(ConversionPreset conversionPreset, string inputFilePath)
|
||||
{
|
||||
string inputFileExtension = System.IO.Path.GetExtension(inputFilePath);
|
||||
inputFileExtension = inputFileExtension.ToLowerInvariant().Substring(1, inputFileExtension.Length - 1);
|
||||
if (inputFileExtension == "cda")
|
||||
{
|
||||
return new ConversionJob_ExtractCDA(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (inputFileExtension == "docx" || inputFileExtension == "odt" || inputFileExtension == "doc")
|
||||
{
|
||||
return new ConversionJob_Word(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (inputFileExtension == "xlsx" || inputFileExtension == "ods" || inputFileExtension == "xls")
|
||||
{
|
||||
return new ConversionJob_Excel(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (inputFileExtension == "pptx" || inputFileExtension == "odp" || inputFileExtension == "ppt")
|
||||
{
|
||||
return new ConversionJob_PowerPoint(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (conversionPreset.OutputType == OutputType.Ico)
|
||||
{
|
||||
return new ConversionJob_Ico(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (conversionPreset.OutputType == OutputType.Gif)
|
||||
{
|
||||
return new ConversionJob_Gif(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (conversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
return new ConversionJob_ImageMagick(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
if (Helpers.GetExtensionCategory(inputFileExtension) == Helpers.InputCategoryNames.Image ||
|
||||
Helpers.GetExtensionCategory(inputFileExtension) == Helpers.InputCategoryNames.Document)
|
||||
{
|
||||
return new ConversionJob_ImageMagick(conversionPreset, inputFilePath);
|
||||
}
|
||||
|
||||
return new ConversionJob_FFMPEG(conversionPreset, inputFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
// <copyright file="ConversionJob_Excel.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using FileConverter.Diagnostics;
|
||||
|
||||
using Excel = Microsoft.Office.Interop.Excel;
|
||||
|
||||
public class ConversionJob_Excel : ConversionJob_Office
|
||||
{
|
||||
private Excel.Workbook document;
|
||||
private Excel.Application application;
|
||||
|
||||
private string intermediateFilePath = string.Empty;
|
||||
private ConversionJob pdf2ImageConversionJob = null;
|
||||
|
||||
public ConversionJob_Excel() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public ConversionJob_Excel(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ApplicationName Application
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationName.Excel;
|
||||
}
|
||||
}
|
||||
|
||||
protected override int GetOuputFilesCount()
|
||||
{
|
||||
if (this.ConversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!this.TryLoadDocumentIfNecessary())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pagesCount = 0;
|
||||
foreach (object sheet in this.document.Sheets)
|
||||
{
|
||||
Excel.Worksheet worksheet = sheet as Excel.Worksheet;
|
||||
if (worksheet != null)
|
||||
{
|
||||
pagesCount = worksheet.PageSetup.Pages.Count;
|
||||
}
|
||||
}
|
||||
|
||||
return pagesCount;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.State == ConversionState.Failed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new System.Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
// Initialize converters.
|
||||
if (this.ConversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
this.intermediateFilePath = this.OutputFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate intermediate file path.
|
||||
string fileName = Path.GetFileNameWithoutExtension(this.InputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
this.intermediateFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + ".pdf");
|
||||
|
||||
ConversionPreset intermediatePreset = new ConversionPreset("Pdf to image", this.ConversionPreset, "pdf");
|
||||
this.pdf2ImageConversionJob = ConversionJobFactory.Create(intermediatePreset, this.intermediateFilePath);
|
||||
this.pdf2ImageConversionJob.PrepareConversion(this.OutputFilePaths);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new System.Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateReadDocument;
|
||||
|
||||
if (!this.TryLoadDocumentIfNecessary())
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorUnableToUseMicrosoftOffice);
|
||||
return;
|
||||
}
|
||||
|
||||
// Make this document the active document.
|
||||
this.document.Activate();
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateConversion;
|
||||
|
||||
Diagnostics.Debug.Log("Convert excel document to pdf.");
|
||||
this.document.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF, this.intermediateFilePath);
|
||||
|
||||
Diagnostics.Debug.Log("Close excel document '{0}'.", this.InputFilePath);
|
||||
this.document.Close(false);
|
||||
this.document = null;
|
||||
|
||||
this.ReleaseOfficeApplicationInstanceIfNeeded();
|
||||
|
||||
if (this.pdf2ImageConversionJob != null)
|
||||
{
|
||||
if (!System.IO.File.Exists(this.intermediateFilePath))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorCantFindOutputFiles);
|
||||
return;
|
||||
}
|
||||
|
||||
Task updateProgress = this.UpdateProgress();
|
||||
|
||||
Diagnostics.Debug.Log("Convert pdf to images.");
|
||||
|
||||
this.pdf2ImageConversionJob.StartConvertion();
|
||||
|
||||
if (this.pdf2ImageConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.pdf2ImageConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.intermediateFilePath))
|
||||
{
|
||||
Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
|
||||
|
||||
File.Delete(this.intermediateFilePath);
|
||||
}
|
||||
|
||||
updateProgress.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitializeOfficeApplicationInstanceIfNecessary()
|
||||
{
|
||||
if (this.application != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize excel application.
|
||||
Diagnostics.Debug.Log("Instantiate excel application via interop.");
|
||||
this.application = new Excel.Application
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
}
|
||||
|
||||
protected override void ReleaseOfficeApplicationInstanceIfNeeded()
|
||||
{
|
||||
if (this.application == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log("Quit excel application via interop.");
|
||||
this.application.Quit();
|
||||
this.application = null;
|
||||
}
|
||||
|
||||
private async Task UpdateProgress()
|
||||
{
|
||||
while (this.pdf2ImageConversionJob.State != ConversionState.Done &&
|
||||
this.pdf2ImageConversionJob.State != ConversionState.Failed)
|
||||
{
|
||||
if (this.pdf2ImageConversionJob != null && this.pdf2ImageConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pdf2ImageConversionJob.Progress;
|
||||
}
|
||||
|
||||
if (this.pdf2ImageConversionJob != null && this.pdf2ImageConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pdf2ImageConversionJob.Progress;
|
||||
this.UserState = this.pdf2ImageConversionJob.UserState;
|
||||
}
|
||||
|
||||
await Task.Delay(40);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryLoadDocumentIfNecessary()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.InitializeOfficeApplicationInstanceIfNecessary();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.Log(exception.ToString());
|
||||
Debug.Log("Failed to initialize office application.");
|
||||
}
|
||||
|
||||
if (this.application == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.document == null)
|
||||
{
|
||||
Diagnostics.Debug.Log("Load excel document '{0}'.", this.InputFilePath);
|
||||
|
||||
this.document = this.application.Workbooks.Open(this.InputFilePath, System.Reflection.Missing.Value, true);
|
||||
}
|
||||
|
||||
return this.document != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
// <copyright file="ConversionJob_ExtractCDA.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
using Diagnostics;
|
||||
using Ripper;
|
||||
using WaveLib;
|
||||
using Yeti.MMedia;
|
||||
|
||||
public class ConversionJob_ExtractCDA : ConversionJob
|
||||
{
|
||||
private Ripper.CDDrive diskDrive;
|
||||
private int cdaTrackNumber = -1;
|
||||
private WaveWriter waveWriter;
|
||||
private string intermediateFilePath;
|
||||
private ConversionJob compressionConversionJob;
|
||||
private System.Threading.Thread compressionThread;
|
||||
|
||||
public ConversionJob_ExtractCDA() : base()
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
public ConversionJob_ExtractCDA(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
protected override InputPostConversionAction InputPostConversionAction
|
||||
{
|
||||
get
|
||||
{
|
||||
return InputPostConversionAction.None;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
base.Cancel();
|
||||
|
||||
this.compressionConversionJob.Cancel();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
// Retrieve and check drive letter.
|
||||
string pathDriveLetter = PathHelpers.GetPathDriveLetter(this.InputFilePath);
|
||||
if (pathDriveLetter.Length == 0)
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailToRetrieveInputPathDriveLetter);
|
||||
return;
|
||||
}
|
||||
|
||||
char driveLetter = pathDriveLetter[0];
|
||||
|
||||
this.diskDrive = new Ripper.CDDrive();
|
||||
this.diskDrive.CDRemoved += new EventHandler(this.CdDriveCdRemoved);
|
||||
|
||||
bool driveLetterFound = false;
|
||||
char[] driveLetters = Ripper.CDDrive.GetCDDriveLetters();
|
||||
for (int index = 0; index < driveLetters.Length; index++)
|
||||
{
|
||||
driveLetterFound |= driveLetters[index] == driveLetter;
|
||||
}
|
||||
|
||||
if (!driveLetterFound)
|
||||
{
|
||||
Debug.Log($"Invalid drive letter {driveLetter}.");
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailToRetrieveInputPathDriveLetter);
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve and track number.
|
||||
try
|
||||
{
|
||||
this.cdaTrackNumber = PathHelpers.GetCDATrackNumber(this.InputFilePath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.Log($"Input path: '{this.InputFilePath}'.");
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailToRetrieveTrackNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.diskDrive.IsOpened)
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailToUseCDDriveOpen);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.diskDrive.Open(driveLetter))
|
||||
{
|
||||
this.ConversionFailed(string.Format(Properties.Resources.ErrorFailToReadCDDrive, driveLetter));
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate intermediate file path.
|
||||
string fileName = Path.GetFileName(this.OutputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
this.intermediateFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + ".wav");
|
||||
|
||||
// Sub conversion job (for compression).
|
||||
this.compressionConversionJob = ConversionJobFactory.Create(this.ConversionPreset, this.intermediateFilePath);
|
||||
this.compressionConversionJob.PrepareConversion(this.OutputFilePath);
|
||||
this.compressionThread = Helpers.InstantiateThread("CDACompressionThread", this.CompressAsync);
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
Debug.Log("Starting CDA extraction.");
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateExtraction;
|
||||
|
||||
if (!this.diskDrive.IsCDReady())
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorCDDriveNotReady);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.diskDrive.Refresh())
|
||||
{
|
||||
Debug.Log("Can't refresh CD drive data.");
|
||||
this.ConversionFailed(Properties.Resources.ErrorCDDriveNotReady);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.diskDrive.LockCD())
|
||||
{
|
||||
Debug.Log("Can\'t lock cd.");
|
||||
this.ConversionFailed(Properties.Resources.ErrorCDDriveNotReady);
|
||||
return;
|
||||
}
|
||||
|
||||
WaveFormat waveFormat = new WaveFormat(44100, 16, 2);
|
||||
|
||||
using (Stream waveStream = new FileStream(this.intermediateFilePath, FileMode.Create, FileAccess.Write))
|
||||
using (this.waveWriter = new WaveWriter(waveStream, waveFormat, this.diskDrive.TrackSize(this.cdaTrackNumber)))
|
||||
{
|
||||
this.diskDrive.ReadTrack(this.cdaTrackNumber, this.WriteWaveData, this.CdReadProgress);
|
||||
}
|
||||
|
||||
this.waveWriter = null;
|
||||
|
||||
this.diskDrive.UnLockCD();
|
||||
|
||||
this.diskDrive.Close();
|
||||
|
||||
this.StateFlags = ConversionFlags.None;
|
||||
|
||||
if (!File.Exists(this.intermediateFilePath))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorCDAExtractionFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("CDA extracted to {0}.", this.intermediateFilePath);
|
||||
Debug.Log(string.Empty);
|
||||
Debug.Log("Start compression.");
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateConversion;
|
||||
|
||||
this.compressionThread.Start();
|
||||
|
||||
while (this.compressionConversionJob.State != ConversionState.Done &&
|
||||
this.compressionConversionJob.State != ConversionState.Failed)
|
||||
{
|
||||
this.Progress = this.compressionConversionJob.Progress;
|
||||
}
|
||||
|
||||
if (this.compressionConversionJob.State == ConversionState.Failed)
|
||||
{
|
||||
this.ConversionFailed(this.compressionConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log(string.Empty);
|
||||
Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
|
||||
|
||||
File.Delete(this.intermediateFilePath);
|
||||
}
|
||||
|
||||
private void WriteWaveData(object sender, DataReadEventArgs eventArgs)
|
||||
{
|
||||
this.waveWriter?.Write(eventArgs.Data, 0, (int)eventArgs.DataSize);
|
||||
}
|
||||
|
||||
private void CdReadProgress(object sender, ReadProgressEventArgs eventArgs)
|
||||
{
|
||||
if (this.CancelIsRequested)
|
||||
{
|
||||
eventArgs.CancelRead = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.Progress = (float)eventArgs.BytesRead / (float)eventArgs.Bytes2Read;
|
||||
|
||||
eventArgs.CancelRead |= this.State != ConversionState.InProgress;
|
||||
}
|
||||
|
||||
private void CdDriveCdRemoved(object sender, System.EventArgs eventArgs)
|
||||
{
|
||||
this.ConversionFailed("The CD has been ejected.");
|
||||
}
|
||||
|
||||
private void CompressAsync()
|
||||
{
|
||||
this.compressionConversionJob.StartConvertion();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
// <copyright file="ConversionJob_FFMPEG.Converters.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
using FileConverter.Controls;
|
||||
|
||||
public partial class ConversionJob_FFMPEG
|
||||
{
|
||||
private static string Encapsulate(string optionName, string args)
|
||||
{
|
||||
if (string.IsNullOrEmpty(args))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Format("{0} \"{1}\"", optionName, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compute the argument needed to change the number of channels in an audio file.
|
||||
/// </summary>
|
||||
/// <param name="conversionPreset">The conversion preset</param>
|
||||
/// <returns>The argument string.</returns>
|
||||
/// https://trac.ffmpeg.org/wiki/AudioChannelManipulation
|
||||
private static string ComputeAudioChannelArgs(ConversionPreset conversionPreset)
|
||||
{
|
||||
string channelArgs = string.Empty;
|
||||
int channelCount = conversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioChannelCount);
|
||||
if (channelCount > 0)
|
||||
{
|
||||
channelArgs = $"-ac {channelCount}";
|
||||
}
|
||||
|
||||
return channelArgs;
|
||||
}
|
||||
|
||||
private static string ComputeTransformArgs(ConversionPreset conversionPreset)
|
||||
{
|
||||
float scaleFactor = conversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.VideoScale);
|
||||
string scaleArgs = string.Empty;
|
||||
|
||||
if (conversionPreset.OutputType == OutputType.Mkv || conversionPreset.OutputType == OutputType.Mp4)
|
||||
{
|
||||
// This presets use h264 codec, the size of the video need to be divisible by 2.
|
||||
scaleArgs = string.Format("scale=trunc(iw*{0}/2)*2:trunc(ih*{0}/2)*2", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (Math.Abs(scaleFactor - 1f) >= 0.005f)
|
||||
{
|
||||
scaleArgs = string.Format("scale=iw*{0}:ih*{0}", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
float rotationAngleInDegrees = conversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.VideoRotation);
|
||||
string rotationArgs = string.Empty;
|
||||
if (Math.Abs(rotationAngleInDegrees - 0f) >= 0.05f)
|
||||
{
|
||||
// Transpose:
|
||||
// 0: 90 CounterClockwise and vertical flip
|
||||
// 1: 90 Clockwise
|
||||
// 2: 90 CounterClockwise
|
||||
// 3: 90 Clockwise and vertical flip
|
||||
if (Math.Abs(rotationAngleInDegrees - 90f) <= 0.05f)
|
||||
{
|
||||
rotationArgs = "transpose=2";
|
||||
}
|
||||
else if (Math.Abs(rotationAngleInDegrees - 180f) <= 0.05f)
|
||||
{
|
||||
rotationArgs = "vflip,hflip";
|
||||
}
|
||||
else if (Math.Abs(rotationAngleInDegrees - 270f) <= 0.05f)
|
||||
{
|
||||
rotationArgs = "transpose=1";
|
||||
}
|
||||
else
|
||||
{
|
||||
Diagnostics.Debug.LogError("Unsupported rotation: {0}°", rotationAngleInDegrees);
|
||||
}
|
||||
}
|
||||
|
||||
// Build vf args content (scale=..., transpose=...)
|
||||
string transformArgs = string.Empty;
|
||||
if (!string.IsNullOrEmpty(scaleArgs))
|
||||
{
|
||||
transformArgs += scaleArgs;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(rotationArgs))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(transformArgs))
|
||||
{
|
||||
transformArgs += ",";
|
||||
}
|
||||
|
||||
transformArgs += rotationArgs;
|
||||
}
|
||||
|
||||
return transformArgs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert bitrate in <c>mp3</c> encoder quality index.
|
||||
/// </summary>
|
||||
/// <param name="bitrate">Wanted bitrate value.</param>
|
||||
/// <returns>The <c>mp3</c> encoder quality index associated to the given bitrate value.</returns>
|
||||
/// https://trac.ffmpeg.org/wiki/Encode/MP3
|
||||
private int MP3VBRBitrateToQualityIndex(int bitrate)
|
||||
{
|
||||
switch (bitrate)
|
||||
{
|
||||
case 245:
|
||||
return 0;
|
||||
|
||||
case 225:
|
||||
return 1;
|
||||
|
||||
case 190:
|
||||
return 2;
|
||||
|
||||
case 175:
|
||||
return 3;
|
||||
|
||||
case 165:
|
||||
return 4;
|
||||
|
||||
case 130:
|
||||
return 5;
|
||||
|
||||
case 115:
|
||||
return 6;
|
||||
|
||||
case 100:
|
||||
return 7;
|
||||
|
||||
case 85:
|
||||
return 8;
|
||||
|
||||
case 65:
|
||||
return 9;
|
||||
}
|
||||
|
||||
throw new Exception("Unknown VBR bitrate.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert bitrate in <c>vorbis</c> encoder quality index.
|
||||
/// </summary>
|
||||
/// <param name="bitrate">Wanted bitrate value.</param>
|
||||
/// <returns>The <c>vorbis</c> encoder quality index associated to the given bitrate value.</returns>
|
||||
/// http://wiki.hydrogenaud.io/index.php?title=Recommended_Ogg_Vorbis
|
||||
private int OGGVBRBitrateToQualityIndex(int bitrate)
|
||||
{
|
||||
switch (bitrate)
|
||||
{
|
||||
case 500:
|
||||
return 10;
|
||||
|
||||
case 320:
|
||||
return 9;
|
||||
|
||||
case 256:
|
||||
return 8;
|
||||
|
||||
case 224:
|
||||
return 7;
|
||||
|
||||
case 192:
|
||||
return 6;
|
||||
|
||||
case 160:
|
||||
return 5;
|
||||
|
||||
case 128:
|
||||
return 4;
|
||||
|
||||
case 112:
|
||||
return 3;
|
||||
|
||||
case 96:
|
||||
return 2;
|
||||
|
||||
case 80:
|
||||
return 1;
|
||||
|
||||
case 64:
|
||||
return 0;
|
||||
|
||||
case 48:
|
||||
return -1;
|
||||
|
||||
case 32:
|
||||
return -2;
|
||||
}
|
||||
|
||||
throw new Exception("Unknown Ogg VBR bitrate.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert video quality index to lib <c>theora</c> video quality level.
|
||||
/// </summary>
|
||||
/// <param name="quality">The quality index.</param>
|
||||
/// <returns>Returns the video quality index.</returns>
|
||||
/// The range of the video quality level is 0-10: where 10 is the highest quality/largest filesize, 0 being the lowest quality/smallest filesize.
|
||||
/// https://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide
|
||||
private int OGVTheoraQualityToQualityIndex(int quality)
|
||||
{
|
||||
return quality;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert encoding mode setting to <c>ffmpeg</c> argument option.
|
||||
/// </summary>
|
||||
/// <param name="encoding">The encoding mode setting.</param>
|
||||
/// <returns>Returns the <c>ffmpeg</c> argument corresponding to the given encoding mode.</returns>
|
||||
/// https://trac.ffmpeg.org/wiki/audio%20types
|
||||
private string WAVEncodingToCodecArgument(EncodingMode encoding)
|
||||
{
|
||||
switch (encoding)
|
||||
{
|
||||
case EncodingMode.Wav8:
|
||||
return "pcm_s8le";
|
||||
|
||||
case EncodingMode.Wav16:
|
||||
return "pcm_s16le";
|
||||
|
||||
case EncodingMode.Wav24:
|
||||
return "pcm_s24le";
|
||||
|
||||
case EncodingMode.Wav32:
|
||||
return "pcm_s32le";
|
||||
}
|
||||
|
||||
throw new Exception("Unknown Wav encoding.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert video quality index to MPEG4 video quality level.
|
||||
/// </summary>
|
||||
/// <param name="quality">The quality index.</param>
|
||||
/// <returns>Returns the H264 constant rate factor.</returns>
|
||||
/// The range of the video quality level is 1-31: where 1 is the highest quality/largest filesize, 31 being the lowest quality/smallest filesize.
|
||||
/// https://trac.ffmpeg.org/wiki/Encode/MPEG-4
|
||||
private int MPEG4QualityToQualityIndex(int quality)
|
||||
{
|
||||
return 31 - quality;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert video quality index to H264 constant rate factor.
|
||||
/// </summary>
|
||||
/// <param name="quality">The quality index.</param>
|
||||
/// <returns>Returns the H264 constant rate factor.</returns>
|
||||
/// The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible.
|
||||
/// A lower value is a higher quality and a subjectively sane range is 18-28.
|
||||
/// https://trac.ffmpeg.org/wiki/Encode/H.264
|
||||
private int H264QualityToCRF(int quality)
|
||||
{
|
||||
return 51 - quality;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert image quality index to JPG quality index.
|
||||
/// </summary>
|
||||
/// <param name="quality">The quality index.</param>
|
||||
/// <returns>Returns the JPG quality index.</returns>
|
||||
/// The range of the quantizer scale is 1-31: where 1 is better quality, and 31 is worst possible.
|
||||
/// http://superuser.com/questions/318845/improve-quality-of-ffmpeg-created-jpgs
|
||||
private int JPGQualityToQualityIndex(int quality)
|
||||
{
|
||||
return 31 - quality;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert video encoding speed to H264 preset.
|
||||
/// </summary>
|
||||
/// <param name="encodingSpeed">The encoding speed.</param>
|
||||
/// <returns>The H264 preset.</returns>
|
||||
private string H264EncodingSpeedToPreset(VideoEncodingSpeed encodingSpeed)
|
||||
{
|
||||
switch (encodingSpeed)
|
||||
{
|
||||
case VideoEncodingSpeed.UltraFast:
|
||||
return "ultrafast";
|
||||
|
||||
case VideoEncodingSpeed.SuperFast:
|
||||
return "superfast";
|
||||
|
||||
case VideoEncodingSpeed.VeryFast:
|
||||
return "veryfast";
|
||||
|
||||
case VideoEncodingSpeed.Faster:
|
||||
return "faster";
|
||||
|
||||
case VideoEncodingSpeed.Fast:
|
||||
return "fast";
|
||||
|
||||
case VideoEncodingSpeed.Medium:
|
||||
return "medium";
|
||||
|
||||
case VideoEncodingSpeed.Slow:
|
||||
return "slow";
|
||||
|
||||
case VideoEncodingSpeed.Slower:
|
||||
return "slower";
|
||||
|
||||
case VideoEncodingSpeed.VerySlow:
|
||||
return "veryslow";
|
||||
}
|
||||
|
||||
throw new Exception("Unknown H264 encoding speed.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert bitrate in <c>aac</c> encoder quality index.
|
||||
/// </summary>
|
||||
/// <param name="bitrate">Wanted bitrate value.</param>
|
||||
/// <returns>The <c>aac</c> encoder quality index associated to the given bitrate value.</returns>
|
||||
/// See the file Resources/FFMPEG retro engineering.ods for details.
|
||||
private string AACBitrateToQualityIndex(int bitrate)
|
||||
{
|
||||
switch (bitrate)
|
||||
{
|
||||
case 460:
|
||||
return "3.9";
|
||||
|
||||
case 340:
|
||||
return "3";
|
||||
|
||||
case 256:
|
||||
return "2.2";
|
||||
|
||||
case 224:
|
||||
return "1.9";
|
||||
|
||||
case 192:
|
||||
return "1.6";
|
||||
|
||||
case 155:
|
||||
return "1.3";
|
||||
|
||||
case 128:
|
||||
return "1";
|
||||
|
||||
case 112:
|
||||
return "0.9";
|
||||
|
||||
case 96:
|
||||
return "0.75";
|
||||
|
||||
case 80:
|
||||
return "0.6";
|
||||
|
||||
case 64:
|
||||
return "0.45";
|
||||
|
||||
case 48:
|
||||
return "0.3";
|
||||
|
||||
case 32:
|
||||
return "0.2";
|
||||
|
||||
case 16:
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
throw new Exception("Unknown VBR bitrate.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert video quality index to H264 constant rate factor.
|
||||
/// </summary>
|
||||
/// <param name="quality">The quality index.</param>
|
||||
/// <returns>Returns the H264 constant rate factor.</returns>
|
||||
/// The range of the quantizer scale is 0-63: lower values mean better quality.
|
||||
/// https://trac.ffmpeg.org/wiki/Encode/VP9
|
||||
private int WebmQualityToCRF(int quality)
|
||||
{
|
||||
return 63 - quality;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
// <copyright file="ConversionJob_FFMPEG.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using FileConverter.Controls;
|
||||
|
||||
public partial class ConversionJob_FFMPEG : ConversionJob
|
||||
{
|
||||
private readonly Regex durationRegex = new Regex(@"Duration:\s*([0-9][0-9]):([0-9][0-9]):([0-9][0-9])\.([0-9][0-9]),.*bitrate:\s*([0-9]+) kb\/s");
|
||||
private readonly Regex progressRegex = new Regex(@"size=\s*([0-9]+)kB\s+time=([0-9][0-9]):([0-9][0-9]):([0-9][0-9]).([0-9][0-9])\s+bitrate=\s*([0-9]+.[0-9])kbits\/s");
|
||||
|
||||
private TimeSpan fileDuration;
|
||||
private TimeSpan actualConvertedDuration;
|
||||
|
||||
private ProcessStartInfo ffmpegProcessStartInfo;
|
||||
|
||||
private List<FFMpegPass> ffmpegArgumentStringByPass = new List<FFMpegPass>();
|
||||
|
||||
public ConversionJob_FFMPEG() : base()
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
public ConversionJob_FFMPEG(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
protected virtual string FfmpegPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string applicationDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
return System.IO.Path.Combine(applicationDirectory, "ffmpeg.exe");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
this.ffmpegProcessStartInfo = null;
|
||||
|
||||
string ffmpegPath = this.FfmpegPath;
|
||||
if (!System.IO.File.Exists(ffmpegPath))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorCantFindFFMPEG);
|
||||
Diagnostics.Debug.Log("Can't find ffmpeg executable ({0}). Try to reinstall the application.", ffmpegPath);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ffmpegProcessStartInfo = new ProcessStartInfo(ffmpegPath);
|
||||
|
||||
this.ffmpegProcessStartInfo.CreateNoWindow = true;
|
||||
this.ffmpegProcessStartInfo.UseShellExecute = false;
|
||||
this.ffmpegProcessStartInfo.RedirectStandardOutput = true;
|
||||
this.ffmpegProcessStartInfo.RedirectStandardError = true;
|
||||
|
||||
this.FillFFMpegArgumentsList();
|
||||
}
|
||||
|
||||
protected virtual void FillFFMpegArgumentsList()
|
||||
{
|
||||
// This option are necessary to be able to read metadata on Windows. src: http://jonhall.info/how_to/create_id3_tags_using_ffmpeg
|
||||
const string mp3MetadataArgs = "-id3v2_version 3 -write_id3v1 1";
|
||||
// AAC have no standard tag system, use ApeV2 (that are compatible). src: http://eolindel.free.fr/foobar/tags.shtml
|
||||
const string aacMetadataArgs = "-write_apetag 1";
|
||||
|
||||
switch (this.ConversionPreset.OutputType)
|
||||
{
|
||||
case OutputType.Aac:
|
||||
{
|
||||
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);
|
||||
|
||||
// https://trac.ffmpeg.org/wiki/Encode/AAC
|
||||
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
string encoderArgs = $"-c:a aac -q:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)} {channelArgs} {aacMetadataArgs}";
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Avi:
|
||||
{
|
||||
// https://trac.ffmpeg.org/wiki/Encode/MPEG-4
|
||||
int videoEncodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.VideoQuality);
|
||||
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
|
||||
string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
|
||||
|
||||
string audioArgs = "-an";
|
||||
if (this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.EnableAudio))
|
||||
{
|
||||
audioArgs = string.Format("-c:a libmp3lame -qscale:a {0}", this.MP3VBRBitrateToQualityIndex(audioEncodingBitrate));
|
||||
}
|
||||
|
||||
// Compute final arguments.
|
||||
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);
|
||||
string encoderArgs = $"-c:v mpeg4 -vtag xvid -qscale:v {this.MPEG4QualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs} {mp3MetadataArgs}";
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Flac:
|
||||
{
|
||||
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);
|
||||
|
||||
// http://taer-naguur.blogspot.fr/2013/11/flac-audio-encoding-with-ffmpeg.html
|
||||
string encoderArgs = $"-compression_level 12 {channelArgs}";
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Gif:
|
||||
{
|
||||
// http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
|
||||
string fileName = Path.GetFileName(this.InputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
string paletteFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + " - palette.png");
|
||||
|
||||
string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
|
||||
|
||||
// fps.
|
||||
int framesPerSecond = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.VideoFramesPerSecond);
|
||||
if (!string.IsNullOrEmpty(transformArgs))
|
||||
{
|
||||
transformArgs += ",";
|
||||
}
|
||||
|
||||
transformArgs += string.Format("fps={0}", framesPerSecond);
|
||||
|
||||
// Generate palette.
|
||||
string encoderArgs = string.Format("-vf \"{0},palettegen\"", transformArgs);
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, paletteFilePath, encoderArgs);
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass("Indexing colors", arguments, paletteFilePath));
|
||||
|
||||
// Create gif.
|
||||
encoderArgs = string.Format("-i \"{0}\" -lavfi \"{1},paletteuse\"", paletteFilePath, transformArgs);
|
||||
arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Ico:
|
||||
{
|
||||
string encoderArgs = string.Empty;
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Jpg:
|
||||
{
|
||||
int encodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageQuality);
|
||||
|
||||
float scaleFactor = this.ConversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.ImageScale);
|
||||
string scaleArgs = string.Empty;
|
||||
if (Math.Abs(scaleFactor - 1f) >= 0.005f)
|
||||
{
|
||||
scaleArgs = string.Format("-vf scale=iw*{0}:ih*{0}", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
string encoderArgs = string.Format("-q:v {0} {1}", this.JPGQualityToQualityIndex(encodingQuality), scaleArgs);
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Mp3:
|
||||
{
|
||||
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);
|
||||
|
||||
string encoderArgs = string.Empty;
|
||||
EncodingMode encodingMode = this.ConversionPreset.GetSettingsValue<EncodingMode>(ConversionPreset.ConversionSettingKeys.AudioEncodingMode);
|
||||
int encodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
switch (encodingMode)
|
||||
{
|
||||
case EncodingMode.Mp3VBR:
|
||||
encoderArgs = $"-codec:a libmp3lame -q:a {this.MP3VBRBitrateToQualityIndex(encodingQuality)} {channelArgs} {mp3MetadataArgs}";
|
||||
break;
|
||||
|
||||
case EncodingMode.Mp3CBR:
|
||||
encoderArgs = $"-codec:a libmp3lame -b:a {encodingQuality}k {channelArgs} {mp3MetadataArgs}";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Mkv:
|
||||
case OutputType.Mp4:
|
||||
{
|
||||
// https://trac.ffmpeg.org/wiki/Encode/H.264
|
||||
// https://trac.ffmpeg.org/wiki/Encode/AAC
|
||||
int videoEncodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.VideoQuality);
|
||||
VideoEncodingSpeed videoEncodingSpeed = this.ConversionPreset.GetSettingsValue<VideoEncodingSpeed>(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed);
|
||||
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
|
||||
string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
|
||||
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);
|
||||
|
||||
string audioArgs = "-an";
|
||||
if (this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.EnableAudio))
|
||||
{
|
||||
audioArgs = $"-c:a aac -qscale:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)}";
|
||||
}
|
||||
|
||||
string encoderArgs = string.Format(
|
||||
"-c:v libx264 -preset {0} -crf {1} {2} {3}",
|
||||
this.H264EncodingSpeedToPreset(videoEncodingSpeed),
|
||||
this.H264QualityToCRF(videoEncodingQuality),
|
||||
audioArgs,
|
||||
videoFilteringArgs);
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Ogg:
|
||||
{
|
||||
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);
|
||||
|
||||
int encodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
string encoderArgs = $"-vn -codec:a libvorbis -qscale:a {this.OGGVBRBitrateToQualityIndex(encodingQuality)} {channelArgs}";
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Ogv:
|
||||
{
|
||||
// https://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide
|
||||
int videoEncodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.VideoQuality);
|
||||
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
|
||||
string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
|
||||
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);
|
||||
|
||||
string audioArgs = "-an";
|
||||
if (this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.EnableAudio))
|
||||
{
|
||||
audioArgs = $"-codec:a libvorbis -qscale:a {this.OGGVBRBitrateToQualityIndex(audioEncodingBitrate)}";
|
||||
}
|
||||
|
||||
string encoderArgs = $"-codec:v libtheora -qscale:v {this.OGVTheoraQualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs}";
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Png:
|
||||
{
|
||||
float scaleFactor = this.ConversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.ImageScale);
|
||||
string scaleArgs = string.Empty;
|
||||
if (Math.Abs(scaleFactor - 1f) >= 0.005f)
|
||||
{
|
||||
scaleArgs = string.Format("-vf scale=iw*{0}:ih*{0}", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
// http://www.howtogeek.com/203979/is-the-png-format-lossless-since-it-has-a-compression-parameter/
|
||||
string encoderArgs = string.Format("-compression_level 100 {0}", scaleArgs);
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Wav:
|
||||
{
|
||||
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);
|
||||
|
||||
EncodingMode encodingMode = this.ConversionPreset.GetSettingsValue<EncodingMode>(ConversionPreset.ConversionSettingKeys.AudioEncodingMode);
|
||||
string encoderArgs = $"-acodec {this.WAVEncodingToCodecArgument(encodingMode)} {channelArgs}";
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OutputType.Webm:
|
||||
{
|
||||
// https://trac.ffmpeg.org/wiki/Encode/VP9
|
||||
int videoEncodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.VideoQuality);
|
||||
int audioEncodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
|
||||
|
||||
string encodingArgs = string.Empty;
|
||||
if (videoEncodingQuality == 63)
|
||||
{
|
||||
// Replace maximum quality settings by lossless compression.
|
||||
encodingArgs = $"-lossless 1";
|
||||
}
|
||||
else
|
||||
{
|
||||
encodingArgs = $"-crf {this.WebmQualityToCRF(videoEncodingQuality)} -b:v 0";
|
||||
}
|
||||
|
||||
string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
|
||||
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);
|
||||
|
||||
string audioArgs = "-an";
|
||||
if (this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.EnableAudio))
|
||||
{
|
||||
audioArgs = string.Format("-c:a libvorbis -qscale:a {0}", this.OGGVBRBitrateToQualityIndex(audioEncodingQuality));
|
||||
}
|
||||
|
||||
string encoderArgs = string.Format(
|
||||
"-c:v libvpx-vp9 {0} {1} {2}",
|
||||
encodingArgs,
|
||||
audioArgs,
|
||||
videoFilteringArgs);
|
||||
|
||||
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
|
||||
|
||||
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Converter not implemented for output file type " +
|
||||
this.ConversionPreset.OutputType);
|
||||
}
|
||||
|
||||
if (this.ffmpegArgumentStringByPass.Count == 0)
|
||||
{
|
||||
throw new Exception("No ffmpeg arguments generated.");
|
||||
}
|
||||
|
||||
for (int index = 0; index < this.ffmpegArgumentStringByPass.Count; index++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ffmpegArgumentStringByPass[index].Arguments))
|
||||
{
|
||||
throw new Exception("Invalid ffmpeg process arguments.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
for (int index = 0; index < this.ffmpegArgumentStringByPass.Count; index++)
|
||||
{
|
||||
FFMpegPass currentPass = this.ffmpegArgumentStringByPass[index];
|
||||
|
||||
this.UserState = currentPass.Name;
|
||||
this.ffmpegProcessStartInfo.Arguments = currentPass.Arguments;
|
||||
|
||||
Diagnostics.Debug.Log("Execute command: {0} {1}.", this.ffmpegProcessStartInfo.FileName, this.ffmpegProcessStartInfo.Arguments);
|
||||
Diagnostics.Debug.Log(string.Empty);
|
||||
|
||||
try
|
||||
{
|
||||
using (Process exeProcess = Process.Start(this.ffmpegProcessStartInfo))
|
||||
{
|
||||
using (StreamReader reader = exeProcess.StandardError)
|
||||
{
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
if (this.CancelIsRequested && !exeProcess.HasExited)
|
||||
{
|
||||
exeProcess.Kill();
|
||||
}
|
||||
|
||||
string result = reader.ReadLine();
|
||||
|
||||
this.ParseFFMPEGOutput(result);
|
||||
|
||||
Diagnostics.Debug.Log("ffmpeg output: {0}", result);
|
||||
}
|
||||
}
|
||||
|
||||
exeProcess.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorFailedToLaunchFFMPEG);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log(string.Empty);
|
||||
|
||||
// Clean intermediate files.
|
||||
for (int index = 0; index < this.ffmpegArgumentStringByPass.Count; index++)
|
||||
{
|
||||
FFMpegPass currentPass = this.ffmpegArgumentStringByPass[index];
|
||||
|
||||
if (string.IsNullOrEmpty(currentPass.FileToDelete))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log("Delete intermediate file {0}.", currentPass.FileToDelete);
|
||||
|
||||
File.Delete(currentPass.FileToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseFFMPEGOutput(string input)
|
||||
{
|
||||
Match match = this.durationRegex.Match(input);
|
||||
if (match.Success && match.Groups.Count >= 6)
|
||||
{
|
||||
int hours = int.Parse(match.Groups[1].Value);
|
||||
int minutes = int.Parse(match.Groups[2].Value);
|
||||
int seconds = int.Parse(match.Groups[3].Value);
|
||||
int milliseconds = int.Parse(match.Groups[4].Value);
|
||||
float bitrate = float.Parse(match.Groups[5].Value);
|
||||
this.fileDuration = new TimeSpan(0, hours, minutes, seconds, milliseconds);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.fileDuration.Ticks > 0)
|
||||
{
|
||||
match = this.progressRegex.Match(input);
|
||||
if (match.Success && match.Groups.Count >= 7)
|
||||
{
|
||||
int size = int.Parse(match.Groups[1].Value);
|
||||
int hours = int.Parse(match.Groups[2].Value);
|
||||
int minutes = int.Parse(match.Groups[3].Value);
|
||||
int seconds = int.Parse(match.Groups[4].Value);
|
||||
int milliseconds = int.Parse(match.Groups[5].Value) * 10;
|
||||
float bitrate = 0f;
|
||||
float.TryParse(match.Groups[6].Value, out bitrate);
|
||||
|
||||
this.actualConvertedDuration = new TimeSpan(0, hours, minutes, seconds, milliseconds);
|
||||
|
||||
this.Progress = this.actualConvertedDuration.Ticks / (float)this.fileDuration.Ticks;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (input.Contains("Exiting.") || input.Contains("Error") || input.Contains("Unsupported dimensions") || input.Contains("No such file or directory"))
|
||||
{
|
||||
if (input.StartsWith("Error while decoding stream") && input.EndsWith("Invalid data found when processing input"))
|
||||
{
|
||||
// It is normal for a transport stream to start with a broken frame.
|
||||
// https://trac.ffmpeg.org/ticket/1622
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ConversionFailed(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct FFMpegPass
|
||||
{
|
||||
public string Name;
|
||||
public string Arguments;
|
||||
public string FileToDelete;
|
||||
|
||||
public FFMpegPass(string name, string arguments, string fileToDelete)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Arguments = arguments;
|
||||
this.FileToDelete = fileToDelete;
|
||||
}
|
||||
|
||||
public FFMpegPass(string arguments)
|
||||
{
|
||||
this.Name = "Conversion";
|
||||
this.Arguments = arguments;
|
||||
this.FileToDelete = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
// <copyright file="ConversionJob_Gif.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class ConversionJob_Gif : ConversionJob
|
||||
{
|
||||
private string intermediateFilePath = string.Empty;
|
||||
private ConversionJob pngConversionJob = null;
|
||||
private ConversionJob gifConversionJob = null;
|
||||
|
||||
public ConversionJob_Gif(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
base.Cancel();
|
||||
|
||||
this.pngConversionJob.Cancel();
|
||||
this.gifConversionJob.Cancel();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
string extension = System.IO.Path.GetExtension(this.InputFilePath);
|
||||
extension = extension.ToLowerInvariant().Substring(1, extension.Length - 1);
|
||||
|
||||
string inputFilePath = string.Empty;
|
||||
|
||||
// If the output is an image start to convert it into png before send it to ffmpeg.
|
||||
if (Helpers.GetExtensionCategory(extension) == Helpers.InputCategoryNames.Image && extension != "png")
|
||||
{
|
||||
// Generate intermediate file path.
|
||||
string fileName = Path.GetFileName(this.OutputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
this.intermediateFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + ".png");
|
||||
|
||||
// Convert input in png file to send it to ffmpeg for the gif conversion.
|
||||
ConversionPreset intermediatePreset = new ConversionPreset("To compatible image", OutputType.Png, this.ConversionPreset.InputTypes.ToArray());
|
||||
this.pngConversionJob = ConversionJobFactory.Create(intermediatePreset, this.InputFilePath);
|
||||
this.pngConversionJob.PrepareConversion(this.intermediateFilePath);
|
||||
|
||||
inputFilePath = this.intermediateFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
inputFilePath = this.InputFilePath;
|
||||
}
|
||||
|
||||
// Convert png file into ico.
|
||||
this.gifConversionJob = new ConversionJob_FFMPEG(this.ConversionPreset, inputFilePath);
|
||||
this.gifConversionJob.PrepareConversion(this.OutputFilePath);
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
Task updateProgress = this.UpdateProgress();
|
||||
|
||||
if (this.pngConversionJob != null)
|
||||
{
|
||||
this.UserState = Properties.Resources.ConversionStateReadIntputImage;
|
||||
|
||||
Diagnostics.Debug.Log(string.Empty);
|
||||
Diagnostics.Debug.Log("Convert image to PNG (intermediate format).");
|
||||
this.pngConversionJob.StartConvertion();
|
||||
|
||||
if (this.pngConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.pngConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log(string.Empty);
|
||||
Diagnostics.Debug.Log("Convert png intermediate image to gif.");
|
||||
this.gifConversionJob.StartConvertion();
|
||||
|
||||
if (this.gifConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.gifConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.intermediateFilePath))
|
||||
{
|
||||
Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
|
||||
|
||||
File.Delete(this.intermediateFilePath);
|
||||
}
|
||||
|
||||
updateProgress.Wait();
|
||||
}
|
||||
|
||||
private async Task UpdateProgress()
|
||||
{
|
||||
while (this.gifConversionJob.State != ConversionState.Done &&
|
||||
this.gifConversionJob.State != ConversionState.Failed)
|
||||
{
|
||||
if (this.pngConversionJob != null && this.pngConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pngConversionJob.Progress;
|
||||
}
|
||||
|
||||
if (this.gifConversionJob != null && this.gifConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.gifConversionJob.Progress;
|
||||
this.UserState = this.gifConversionJob.UserState;
|
||||
}
|
||||
|
||||
await Task.Delay(40);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// <copyright file="ConversionJob_Ico.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
public class ConversionJob_Ico : ConversionJob
|
||||
{
|
||||
private string intermediateFilePath;
|
||||
private ConversionJob pngConversionJob;
|
||||
private ConversionJob icoConversionJob;
|
||||
|
||||
public ConversionJob_Ico(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
base.Cancel();
|
||||
|
||||
this.pngConversionJob.Cancel();
|
||||
this.icoConversionJob.Cancel();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
// Generate intermediate file path.
|
||||
string fileName = Path.GetFileName(this.OutputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
this.intermediateFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + ".png");
|
||||
|
||||
// Convert input in png file to send it to ffmpeg for the ico conversion.
|
||||
ConversionPreset intermediatePreset = new ConversionPreset("To compatible image", OutputType.Png, this.ConversionPreset.InputTypes.ToArray());
|
||||
intermediatePreset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2, "True");
|
||||
intermediatePreset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageMaximumSize, "256");
|
||||
this.pngConversionJob = ConversionJobFactory.Create(intermediatePreset, this.InputFilePath);
|
||||
this.pngConversionJob.PrepareConversion(this.intermediateFilePath);
|
||||
|
||||
// Convert png file into ico.
|
||||
this.icoConversionJob = new ConversionJob_FFMPEG(this.ConversionPreset, this.intermediateFilePath);
|
||||
this.icoConversionJob.PrepareConversion(this.OutputFilePath);
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log(string.Empty);
|
||||
Diagnostics.Debug.Log("Convert image to PNG (intermediate format).");
|
||||
this.pngConversionJob.StartConvertion();
|
||||
|
||||
if (this.pngConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.pngConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log(string.Empty);
|
||||
Diagnostics.Debug.Log("Convert png intermediate image to ICO.");
|
||||
this.icoConversionJob.StartConvertion();
|
||||
|
||||
if (this.icoConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.icoConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
|
||||
|
||||
File.Delete(this.intermediateFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
// <copyright file="ConversionJob_ImageMagick.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
|
||||
using FileConverter.Diagnostics;
|
||||
using ImageMagick;
|
||||
|
||||
public class ConversionJob_ImageMagick : ConversionJob
|
||||
{
|
||||
private const float BaseDpiForPdfConversion = 200f;
|
||||
private const int PdfSuperSamplingRatio = 1;
|
||||
|
||||
private bool isInputFilePdf;
|
||||
private int pageCount;
|
||||
|
||||
public ConversionJob_ImageMagick() : base()
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
public ConversionJob_ImageMagick(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
this.IsCancelable = true;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
string applicationDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
MagickNET.SetGhostscriptDirectory(applicationDirectory);
|
||||
|
||||
this.isInputFilePdf = System.IO.Path.GetExtension(this.InputFilePath).ToLowerInvariant() == ".pdf";
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
}
|
||||
|
||||
protected override int GetOuputFilesCount()
|
||||
{
|
||||
if (System.IO.Path.GetExtension(this.InputFilePath).ToLowerInvariant() == ".pdf")
|
||||
{
|
||||
using (MagickImageCollection images = new MagickImageCollection())
|
||||
{
|
||||
MagickReadSettings settings = new MagickReadSettings();
|
||||
settings.Density = new Density(1, 1);
|
||||
images.Read(this.InputFilePath);
|
||||
|
||||
return images.Count;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
this.CurrentOuputFilePathIndex = 0;
|
||||
|
||||
if (this.isInputFilePdf)
|
||||
{
|
||||
this.ConvertPdf();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pageCount = 1;
|
||||
using (MagickImage image = new MagickImage(this.InputFilePath))
|
||||
{
|
||||
Debug.Log("Load image {0} succeed.", this.InputFilePath);
|
||||
|
||||
this.ConvertImage(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ConvertPdf()
|
||||
{
|
||||
MagickReadSettings settings = new MagickReadSettings();
|
||||
|
||||
float dpi = BaseDpiForPdfConversion;
|
||||
float scaleFactor = this.ConversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.ImageScale);
|
||||
if (Math.Abs(scaleFactor - 1f) >= 0.005f)
|
||||
{
|
||||
Debug.Log("Apply scale factor: {0}%.", scaleFactor * 100);
|
||||
|
||||
dpi *= scaleFactor;
|
||||
}
|
||||
|
||||
Debug.Log("Density: {0}dpi.", dpi);
|
||||
settings.Density = new Density(dpi * PdfSuperSamplingRatio);
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateReadDocument;
|
||||
|
||||
using (MagickImageCollection images = new MagickImageCollection())
|
||||
{
|
||||
// Add all the pages of the pdf file to the collection
|
||||
images.Read(this.InputFilePath, settings);
|
||||
Debug.Log("Load pdf {0} succeed.", this.InputFilePath);
|
||||
|
||||
this.pageCount = images.Count;
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateConversion;
|
||||
|
||||
foreach (MagickImage image in images)
|
||||
{
|
||||
Debug.Log("Write page {0}/{1}.", this.CurrentOuputFilePathIndex + 1, this.pageCount);
|
||||
|
||||
if (PdfSuperSamplingRatio > 1)
|
||||
{
|
||||
image.Scale(new Percentage(100 / PdfSuperSamplingRatio));
|
||||
}
|
||||
|
||||
this.ConvertImage(image, true);
|
||||
|
||||
this.CurrentOuputFilePathIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ConvertImage(MagickImage image, bool ignoreScale = false)
|
||||
{
|
||||
image.Progress += this.Image_Progress;
|
||||
|
||||
if (!ignoreScale && this.ConversionPreset.IsRelevantSetting(ConversionPreset.ConversionSettingKeys.ImageScale))
|
||||
{
|
||||
float scaleFactor = this.ConversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.ImageScale);
|
||||
if (Math.Abs(scaleFactor - 1f) >= 0.005f)
|
||||
{
|
||||
Debug.Log("Apply scale factor: {0}%.", scaleFactor * 100);
|
||||
|
||||
image.Scale(new Percentage(scaleFactor * 100f));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ConversionPreset.IsRelevantSetting(ConversionPreset.ConversionSettingKeys.ImageRotation))
|
||||
{
|
||||
float rotateAngleInDegrees = this.ConversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.ImageRotation);
|
||||
if (Math.Abs(rotateAngleInDegrees - 0f) >= 0.05f)
|
||||
{
|
||||
Debug.Log("Apply rotation: {0}°.", rotateAngleInDegrees);
|
||||
|
||||
image.Rotate(rotateAngleInDegrees);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ConversionPreset.IsRelevantSetting(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2))
|
||||
{
|
||||
bool clampSizeToPowerOf2 = this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2);
|
||||
if (clampSizeToPowerOf2)
|
||||
{
|
||||
int referenceSize = System.Math.Min(image.Width, image.Height);
|
||||
int size = 2;
|
||||
while (size * 2 <= referenceSize)
|
||||
{
|
||||
size *= 2;
|
||||
}
|
||||
|
||||
Debug.Log("Clamp size to the nearest power of 2 size (from {0}x{1} to {2}x{2}).", image.Width, image.Height, size);
|
||||
|
||||
image.Scale(size, size);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ConversionPreset.IsRelevantSetting(ConversionPreset.ConversionSettingKeys.ImageMaximumSize))
|
||||
{
|
||||
int maximumSize = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageMaximumSize);
|
||||
if (maximumSize > 0)
|
||||
{
|
||||
int width = System.Math.Min(image.Width, maximumSize);
|
||||
int height = System.Math.Min(image.Height, maximumSize);
|
||||
|
||||
Debug.Log("Clamp size to maximum size of {2}x{2} (from {0}x{1} to {2}x{3}).", image.Width, image.Height, width, height);
|
||||
|
||||
image.Scale(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("Convert image (output: {0}).", this.OutputFilePath);
|
||||
switch (this.ConversionPreset.OutputType)
|
||||
{
|
||||
case OutputType.Png:
|
||||
// http://stackoverflow.com/questions/27267073/imagemagick-lossless-max-compression-for-png
|
||||
image.Quality = 95;
|
||||
break;
|
||||
|
||||
case OutputType.Jpg:
|
||||
image.Quality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageQuality);
|
||||
break;
|
||||
|
||||
case OutputType.Pdf:
|
||||
Debug.Log("Density: {0}dpi.", BaseDpiForPdfConversion);
|
||||
image.Density = new Density(BaseDpiForPdfConversion);
|
||||
break;
|
||||
|
||||
case OutputType.Webp:
|
||||
image.Quality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageQuality);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.ConversionFailed(string.Format(Properties.Resources.ErrorUnsupportedOutputFormat, this.ConversionPreset.OutputType));
|
||||
image.Progress -= this.Image_Progress;
|
||||
return;
|
||||
}
|
||||
|
||||
image.Write(this.OutputFilePath);
|
||||
image.Progress -= this.Image_Progress;
|
||||
}
|
||||
|
||||
private void Image_Progress(object sender, ProgressEventArgs eventArgs)
|
||||
{
|
||||
if (this.CancelIsRequested)
|
||||
{
|
||||
eventArgs.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
float alreadyCompletedPages = this.CurrentOuputFilePathIndex / (float)this.pageCount;
|
||||
this.Progress = alreadyCompletedPages + ((float)eventArgs.Progress.ToDouble() / (100f * this.pageCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// <copyright file="ConversionJob_Office.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
public abstract class ConversionJob_Office : ConversionJob
|
||||
{
|
||||
protected ConversionJob_Office() : base()
|
||||
{
|
||||
}
|
||||
|
||||
protected ConversionJob_Office(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
}
|
||||
|
||||
public enum ApplicationName
|
||||
{
|
||||
None,
|
||||
|
||||
Word,
|
||||
Excel,
|
||||
PowerPoint
|
||||
}
|
||||
|
||||
protected abstract ApplicationName Application
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (!Helpers.IsMicrosoftOfficeApplicationAvailable(this.Application))
|
||||
{
|
||||
switch (this.Application)
|
||||
{
|
||||
case ApplicationName.Word:
|
||||
this.ConversionFailed(Properties.Resources.ErrorMicrosoftWordIsNotAvailable);
|
||||
return;
|
||||
|
||||
case ApplicationName.PowerPoint:
|
||||
this.ConversionFailed(Properties.Resources.ErrorMicrosoftPowerPointIsNotAvailable);
|
||||
return;
|
||||
|
||||
case ApplicationName.Excel:
|
||||
this.ConversionFailed(Properties.Resources.ErrorMicrosoftExcelIsNotAvailable);
|
||||
return;
|
||||
|
||||
default:
|
||||
this.ConversionFailed(Properties.Resources.ErrorMicrosoftOfficeIsNotAvailable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnConversionFailed()
|
||||
{
|
||||
base.OnConversionFailed();
|
||||
|
||||
this.ReleaseOfficeApplicationInstanceIfNeeded();
|
||||
}
|
||||
|
||||
protected abstract void InitializeOfficeApplicationInstanceIfNecessary();
|
||||
|
||||
protected abstract void ReleaseOfficeApplicationInstanceIfNeeded();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
// <copyright file="ConversionJob_PowerPoint.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using FileConverter.Diagnostics;
|
||||
using Microsoft.Office.Core;
|
||||
|
||||
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
|
||||
|
||||
public class ConversionJob_PowerPoint : ConversionJob_Office
|
||||
{
|
||||
private PowerPoint.Presentation document;
|
||||
private PowerPoint.Application application;
|
||||
|
||||
private string intermediateFilePath = string.Empty;
|
||||
private ConversionJob pdf2ImageConversionJob = null;
|
||||
|
||||
public ConversionJob_PowerPoint() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public ConversionJob_PowerPoint(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ApplicationName Application
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationName.PowerPoint;
|
||||
}
|
||||
}
|
||||
|
||||
protected override int GetOuputFilesCount()
|
||||
{
|
||||
if (this.ConversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!this.TryLoadDocumentIfNecessary())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pagesCount = this.document.Slides.Count;
|
||||
return pagesCount;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.State == ConversionState.Failed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new System.Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
// Initialize converters.
|
||||
if (this.ConversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
this.intermediateFilePath = this.OutputFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate intermediate file path.
|
||||
string fileName = Path.GetFileNameWithoutExtension(this.InputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
this.intermediateFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + ".pdf");
|
||||
|
||||
ConversionPreset intermediatePreset = new ConversionPreset("Pdf to image", this.ConversionPreset, "pdf");
|
||||
this.pdf2ImageConversionJob = ConversionJobFactory.Create(intermediatePreset, this.intermediateFilePath);
|
||||
this.pdf2ImageConversionJob.PrepareConversion(this.OutputFilePaths);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new System.Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateReadDocument;
|
||||
|
||||
if (!this.TryLoadDocumentIfNecessary())
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorUnableToUseMicrosoftOffice);
|
||||
return;
|
||||
}
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateConversion;
|
||||
|
||||
Diagnostics.Debug.Log("Convert PowerPoint document to pdf.");
|
||||
this.document.ExportAsFixedFormat(this.intermediateFilePath, PowerPoint.PpFixedFormatType.ppFixedFormatTypePDF);
|
||||
|
||||
Diagnostics.Debug.Log("Close PowerPoint document '{0}'.", this.InputFilePath);
|
||||
this.document.Close();
|
||||
this.document = null;
|
||||
|
||||
this.ReleaseOfficeApplicationInstanceIfNeeded();
|
||||
|
||||
if (this.pdf2ImageConversionJob != null)
|
||||
{
|
||||
if (!System.IO.File.Exists(this.intermediateFilePath))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorCantFindOutputFiles);
|
||||
return;
|
||||
}
|
||||
|
||||
Task updateProgress = this.UpdateProgress();
|
||||
|
||||
Diagnostics.Debug.Log("Convert pdf to images.");
|
||||
|
||||
this.pdf2ImageConversionJob.StartConvertion();
|
||||
|
||||
if (this.pdf2ImageConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.pdf2ImageConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.intermediateFilePath))
|
||||
{
|
||||
Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
|
||||
|
||||
File.Delete(this.intermediateFilePath);
|
||||
}
|
||||
|
||||
updateProgress.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitializeOfficeApplicationInstanceIfNecessary()
|
||||
{
|
||||
if (this.application != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize PowerPoint application.
|
||||
Diagnostics.Debug.Log("Instantiate PowerPoint application via interop.");
|
||||
this.application = new PowerPoint.Application();
|
||||
}
|
||||
|
||||
protected override void ReleaseOfficeApplicationInstanceIfNeeded()
|
||||
{
|
||||
if (this.application == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log("Quit PowerPoint application via interop.");
|
||||
this.application.Quit();
|
||||
this.application = null;
|
||||
}
|
||||
|
||||
private async Task UpdateProgress()
|
||||
{
|
||||
while (this.pdf2ImageConversionJob.State != ConversionState.Done &&
|
||||
this.pdf2ImageConversionJob.State != ConversionState.Failed)
|
||||
{
|
||||
if (this.pdf2ImageConversionJob != null && this.pdf2ImageConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pdf2ImageConversionJob.Progress;
|
||||
}
|
||||
|
||||
if (this.pdf2ImageConversionJob != null && this.pdf2ImageConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pdf2ImageConversionJob.Progress;
|
||||
this.UserState = this.pdf2ImageConversionJob.UserState;
|
||||
}
|
||||
|
||||
await Task.Delay(40);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryLoadDocumentIfNecessary()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.InitializeOfficeApplicationInstanceIfNecessary();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.Log(exception.ToString());
|
||||
Debug.Log("Failed to initialize office application.");
|
||||
}
|
||||
|
||||
if (this.application == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.document == null)
|
||||
{
|
||||
Diagnostics.Debug.Log("Load PowerPoint document '{0}'.", this.InputFilePath);
|
||||
|
||||
this.document = this.application.Presentations.Open(this.InputFilePath, ReadOnly: MsoTriState.msoTrue, WithWindow: MsoTriState.msoFalse);
|
||||
}
|
||||
|
||||
return this.document != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
// <copyright file="ConversionJob_Word.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using FileConverter.Diagnostics;
|
||||
|
||||
using Word = Microsoft.Office.Interop.Word;
|
||||
|
||||
public class ConversionJob_Word : ConversionJob_Office
|
||||
{
|
||||
private Word.Document document;
|
||||
private Word.Application application;
|
||||
|
||||
private string intermediateFilePath = string.Empty;
|
||||
private ConversionJob pdf2ImageConversionJob = null;
|
||||
|
||||
public ConversionJob_Word() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public ConversionJob_Word(ConversionPreset conversionPreset, string inputFilePath) : base(conversionPreset, inputFilePath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ApplicationName Application
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationName.Word;
|
||||
}
|
||||
}
|
||||
|
||||
protected override int GetOuputFilesCount()
|
||||
{
|
||||
if (this.ConversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!this.TryLoadDocumentIfNecessary())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pagesCount = this.document.ComputeStatistics(Word.WdStatistic.wdStatisticPages);
|
||||
|
||||
return pagesCount;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (this.State == ConversionState.Failed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new System.Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
// Initialize converters.
|
||||
if (this.ConversionPreset.OutputType == OutputType.Pdf)
|
||||
{
|
||||
this.intermediateFilePath = this.OutputFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate intermediate file path.
|
||||
string fileName = Path.GetFileNameWithoutExtension(this.InputFilePath);
|
||||
string tempPath = Path.GetTempPath();
|
||||
this.intermediateFilePath = PathHelpers.GenerateUniquePath(tempPath + fileName + ".pdf");
|
||||
|
||||
ConversionPreset intermediatePreset = new ConversionPreset("Pdf to image", this.ConversionPreset, "pdf");
|
||||
this.pdf2ImageConversionJob = ConversionJobFactory.Create(intermediatePreset, this.intermediateFilePath);
|
||||
this.pdf2ImageConversionJob.PrepareConversion(this.OutputFilePaths);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
{
|
||||
if (this.ConversionPreset == null)
|
||||
{
|
||||
throw new System.Exception("The conversion preset must be valid.");
|
||||
}
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateReadDocument;
|
||||
|
||||
if (!this.TryLoadDocumentIfNecessary())
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorUnableToUseMicrosoftOffice);
|
||||
return;
|
||||
}
|
||||
|
||||
// Make this document the active document.
|
||||
this.document.Activate();
|
||||
|
||||
this.UserState = Properties.Resources.ConversionStateConversion;
|
||||
|
||||
Diagnostics.Debug.Log("Convert word document to pdf.");
|
||||
this.document.ExportAsFixedFormat(this.intermediateFilePath, Word.WdExportFormat.wdExportFormatPDF);
|
||||
|
||||
Diagnostics.Debug.Log("Close word document '{0}'.", this.InputFilePath);
|
||||
this.document.Close(Word.WdSaveOptions.wdDoNotSaveChanges);
|
||||
this.document = null;
|
||||
|
||||
this.ReleaseOfficeApplicationInstanceIfNeeded();
|
||||
|
||||
if (this.pdf2ImageConversionJob != null)
|
||||
{
|
||||
if (!System.IO.File.Exists(this.intermediateFilePath))
|
||||
{
|
||||
this.ConversionFailed(Properties.Resources.ErrorCantFindOutputFiles);
|
||||
return;
|
||||
}
|
||||
|
||||
Task updateProgress = this.UpdateProgress();
|
||||
|
||||
Diagnostics.Debug.Log("Convert pdf to images.");
|
||||
|
||||
this.pdf2ImageConversionJob.StartConvertion();
|
||||
|
||||
if (this.pdf2ImageConversionJob.State != ConversionState.Done)
|
||||
{
|
||||
this.ConversionFailed(this.pdf2ImageConversionJob.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.intermediateFilePath))
|
||||
{
|
||||
Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath);
|
||||
|
||||
File.Delete(this.intermediateFilePath);
|
||||
}
|
||||
|
||||
updateProgress.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitializeOfficeApplicationInstanceIfNecessary()
|
||||
{
|
||||
if (this.application != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize word application.
|
||||
Diagnostics.Debug.Log("Instantiate word application via interop.");
|
||||
this.application = new Microsoft.Office.Interop.Word.Application
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
}
|
||||
|
||||
protected override void ReleaseOfficeApplicationInstanceIfNeeded()
|
||||
{
|
||||
if (this.application == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Log("Quit word application via interop.");
|
||||
this.application.Quit();
|
||||
this.application = null;
|
||||
}
|
||||
|
||||
private async Task UpdateProgress()
|
||||
{
|
||||
while (this.pdf2ImageConversionJob.State != ConversionState.Done &&
|
||||
this.pdf2ImageConversionJob.State != ConversionState.Failed)
|
||||
{
|
||||
if (this.pdf2ImageConversionJob != null && this.pdf2ImageConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pdf2ImageConversionJob.Progress;
|
||||
}
|
||||
|
||||
if (this.pdf2ImageConversionJob != null && this.pdf2ImageConversionJob.State == ConversionState.InProgress)
|
||||
{
|
||||
this.Progress = this.pdf2ImageConversionJob.Progress;
|
||||
this.UserState = this.pdf2ImageConversionJob.UserState;
|
||||
}
|
||||
|
||||
await Task.Delay(40);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryLoadDocumentIfNecessary()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.InitializeOfficeApplicationInstanceIfNecessary();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.Log(exception.ToString());
|
||||
Debug.Log("Failed to initialize office application.");
|
||||
}
|
||||
|
||||
if (this.application == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.document == null)
|
||||
{
|
||||
Diagnostics.Debug.Log("Load word document '{0}'.", this.InputFilePath);
|
||||
|
||||
this.document = this.application.Documents.Open(this.InputFilePath, System.Reflection.Missing.Value, true);
|
||||
}
|
||||
|
||||
return this.document != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// // <copyright file="VideoEncodingSpeed.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ConversionJobs
|
||||
{
|
||||
public enum VideoEncodingSpeed
|
||||
{
|
||||
UltraFast,
|
||||
SuperFast,
|
||||
VeryFast,
|
||||
Faster,
|
||||
Fast,
|
||||
Medium,
|
||||
Slow,
|
||||
Slower,
|
||||
VerySlow,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,695 @@
|
||||
// <copyright file="ConversionPreset.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
using FileConverter.Controls;
|
||||
using FileConverter.Diagnostics;
|
||||
using FileConverter.ValueConverters;
|
||||
|
||||
[XmlRoot]
|
||||
[XmlType]
|
||||
public class ConversionPreset : INotifyPropertyChanged, IDataErrorInfo, IXmlSerializable
|
||||
{
|
||||
private string name;
|
||||
private OutputType outputType;
|
||||
private List<string> inputTypes;
|
||||
private InputPostConversionAction inputPostConversionAction;
|
||||
private ConversionSettings settings = new ConversionSettings();
|
||||
private string outputFileNameTemplate;
|
||||
|
||||
public ConversionPreset()
|
||||
{
|
||||
this.Name = Properties.Resources.DefaultPresetName;
|
||||
}
|
||||
|
||||
public ConversionPreset(string name, OutputType outputType, params string[] inputTypes)
|
||||
{
|
||||
this.Name = name;
|
||||
this.OutputType = outputType;
|
||||
List<string> inputTypeList = new List<string>();
|
||||
inputTypeList.AddRange(inputTypes);
|
||||
this.InputTypes = inputTypeList;
|
||||
|
||||
this.outputFileNameTemplate = "(p)(f)";
|
||||
}
|
||||
|
||||
public ConversionPreset(string name, ConversionPreset source, params string[] additionalInputTypes)
|
||||
{
|
||||
this.Name = name;
|
||||
this.OutputType = source.outputType;
|
||||
List<string> inputTypeList = new List<string>();
|
||||
if (source.inputTypes != null)
|
||||
{
|
||||
inputTypeList.AddRange(source.inputTypes);
|
||||
}
|
||||
|
||||
if (additionalInputTypes != null)
|
||||
{
|
||||
inputTypeList.AddRange(additionalInputTypes);
|
||||
}
|
||||
|
||||
this.InputTypes = inputTypeList;
|
||||
|
||||
this.outputFileNameTemplate = source.OutputFileNameTemplate;
|
||||
|
||||
foreach (KeyValuePair<string, string> conversionSetting in source.settings)
|
||||
{
|
||||
this.SetSettingsValue(conversionSetting.Key, conversionSetting.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[XmlAttribute]
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public OutputType OutputType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputType;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.outputType = value;
|
||||
this.InitializeDefaultSettings(this.outputType);
|
||||
this.OnPropertyChanged();
|
||||
this.CoerceInputTypes();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public bool IsDefaultSettings
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
[XmlElement]
|
||||
public List<string> InputTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inputTypes;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.inputTypes = value;
|
||||
for (int index = 0; index < this.inputTypes.Count; index++)
|
||||
{
|
||||
this.inputTypes[index] = this.inputTypes[index].ToLowerInvariant();
|
||||
}
|
||||
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public InputPostConversionAction InputPostConversionAction
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inputPostConversionAction;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.inputPostConversionAction = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("Settings")]
|
||||
public ConversionSetting[] XmlSerializableSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
int index = 0;
|
||||
ConversionSetting[] settings = new ConversionSetting[this.settings.Count];
|
||||
foreach (KeyValuePair<string, string> keyValuePair in this.settings)
|
||||
{
|
||||
settings[index] = new ConversionSetting(keyValuePair);
|
||||
index++;
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
for (int index = 0; index < value.Length; index++)
|
||||
{
|
||||
// Compatibility issues.
|
||||
if (value[index].Key == "Bitrate")
|
||||
{
|
||||
this.SetSettingsValue(ConversionSettingKeys.AudioBitrate, value[index].Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value[index].Key == "Encoding")
|
||||
{
|
||||
this.SetSettingsValue(ConversionSettingKeys.AudioEncodingMode, value[index].Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Load settings.
|
||||
this.SetSettingsValue(value[index].Key, value[index].Value);
|
||||
}
|
||||
}
|
||||
|
||||
this.OnPropertyChanged(nameof(this.Settings));
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public string OutputFileNameTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputFileNameTemplate;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.outputFileNameTemplate = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string ConversionArchiveFolderName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Resources.ConversionArchives;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public IConversionSettings Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, string> conversionSetting in value)
|
||||
{
|
||||
if (!this.settings.ContainsKey(conversionSetting.Key))
|
||||
{
|
||||
this.settings.Add(conversionSetting.Key, conversionSetting.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.settings[conversionSetting.Key] = conversionSetting.Value;
|
||||
}
|
||||
}
|
||||
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
{
|
||||
string errorString = this.Validate("Name");
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
return errorString;
|
||||
}
|
||||
|
||||
errorString = this.Validate("OutputFileNameTemplate");
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
return errorString;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Validate(columnName);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
// Remove unrelevant settings.
|
||||
List<string> settingsToRemove = new List<string>();
|
||||
foreach (string settingsKey in this.settings.Keys)
|
||||
{
|
||||
if (!this.IsRelevantSetting(settingsKey))
|
||||
{
|
||||
settingsToRemove.Add(settingsKey);
|
||||
}
|
||||
}
|
||||
|
||||
for (int index = 0; index < settingsToRemove.Count; index++)
|
||||
{
|
||||
this.settings.Remove(settingsToRemove[index]);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDeserializationComplete()
|
||||
{
|
||||
for (int index = 0; index < this.InputTypes.Count; index++)
|
||||
{
|
||||
this.InputTypes[index] = this.InputTypes[index].ToLowerInvariant();
|
||||
}
|
||||
|
||||
this.CoerceInputTypes();
|
||||
}
|
||||
|
||||
public void AddInputType(string inputType)
|
||||
{
|
||||
if (this.inputTypes.Contains(inputType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.inputTypes.Add(inputType);
|
||||
this.OnPropertyChanged(nameof(this.InputTypes));
|
||||
}
|
||||
|
||||
public void RemoveInputType(string inputType)
|
||||
{
|
||||
if (this.inputTypes.Remove(inputType))
|
||||
{
|
||||
this.OnPropertyChanged(nameof(this.InputTypes));
|
||||
}
|
||||
}
|
||||
|
||||
public string GenerateOutputFilePath(string inputFilePath, int numberIndex, int numberMax)
|
||||
{
|
||||
return PathHelpers.GenerateFilePathFromTemplate(inputFilePath, this.OutputType, this.OutputFileNameTemplate, numberIndex, numberMax);
|
||||
}
|
||||
|
||||
public void SetSettingsValue(string settingsKey, string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(settingsKey))
|
||||
{
|
||||
throw new ArgumentNullException("key");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
|
||||
if (!this.IsRelevantSetting(settingsKey))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.settings.ContainsKey(settingsKey))
|
||||
{
|
||||
this.settings.Add(settingsKey, value);
|
||||
}
|
||||
|
||||
this.settings[settingsKey] = value;
|
||||
|
||||
this.OnPropertyChanged(nameof(this.Settings));
|
||||
}
|
||||
|
||||
public string GetSettingsValue(string settingsKey)
|
||||
{
|
||||
if (string.IsNullOrEmpty(settingsKey))
|
||||
{
|
||||
throw new ArgumentNullException("key");
|
||||
}
|
||||
|
||||
if (this.settings.ContainsKey(settingsKey))
|
||||
{
|
||||
return this.settings[settingsKey];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public T GetSettingsValue<T>(string settingsKey)
|
||||
{
|
||||
string settingsValue = this.GetSettingsValue(settingsKey);
|
||||
|
||||
if (settingsValue == null)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
|
||||
Type type = typeof(T);
|
||||
if (type.IsEnum)
|
||||
{
|
||||
return (T)System.Enum.Parse(type, settingsValue);
|
||||
}
|
||||
|
||||
return (T)System.Convert.ChangeType(settingsValue, type, NumberFormatInfo.InvariantInfo);
|
||||
}
|
||||
|
||||
public bool IsRelevantSetting(string settingsKey)
|
||||
{
|
||||
return this.Settings.ContainsKey(settingsKey);
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void CoerceInputTypes()
|
||||
{
|
||||
if (this.inputTypes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int index = 0; index < this.inputTypes.Count; index++)
|
||||
{
|
||||
string inputType = this.inputTypes[index];
|
||||
string inputCategory = Helpers.GetExtensionCategory(inputType);
|
||||
if (!Helpers.IsOutputTypeCompatibleWithCategory(this.OutputType, inputCategory))
|
||||
{
|
||||
this.RemoveInputType(inputType);
|
||||
index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeDefaultSettings(OutputType outputType)
|
||||
{
|
||||
this.settings.Clear();
|
||||
|
||||
switch (outputType)
|
||||
{
|
||||
// Audio
|
||||
case OutputType.Aac:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "128");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioChannelCount, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Flac:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioChannelCount, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Ogg:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "160");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioChannelCount, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Mp3:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioEncodingMode, EncodingMode.Mp3VBR.ToString(), true);
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "190");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioChannelCount, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Wav:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioEncodingMode, EncodingMode.Wav16.ToString(), true);
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioChannelCount, "0");
|
||||
break;
|
||||
|
||||
// Video
|
||||
case OutputType.Avi:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.EnableAudio, "True");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "20");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "190");
|
||||
break;
|
||||
|
||||
case OutputType.Mkv:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.EnableAudio, "True");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "28");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, "Medium");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "128");
|
||||
break;
|
||||
|
||||
case OutputType.Mp4:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.EnableAudio, "True");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "28");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, "Medium");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "128");
|
||||
break;
|
||||
|
||||
case OutputType.Ogv:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.EnableAudio, "True");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "7");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "160");
|
||||
break;
|
||||
|
||||
case OutputType.Webm:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.EnableAudio, "True");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.AudioBitrate, "160");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoQuality, "40");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoRotation, "0");
|
||||
break;
|
||||
|
||||
// Images
|
||||
case OutputType.Gif:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.VideoFramesPerSecond, "15");
|
||||
break;
|
||||
|
||||
case OutputType.Png:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2, "False");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageMaximumSize, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Jpg:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageQuality, "90");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2, "False");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageMaximumSize, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Webp:
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageQuality, "40");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale, "1");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageRotation, "0");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2, "False");
|
||||
this.InitializeSettingsValue(ConversionPreset.ConversionSettingKeys.ImageMaximumSize, "0");
|
||||
break;
|
||||
|
||||
case OutputType.Ico:
|
||||
break;
|
||||
|
||||
// Documents
|
||||
case OutputType.Pdf:
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new System.Exception("Missing default settings for type " + outputType);
|
||||
}
|
||||
|
||||
this.OnPropertyChanged(nameof(this.Settings));
|
||||
}
|
||||
|
||||
private void InitializeSettingsValue(string settingsKey, string value, bool force = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(settingsKey))
|
||||
{
|
||||
throw new ArgumentNullException("key");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
|
||||
if (!this.settings.ContainsKey(settingsKey))
|
||||
{
|
||||
this.settings.Add(settingsKey, value);
|
||||
}
|
||||
else if (force)
|
||||
{
|
||||
this.settings[settingsKey] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string Validate(string propertyName)
|
||||
{
|
||||
// Return error message if there is an error, else return empty or null string.
|
||||
switch (propertyName)
|
||||
{
|
||||
case "Name":
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.Name))
|
||||
{
|
||||
return "The preset name can't be empty.";
|
||||
}
|
||||
|
||||
if (this.Name.Contains(";"))
|
||||
{
|
||||
return "The preset name can't contains the character ';'.";
|
||||
}
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
int? count = application?.Settings?.ConversionPresets?.Count(match => match?.name == this.Name);
|
||||
if (count > 1)
|
||||
{
|
||||
return "The preset name is already used.";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "OutputFileNameTemplate":
|
||||
{
|
||||
string sampleOutputFilePath = this.GenerateOutputFilePath(FileConverter.Properties.Resources.OuputFileNameTemplateSample, 1, 3);
|
||||
if (string.IsNullOrEmpty(sampleOutputFilePath))
|
||||
{
|
||||
return "The output filename template must produce a non empty result.";
|
||||
}
|
||||
|
||||
if (!PathHelpers.IsPathValid(sampleOutputFilePath))
|
||||
{
|
||||
// Diagnostic to feedback purpose.
|
||||
// Drive letter.
|
||||
if (!PathHelpers.IsPathDriveLetterValid(sampleOutputFilePath))
|
||||
{
|
||||
return "The output filename template must define a root (for example c:\\, use (p) to use the input file path).";
|
||||
}
|
||||
|
||||
// File name.
|
||||
string filename = PathHelpers.GetFileName(sampleOutputFilePath);
|
||||
if (filename == null)
|
||||
{
|
||||
return "The output file name must not be empty (use (f) to use the name of the input file).";
|
||||
}
|
||||
|
||||
char[] invalidFileNameChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
for (int index = 0; index < invalidFileNameChars.Length; index++)
|
||||
{
|
||||
if (filename.Contains(invalidFileNameChars[index]))
|
||||
{
|
||||
return "The output file name must not contains the character '" + invalidFileNameChars[index] + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
// Directory names.
|
||||
string path = sampleOutputFilePath.Substring(3, sampleOutputFilePath.Length - 3 - filename.Length);
|
||||
char[] invalidPathChars = System.IO.Path.GetInvalidPathChars();
|
||||
for (int index = 0; index < invalidPathChars.Length; index++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return "The output directory name must not be empty (use (d0), (d1), ... to use the name of the parent directories of the input file).";
|
||||
}
|
||||
|
||||
if (path.Contains(invalidPathChars[index]))
|
||||
{
|
||||
return "The output directory name must not contains the character '" + invalidPathChars[index] + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
string[] directories = path.Split('\\');
|
||||
for (int index = 0; index < directories.Length; ++index)
|
||||
{
|
||||
string directoryName = directories[index];
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
{
|
||||
return "The output directory name must not be empty (use (d0), (d1), ... to use the name of the parent directories of the input file).";
|
||||
}
|
||||
}
|
||||
|
||||
return "The output filename template is invalid";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public struct ConversionSetting
|
||||
{
|
||||
public ConversionSetting(KeyValuePair<string, string> keyValuePair)
|
||||
{
|
||||
this.Key = keyValuePair.Key;
|
||||
this.Value = keyValuePair.Value;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string Key
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string Value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ConversionSettingKeys
|
||||
{
|
||||
public const string AudioEncodingMode = "AudioEncodingMode";
|
||||
public const string AudioBitrate = "AudioBitrate";
|
||||
public const string AudioChannelCount = "AudioChannelCount";
|
||||
public const string ImageQuality = "ImageQuality";
|
||||
public const string ImageScale = "ImageScale";
|
||||
public const string ImageRotation = "ImageRotation";
|
||||
public const string ImageClampSizePowerOf2 = "ImageClampSizePowerOf2";
|
||||
public const string ImageMaximumSize = "ImageMaximumSize";
|
||||
public const string VideoQuality = "VideoQuality";
|
||||
public const string VideoEncodingSpeed = "VideoEncodingSpeed";
|
||||
public const string VideoScale = "VideoScale";
|
||||
public const string VideoRotation = "VideoRotation";
|
||||
public const string VideoFramesPerSecond = "VideoFramesPerSecond";
|
||||
|
||||
public const string EnableAudio = "EnableAudio";
|
||||
public const string EnableVideo = "EnableVideo";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// <copyright file="ConversionSettings.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ConversionSettings : Dictionary<string, string>, IConversionSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// <copyright file="ConversionSettingsOverride.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public struct ConversionSettingsOverride : IConversionSettings
|
||||
{
|
||||
private string key;
|
||||
private string value;
|
||||
|
||||
public ConversionSettingsOverride(string key, string value)
|
||||
{
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> Keys
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return this.key;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> Values
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (key == this.key)
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||
{
|
||||
yield return new KeyValuePair<string, string>(this.key, this.value);
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
return key == this.key;
|
||||
}
|
||||
|
||||
public bool TryGetValue(string key, out string value)
|
||||
{
|
||||
value = null;
|
||||
|
||||
if (key == this.key)
|
||||
{
|
||||
value = this.value;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// <copyright file="IConversionSettings.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IConversionSettings : IReadOnlyDictionary<string, string>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// <copyright file="Diagnostics.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
public static class Diagnostics
|
||||
{
|
||||
private static List<string> logMessages = new List<string>();
|
||||
private static StringBuilder workingStringBuilder = new StringBuilder();
|
||||
|
||||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
|
||||
|
||||
public static string Content
|
||||
{
|
||||
get
|
||||
{
|
||||
workingStringBuilder.Clear();
|
||||
for (int index = 0; index < logMessages.Count; index++)
|
||||
{
|
||||
workingStringBuilder.AppendLine(logMessages[index]);
|
||||
}
|
||||
|
||||
return workingStringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Log(string message, params object[] arguments)
|
||||
{
|
||||
Diagnostics.logMessages.Add(string.Format(message, arguments));
|
||||
|
||||
if (StaticPropertyChanged != null)
|
||||
{
|
||||
StaticPropertyChanged(null, new PropertyChangedEventArgs("Content"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// <copyright file="Debug.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Diagnostics
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
public static class Debug
|
||||
{
|
||||
private static string diagnosticsFolderPath;
|
||||
private static Dictionary<int, DiagnosticsData> diagnosticsDataById = new Dictionary<int, DiagnosticsData>();
|
||||
private static int threadCount = 0;
|
||||
|
||||
static Debug()
|
||||
{
|
||||
string path = PathHelpers.GetUserDataFolderPath();
|
||||
|
||||
// Delete old diagnostics folder (1 day).
|
||||
DateTime expirationDate = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0));
|
||||
string[] diagnosticsDirectories = Directory.GetDirectories(path, "Diagnostics-*");
|
||||
for (int index = 0; index < diagnosticsDirectories.Length; index++)
|
||||
{
|
||||
string directory = diagnosticsDirectories[index];
|
||||
DateTime creationTime = Directory.GetCreationTime(directory);
|
||||
if (creationTime < expirationDate)
|
||||
{
|
||||
Directory.Delete(directory, true);
|
||||
}
|
||||
}
|
||||
|
||||
string diagnosticsFolderName = $"Diagnostics-{DateTime.Now.Hour}h{DateTime.Now.Minute}m{DateTime.Now.Second}s";
|
||||
|
||||
Debug.diagnosticsFolderPath = Path.Combine(path, diagnosticsFolderName);
|
||||
Debug.diagnosticsFolderPath = PathHelpers.GenerateUniquePath(Debug.diagnosticsFolderPath);
|
||||
Directory.CreateDirectory(Debug.diagnosticsFolderPath);
|
||||
}
|
||||
|
||||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
|
||||
|
||||
public static DiagnosticsData[] Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return Debug.diagnosticsDataById.Values.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Log(string message, params object[] arguments)
|
||||
{
|
||||
DiagnosticsData diagnosticsData;
|
||||
|
||||
Thread currentThread = System.Threading.Thread.CurrentThread;
|
||||
int threadId = currentThread.ManagedThreadId;
|
||||
lock (Debug.diagnosticsDataById)
|
||||
{
|
||||
if (!Debug.diagnosticsDataById.TryGetValue(threadId, out diagnosticsData))
|
||||
{
|
||||
string threadName = Debug.threadCount > 0 ? $"{currentThread.Name} ({Debug.threadCount})" : "Application";
|
||||
diagnosticsData = new DiagnosticsData(threadName);
|
||||
diagnosticsData.Initialize(Debug.diagnosticsFolderPath, threadId);
|
||||
Debug.diagnosticsDataById.Add(threadId, diagnosticsData);
|
||||
Debug.threadCount++;
|
||||
|
||||
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs("Data"));
|
||||
}
|
||||
}
|
||||
|
||||
diagnosticsData.Log(message, arguments);
|
||||
}
|
||||
|
||||
public static void LogError(string message, params object[] arguments)
|
||||
{
|
||||
string log = string.Format(message, arguments);
|
||||
|
||||
MessageBox.Show(log, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
Debug.Log("Error: " + message, arguments);
|
||||
}
|
||||
|
||||
public static void Release()
|
||||
{
|
||||
Debug.Log("Diagnostics manager released correctly.");
|
||||
|
||||
foreach (KeyValuePair<int, DiagnosticsData> kvp in Debug.diagnosticsDataById)
|
||||
{
|
||||
kvp.Value.Release();
|
||||
}
|
||||
|
||||
Debug.diagnosticsDataById.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// <copyright file="DiagnosticsData.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Diagnostics
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
|
||||
public class DiagnosticsData : INotifyPropertyChanged
|
||||
{
|
||||
private List<string> logMessages = new List<string>();
|
||||
private StringBuilder stringBuilder = new StringBuilder();
|
||||
private System.IO.TextWriter logFileWriter;
|
||||
private string name;
|
||||
|
||||
public DiagnosticsData(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
this.LogMessages = new ReadOnlyCollection<string>(this.logMessages);
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.name = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Content
|
||||
{
|
||||
get
|
||||
{
|
||||
this.stringBuilder.Clear();
|
||||
for (int index = 0; index < this.LogMessages.Count; index++)
|
||||
{
|
||||
this.stringBuilder.AppendLine(this.LogMessages[index]);
|
||||
}
|
||||
|
||||
return this.stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<string> LogMessages
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public void Initialize(string diagnosticsFolderPath, int id)
|
||||
{
|
||||
string path = Path.Combine(diagnosticsFolderPath, string.Format("Diagnostics{0}.log", id));
|
||||
path = PathHelpers.GenerateUniquePath(path);
|
||||
this.logFileWriter = new StreamWriter(File.Open(path, FileMode.Create));
|
||||
|
||||
this.Log("{0} {1}\n", System.DateTime.Now.ToLongDateString(), System.DateTime.Now.ToLongTimeString());
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
this.logFileWriter.Close();
|
||||
this.logFileWriter = null;
|
||||
}
|
||||
|
||||
public void Log(string message, params object[] arguments)
|
||||
{
|
||||
string log = arguments.Length > 0 ? string.Format(message, arguments) : message;
|
||||
|
||||
this.logMessages.Add(log);
|
||||
this.logFileWriter.WriteLine(log);
|
||||
this.logFileWriter.Flush();
|
||||
|
||||
this.OnPropertyChanged("Content");
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -36,24 +36,69 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\ApplicationIcon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;BUILD32</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;BUILD32</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Accessibility" />
|
||||
<Reference Include="Magick.NET-Q16-AnyCPU, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET-Q16-AnyCPU.7.0.5.502\lib\net40-client\Magick.NET-Q16-AnyCPU.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Markdown.Xaml">
|
||||
<HintPath>..\..\Middleware\Markdown.Xaml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.PowerPoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
|
||||
<HintPath>..\..\packages\Microsoft.Office.Interop.PowerPoint.12.0.4518.1014\lib\net20\Microsoft.Office.Interop.PowerPoint.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Office.Interop.Word.15.0.4797.1003\lib\net20\Microsoft.Office.Interop.Word.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
|
||||
<HintPath>..\..\packages\Office.12.0.0\lib\net40\Office.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="PresentationUI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="Ripper, Version=1.0.5806.33932, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Middleware\Ripper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@@ -62,14 +107,117 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WpfAnimatedGif, Version=1.4.14.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\WpfAnimatedGif.1.4.14\lib\net\WpfAnimatedGif.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="yeti.mmedia">
|
||||
<HintPath>..\..\Middleware\yeti.mmedia.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Application.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="ApplicationTerminateArgs.cs" />
|
||||
<Compile Include="Commands\DelegateCommand.cs" />
|
||||
<Compile Include="Commands\OpenUrlCommand.cs" />
|
||||
<Compile Include="Controls\EncodingQualitySliderControl.xaml.cs">
|
||||
<DependentUpon>EncodingQualitySliderControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Commands\CancelConversionJobCommand.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionFlags.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_Office.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_PowerPoint.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_ExtractCDA.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJobFactory.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_FFMPEG.Converters.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_FFMPEG.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_Gif.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_Ico.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_Excel.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_Word.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob_ImageMagick.cs" />
|
||||
<Compile Include="ConversionJobs\VideoEncodingSpeed.cs" />
|
||||
<Compile Include="ConversionPreset\ConversionSettingsOverride.cs" />
|
||||
<Compile Include="ConversionPreset\ConversionSettings.cs" />
|
||||
<Compile Include="Diagnostics\DiagnosticsData.cs" />
|
||||
<Compile Include="Controls\EncodingMode.cs" />
|
||||
<Compile Include="ConversionPreset\IConversionSettings.cs" />
|
||||
<Compile Include="Helpers.cs" />
|
||||
<Compile Include="InputPostConversionAction.cs" />
|
||||
<Compile Include="IXmlSerializable.cs" />
|
||||
<Compile Include="PathHelpers.cs" />
|
||||
<Compile Include="Properties\Resources.fr.Designer.cs">
|
||||
<DependentUpon>Resources.fr.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.en.Designer.cs">
|
||||
<DependentUpon>Resources.en.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
<Compile Include="Registry.cs" />
|
||||
<Compile Include="Settings.Migration.cs" />
|
||||
<Compile Include="Settings.Settings.cs" />
|
||||
<Compile Include="Upgrade\Helpers.cs" />
|
||||
<Compile Include="Upgrade\UpgradeVersionDescription.cs" />
|
||||
<Compile Include="ValueConverters\ApplicationVersionToApplicationName.cs" />
|
||||
<Compile Include="ConversionPreset\ConversionPreset.cs" />
|
||||
<Compile Include="ValueConverters\OutputTypeEnumToViewModel.cs" />
|
||||
<Compile Include="ValueConverters\BitrateToString.cs" />
|
||||
<Compile Include="ValueConverters\FileNameConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\ObjectToLocalizedString.cs" />
|
||||
<Compile Include="ValueConverters\Generic\CultureInfoToStringConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\BoolToVisibility.cs" />
|
||||
<Compile Include="ValueConverters\ConversionSettingsToString.cs" />
|
||||
<Compile Include="ValueConverters\Generic\BoolInverterConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\DoubleToTimeString.cs" />
|
||||
<Compile Include="ValueConverters\Generic\EqualsConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\CollectionContainsElementToBool.cs" />
|
||||
<Compile Include="ValueConverters\Generic\FormatStringConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\ValueToString.cs" />
|
||||
<Compile Include="ValueConverters\Generic\StringToValueType.cs" />
|
||||
<Compile Include="ValueConverters\InputTypesToBool.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="ValueConverters\OutputTypeToVisibility.cs" />
|
||||
<Compile Include="ValueConverters\Generic\StringToEnum.cs" />
|
||||
<Compile Include="ValueConverters\Generic\ValueConverterGroup.cs" />
|
||||
<Compile Include="Windows\ApplicationStartHelp.xaml.cs">
|
||||
<DependentUpon>ApplicationStartHelp.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\DiagnosticsWindow.xaml.cs">
|
||||
<DependentUpon>DiagnosticsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ConversionSettingsTemplateSelector.cs" />
|
||||
<Compile Include="Windows\InputExtension.cs" />
|
||||
<Compile Include="Windows\InputExtensionCategory.cs" />
|
||||
<Compile Include="Windows\OutputTypeViewModel.cs" />
|
||||
<Compile Include="Windows\SettingsWindow.xaml.cs">
|
||||
<DependentUpon>SettingsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Version.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Compile Include="Windows\UpgradeWindow.xaml.cs">
|
||||
<DependentUpon>UpgradeWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="XmlHelpers.cs" />
|
||||
<Page Include="Controls\EncodingQualitySliderControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\ApplicationStartHelp.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\DiagnosticsWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -77,19 +225,30 @@
|
||||
<DependentUpon>Application.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ConversionStateToBrush.cs" />
|
||||
<Compile Include="ConversionJob.cs" />
|
||||
<Compile Include="Diagnostics.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<Compile Include="ValueConverters\ConversionStateToBrush.cs" />
|
||||
<Compile Include="ConversionJobs\ConversionJob.cs" />
|
||||
<Compile Include="Diagnostics\Debug.cs" />
|
||||
<Compile Include="Windows\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Windows\SettingsWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\UpgradeWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="OutputType.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Properties\Annotations.cs">
|
||||
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -101,10 +260,23 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<EmbeddedResource Include="Properties\Resources.fr.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.fr.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.en.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.en.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.pt.resx" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@@ -112,10 +284,59 @@
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ApplicationIcon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ApplicationIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\DownloadIcon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\CancelIcon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\SuccessIcon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\FailIcon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\GitHub-Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\GitHub-Issue-Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\GitHub-Documentation-Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Pledge-icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\FileConverterUsage.gif" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Settings-Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\WebSite-Icon.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy /Y "$(SolutionDir)Middleware\ffmpeg\$(PlatformName)\ffmpeg.exe" "$(TargetDir)ffmpeg.exe"
|
||||
copy /Y "$(SolutionDir)Middleware\gs\x86\gsdll32.dll" "$(TargetDir)gsdll32.dll"
|
||||
copy /Y "$(SolutionDir)Middleware\gs\x86\gswin32c.exe" "$(TargetDir)gswin32c.exe"
|
||||
copy /Y "$(ProjectDir)Settings.default.xml" "$(TargetDir)Settings.default.xml"
|
||||
robocopy $(TargetDir) $(TargetDir)\Languages "$(TargetName).resources.dll" /CREATE /S /XD Languages /IS /IT /NFL /NDL /NJH /NJS /NC /NS /NP
|
||||
if %25errorlevel%25 leq 1 exit 0 else exit %25errorlevel%25
|
||||
robocopy $(TargetDir) $(TargetDir)\Languages "$(TargetName).resources.dll" /MOVE /S /XD Languages /XL /IS /IT /NFL /NDL /NJH /NJS /NC /NS /NP
|
||||
if %25errorlevel%25 leq 1 exit 0 else exit %25errorlevel%25</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- 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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=FileConverter_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StyleCop_002ESA1600/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StyleCop_002ESA1601/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StyleCop_002ESA1602/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ABSTRACT_ACCESSORHOLDER_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -0,0 +1,262 @@
|
||||
// // <copyright file="Helpers.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
using FileConverter.ConversionJobs;
|
||||
using Microsoft.Win32;
|
||||
|
||||
public static class Helpers
|
||||
{
|
||||
public static IEnumerable<CultureInfo> GetSupportedCultures()
|
||||
{
|
||||
// Get all cultures.
|
||||
CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
|
||||
|
||||
// Find the location where application installed.
|
||||
string exeLocation = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
|
||||
|
||||
// Return all culture for which satellite folder found with culture code.
|
||||
foreach (CultureInfo cultureInfo in cultures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cultureInfo.Name) && Directory.Exists(Path.Combine(exeLocation, "Languages", cultureInfo.Name)))
|
||||
{
|
||||
yield return cultureInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetExtensionCategory(string extension)
|
||||
{
|
||||
switch (extension)
|
||||
{
|
||||
case "aac":
|
||||
case "aiff":
|
||||
case "ape":
|
||||
case "cda":
|
||||
case "flac":
|
||||
case "mp3":
|
||||
case "m4a":
|
||||
case "oga":
|
||||
case "ogg":
|
||||
case "wav":
|
||||
case "wma":
|
||||
return InputCategoryNames.Audio;
|
||||
|
||||
case "3gp":
|
||||
case "avi":
|
||||
case "bik":
|
||||
case "flv":
|
||||
case "m4v":
|
||||
case "mp4":
|
||||
case "mpeg":
|
||||
case "mov":
|
||||
case "mkv":
|
||||
case "ogv":
|
||||
case "vob":
|
||||
case "webm":
|
||||
case "wmv":
|
||||
return InputCategoryNames.Video;
|
||||
|
||||
case "bmp":
|
||||
case "exr":
|
||||
case "ico":
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
case "png":
|
||||
case "psd":
|
||||
case "tga":
|
||||
case "tiff":
|
||||
case "svg":
|
||||
case "xcf":
|
||||
case "webp":
|
||||
return InputCategoryNames.Image;
|
||||
|
||||
case "gif":
|
||||
return InputCategoryNames.AnimatedImage;
|
||||
|
||||
case "pdf":
|
||||
case "doc":
|
||||
case "docx":
|
||||
case "ppt":
|
||||
case "pptx":
|
||||
case "odp":
|
||||
case "ods":
|
||||
case "odt":
|
||||
case "xls":
|
||||
case "xlsx":
|
||||
return InputCategoryNames.Document;
|
||||
}
|
||||
|
||||
return InputCategoryNames.Misc;
|
||||
}
|
||||
|
||||
public static bool IsOutputTypeCompatibleWithCategory(OutputType outputType, string category)
|
||||
{
|
||||
if (category == InputCategoryNames.Misc)
|
||||
{
|
||||
// Misc category contains unsorted input extensions, so we consider that they are compatible to be tolerant.
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (outputType)
|
||||
{
|
||||
case OutputType.Aac:
|
||||
case OutputType.Flac:
|
||||
case OutputType.Mp3:
|
||||
case OutputType.Ogg:
|
||||
case OutputType.Wav:
|
||||
return category == InputCategoryNames.Audio || category == InputCategoryNames.Video;
|
||||
|
||||
case OutputType.Avi:
|
||||
case OutputType.Mkv:
|
||||
case OutputType.Mp4:
|
||||
case OutputType.Ogv:
|
||||
case OutputType.Webm:
|
||||
return category == InputCategoryNames.Video || category == InputCategoryNames.AnimatedImage;
|
||||
|
||||
case OutputType.Ico:
|
||||
case OutputType.Jpg:
|
||||
case OutputType.Png:
|
||||
case OutputType.Webp:
|
||||
return category == InputCategoryNames.Image || category == InputCategoryNames.Document;
|
||||
|
||||
case OutputType.Gif:
|
||||
return category == InputCategoryNames.Image || category == InputCategoryNames.Video || category == InputCategoryNames.AnimatedImage;
|
||||
|
||||
case OutputType.Pdf:
|
||||
return category == InputCategoryNames.Image || category == InputCategoryNames.Document;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Thread InstantiateThread(string name, ThreadStart threadStart)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
CultureInfo currentCulture = application?.Settings?.ApplicationLanguage;
|
||||
|
||||
Thread thread = new Thread(threadStart);
|
||||
thread.Name = name;
|
||||
|
||||
if (currentCulture != null)
|
||||
{
|
||||
thread.CurrentCulture = currentCulture;
|
||||
thread.CurrentUICulture = currentCulture;
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
public static Thread InstantiateThread(string name, ParameterizedThreadStart parameterizedThreadStart)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
CultureInfo currentCulture = application?.Settings?.ApplicationLanguage;
|
||||
|
||||
Thread thread = new Thread(parameterizedThreadStart);
|
||||
thread.Name = name;
|
||||
|
||||
if (currentCulture != null)
|
||||
{
|
||||
thread.CurrentCulture = currentCulture;
|
||||
thread.CurrentUICulture = currentCulture;
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether Microsoft office is available or not.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if Office is installed on the computer.</returns>
|
||||
/// source: http://stackoverflow.com/questions/3266675/how-to-detect-installed-version-of-ms-office/3267832#3267832
|
||||
/// source: http://www.codeproject.com/Articles/26520/Getting-Office-s-Version
|
||||
public static bool IsMicrosoftOfficeApplicationAvailable(ConversionJobs.ConversionJob_Office.ApplicationName application)
|
||||
{
|
||||
string registryKeyPattern = @"Software\Microsoft\Windows\CurrentVersion\App Paths\";
|
||||
switch (application)
|
||||
{
|
||||
case ConversionJob_Office.ApplicationName.Word:
|
||||
registryKeyPattern += "winword.exe";
|
||||
break;
|
||||
|
||||
case ConversionJob_Office.ApplicationName.PowerPoint:
|
||||
registryKeyPattern += "powerpnt.exe";
|
||||
break;
|
||||
|
||||
case ConversionJob_Office.ApplicationName.Excel:
|
||||
registryKeyPattern += "excel.exe";
|
||||
break;
|
||||
|
||||
case ConversionJob_Office.ApplicationName.None:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Looks inside CURRENT_USER.
|
||||
RegistryKey winwordKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(registryKeyPattern, false);
|
||||
if (winwordKey != null)
|
||||
{
|
||||
string winwordPath = winwordKey.GetValue(string.Empty).ToString();
|
||||
if (!string.IsNullOrEmpty(winwordPath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// If not found, looks inside LOCAL_MACHINE.
|
||||
winwordKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(registryKeyPattern, false);
|
||||
if (winwordKey != null)
|
||||
{
|
||||
string winwordPath = winwordKey.GetValue(string.Empty).ToString();
|
||||
if (!string.IsNullOrEmpty(winwordPath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ConversionJob_Office.ApplicationName GetOfficeApplicationCompatibleWithExtension(string extension)
|
||||
{
|
||||
switch (extension)
|
||||
{
|
||||
case "doc":
|
||||
case "docx":
|
||||
case "odt":
|
||||
return ConversionJob_Office.ApplicationName.Word;
|
||||
|
||||
case "ppt":
|
||||
case "pptx":
|
||||
case "odp":
|
||||
return ConversionJob_Office.ApplicationName.PowerPoint;
|
||||
|
||||
case "ods":
|
||||
case "xls":
|
||||
case "xlsx":
|
||||
return ConversionJob_Office.ApplicationName.Excel;
|
||||
}
|
||||
|
||||
return ConversionJob_Office.ApplicationName.None;
|
||||
}
|
||||
|
||||
public static class InputCategoryNames
|
||||
{
|
||||
public const string Audio = "Audio";
|
||||
public const string Video = "Video";
|
||||
public const string Image = "Image";
|
||||
public const string AnimatedImage = "Animated Image";
|
||||
public const string Document = "Document";
|
||||
|
||||
public const string Misc = "Misc";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// <copyright file="IXmlSerializable.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
public interface IXmlSerializable
|
||||
{
|
||||
void OnDeserializationComplete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// <copyright file="InputPostConversionAction.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
public enum InputPostConversionAction
|
||||
{
|
||||
None,
|
||||
MoveInArchiveFolder,
|
||||
Delete,
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="FileConverter.MainWindow"
|
||||
xmlns:local="clr-namespace:FileConverter"
|
||||
x:Name="FileConverterMainWindow" Title="{Binding ApplicationName, ElementName=FileConverterMainWindow, Mode=OneWay}" Height="500" Width="950" MinHeight="250" MinWidth="450" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<local:ConversionStateToBrush x:Key="ConversionStateToColor" />
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="2*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Name="Title" Grid.Column="0" Content="Files to convert" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold"/>
|
||||
<Button Name="SettingsButton" Grid.Column="1" Content="Settings" Margin="0,3" Visibility="Hidden"></Button>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer x:Name="ScrollViewer" Grid.Row="1" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<ItemsControl Name="ConverterJobsList">
|
||||
<ItemsControl.DataContext>
|
||||
<local:ConversionJob/>
|
||||
</ItemsControl.DataContext>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel Background="{Binding State, Converter={StaticResource ConversionStateToColor}, ConverterParameter='Background'}" Margin="0,4">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2.5*" MinWidth="300" />
|
||||
<ColumnDefinition Width="*" MinWidth="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding OutputFilePath}" FontWeight="Bold" />
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Margin="10,0,0,0">
|
||||
<WrapPanel>
|
||||
<TextBlock Text="Converted from " FontSize="11" FontStyle="Italic" />
|
||||
<TextBlock Text="{Binding InputFilePath}" FontSize="11" FontStyle="Italic" />
|
||||
</WrapPanel>
|
||||
<TextBlock Text="{Binding ExitingMessage}" Foreground="{Binding State, Converter={StaticResource ConversionStateToColor}, ConverterParameter='Foreground'}" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding State}" FontWeight="Bold" Foreground="{Binding State, Converter={StaticResource ConversionStateToColor}, ConverterParameter='Foreground'}" />
|
||||
|
||||
<ProgressBar Grid.Row="1" Grid.Column="1" Height="18" Width="Auto" Minimum="0" Maximum="1" SmallChange="0.001" Value="{Binding Progress, Mode=OneWay}" Foreground="{Binding State, Converter={StaticResource ConversionStateToColor}, ConverterParameter='Foreground'}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" MinWidth="100" LargeChange="0.1" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<Grid Grid.Row="2" Visibility="{Binding VerboseMode, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=FileConverterMainWindow, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="Log" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold" />
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<TextBlock Name="Diagnostics" TextWrapping="NoWrap" Text="{Binding Path=(local:Diagnostics.Content), Mode=OneWay}" FontFamily="Consolas" Foreground="#FF272727"/>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,69 +0,0 @@
|
||||
// <copyright file="MainWindow.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
|
||||
public partial class MainWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
private bool verboseMode;
|
||||
|
||||
private string applicationName;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.ApplicationName = string.Format("File Converter v{0}", Application.Version.ToString());
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
|
||||
this.ConverterJobsList.ItemsSource = application.ConvertionJobs;
|
||||
this.VerboseMode = application.Verbose;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string ApplicationName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.applicationName;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.applicationName = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool VerboseMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.verboseMode;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.verboseMode = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,22 @@ namespace FileConverter
|
||||
public enum OutputType
|
||||
{
|
||||
None,
|
||||
Mp3,
|
||||
Ogg,
|
||||
|
||||
Aac,
|
||||
Avi,
|
||||
Flac,
|
||||
Gif,
|
||||
Ico,
|
||||
Jpg,
|
||||
Mkv,
|
||||
Mp3,
|
||||
Mp4,
|
||||
Ogg,
|
||||
Ogv,
|
||||
Pdf,
|
||||
Png,
|
||||
Wav,
|
||||
Webm,
|
||||
Webp,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
// <copyright file="PathHelpers.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using FileConverter.Diagnostics;
|
||||
|
||||
public static class PathHelpers
|
||||
{
|
||||
private static Regex driveLetterRegex = new Regex(@"[a-zA-Z]:\\");
|
||||
private static Regex cdaTrackNumberRegex = new Regex(@"[a-zA-Z]:\\Track([0-9]+)\.cda");
|
||||
private static Regex pathRegex = new Regex(@"^(?:\\\\[^\\/:*?""<>|\r\n]+\\|[a-zA-Z]:\\)(?:[^\\/:*?""<>|\r\n]+\\)*[^\.\\/:*?""<>|\r\n][^\\/:*?""<>|\r\n]*$");
|
||||
private static Regex filenameRegex = new Regex(@"[^\\]*", RegexOptions.RightToLeft);
|
||||
private static Regex directoryRegex = new Regex(@"^(?<drive>\\\\[^\\/:*?""""<>|\r\n]+\\|[A-Za-z]:\\)(?:(?<folders>[^\\]*)\\)*");
|
||||
|
||||
public static bool IsPathDriveLetterValid(string path)
|
||||
{
|
||||
return PathHelpers.driveLetterRegex.IsMatch(path);
|
||||
}
|
||||
|
||||
public static string GetPathDriveLetter(string path)
|
||||
{
|
||||
return PathHelpers.driveLetterRegex.Match(path).Groups[0].Value;
|
||||
}
|
||||
|
||||
public static bool IsOnCDDrive(string path)
|
||||
{
|
||||
string pathDriveLetter = GetPathDriveLetter(path);
|
||||
if (string.IsNullOrEmpty(pathDriveLetter))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char driveLetter = pathDriveLetter[0];
|
||||
|
||||
char[] driveLetters = Ripper.CDDrive.GetCDDriveLetters();
|
||||
for (int index = 0; index < driveLetters.Length; index++)
|
||||
{
|
||||
if (driveLetters[index] == driveLetter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int GetCDATrackNumber(string path)
|
||||
{
|
||||
Match match = PathHelpers.cdaTrackNumberRegex.Match(path);
|
||||
string stringNumber = match.Groups[1].Value;
|
||||
return int.Parse(stringNumber);
|
||||
}
|
||||
|
||||
public static bool IsPathValid(string path)
|
||||
{
|
||||
return PathHelpers.pathRegex.IsMatch(path);
|
||||
}
|
||||
|
||||
public static string GetFileName(string path)
|
||||
{
|
||||
MatchCollection matchCollection = PathHelpers.filenameRegex.Matches(path);
|
||||
Match filenameMatch = matchCollection.Count > 0 ? matchCollection[0] : null;
|
||||
return filenameMatch?.Groups[0].Value;
|
||||
}
|
||||
|
||||
public static string GetDrive(string path)
|
||||
{
|
||||
MatchCollection matchCollection = PathHelpers.directoryRegex.Matches(path);
|
||||
Match match = matchCollection.Count > 0 ? matchCollection[0] : null;
|
||||
|
||||
Group matchGroup = match?.Groups["drive"];
|
||||
return matchGroup?.Captures[0].Value;
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetDirectories(string path)
|
||||
{
|
||||
MatchCollection matchCollection = PathHelpers.directoryRegex.Matches(path);
|
||||
Match match = matchCollection.Count > 0 ? matchCollection[0] : null;
|
||||
|
||||
Group matchGroup = match?.Groups["folders"];
|
||||
if (matchGroup == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
for (int index = 0; index < matchGroup.Captures.Count; index++)
|
||||
{
|
||||
yield return matchGroup.Captures[index].Value;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GenerateUniquePath(string path, params string[] blacklist)
|
||||
{
|
||||
string baseExtension = System.IO.Path.GetExtension(path);
|
||||
string basePath = path.Substring(0, path.Length - baseExtension.Length);
|
||||
int index = 2;
|
||||
while (System.IO.File.Exists(path) ||
|
||||
(blacklist != null && System.Array.Exists(blacklist, match => match == path)))
|
||||
{
|
||||
path = $"{basePath} ({index}){baseExtension}";
|
||||
index++;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public static bool CreateFolders(string filePath)
|
||||
{
|
||||
// Create output folders that doesn't already exist.
|
||||
StringBuilder path = new StringBuilder(filePath.Length);
|
||||
string drive = PathHelpers.GetDrive(filePath);
|
||||
path.Append(drive);
|
||||
|
||||
foreach (string directory in PathHelpers.GetDirectories(filePath))
|
||||
{
|
||||
path.Append(directory);
|
||||
path.Append('\\');
|
||||
|
||||
if (!System.IO.Directory.Exists(path.ToString()))
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(path.ToString());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.Log(string.Format("Can't create directories for path {0}", filePath));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string GetUserDataFolderPath()
|
||||
{
|
||||
string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData);
|
||||
path = System.IO.Path.Combine(path, "FileConverter");
|
||||
|
||||
if (!System.IO.Directory.Exists(path))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string GenerateFilePathFromTemplate(string inputFilePath, OutputType outputFileExtension, string outputFilePathTemplate, int numberIndex, int numberMax)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputFilePath))
|
||||
{
|
||||
return "Invalid input file path (argument 0).";
|
||||
}
|
||||
|
||||
string inputExtension = System.IO.Path.GetExtension(inputFilePath).Substring(1);
|
||||
string inputPathWithoutExtension = inputFilePath.Substring(0, inputFilePath.Length - inputExtension.Length - 1);
|
||||
string outputExtension = outputFileExtension.ToString().ToLowerInvariant();
|
||||
|
||||
if (string.IsNullOrEmpty(outputFilePathTemplate))
|
||||
{
|
||||
// Default output path.
|
||||
return inputPathWithoutExtension + "." + outputExtension;
|
||||
}
|
||||
|
||||
string fileName = System.IO.Path.GetFileName(inputPathWithoutExtension);
|
||||
string parentDirectory = System.IO.Path.GetDirectoryName(inputPathWithoutExtension);
|
||||
if (!parentDirectory.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
|
||||
{
|
||||
parentDirectory += System.IO.Path.DirectorySeparatorChar;
|
||||
}
|
||||
|
||||
string[] directories = parentDirectory.Substring(0, parentDirectory.Length - 1).Split(System.IO.Path.DirectorySeparatorChar);
|
||||
|
||||
// Generate output path from template.
|
||||
string outputPath = outputFilePathTemplate;
|
||||
|
||||
outputPath = outputPath.Replace("(path)", parentDirectory);
|
||||
outputPath = outputPath.Replace("(p)", parentDirectory);
|
||||
|
||||
outputPath = outputPath.Replace("(filename)", fileName);
|
||||
outputPath = outputPath.Replace("(f)", fileName);
|
||||
outputPath = outputPath.Replace("(F)", fileName.ToUpperInvariant());
|
||||
|
||||
outputPath = outputPath.Replace("(outputext)", outputExtension);
|
||||
outputPath = outputPath.Replace("(o)", outputExtension);
|
||||
outputPath = outputPath.Replace("(O)", outputExtension.ToUpperInvariant());
|
||||
|
||||
outputPath = outputPath.Replace("(inputext)", inputExtension);
|
||||
outputPath = outputPath.Replace("(i)", inputExtension);
|
||||
outputPath = outputPath.Replace("(I)", inputExtension.ToUpperInvariant());
|
||||
|
||||
string myDocumentsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\\";
|
||||
outputPath = outputPath.Replace("(p:d)", myDocumentsFolder);
|
||||
outputPath = outputPath.Replace("(p:documents)", myDocumentsFolder);
|
||||
|
||||
string myMusicFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyMusic) + "\\";
|
||||
outputPath = outputPath.Replace("(p:m)", myMusicFolder);
|
||||
outputPath = outputPath.Replace("(p:music)", myMusicFolder);
|
||||
|
||||
string myVideoFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos) + "\\";
|
||||
outputPath = outputPath.Replace("(p:v)", myVideoFolder);
|
||||
outputPath = outputPath.Replace("(p:videos)", myVideoFolder);
|
||||
|
||||
string myPictureFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) + "\\";
|
||||
outputPath = outputPath.Replace("(p:p)", myPictureFolder);
|
||||
outputPath = outputPath.Replace("(p:pictures)", myPictureFolder);
|
||||
|
||||
for (int index = 0; index < directories.Length; index++)
|
||||
{
|
||||
outputPath = outputPath.Replace(string.Format("(d{0})", directories.Length - index - 1), directories[index]);
|
||||
outputPath = outputPath.Replace(string.Format("(D{0})", directories.Length - index - 1), directories[index].ToUpperInvariant());
|
||||
}
|
||||
|
||||
outputPath = outputPath.Replace("(n:i)", numberIndex.ToString());
|
||||
outputPath = outputPath.Replace("(n:c)", numberMax.ToString());
|
||||
|
||||
outputPath += "." + outputExtension;
|
||||
|
||||
return outputPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ using System.Windows;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("FileConverter")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@@ -0,0 +1,547 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="About" xml:space="preserve">
|
||||
<value>About</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedDescription" xml:space="preserve">
|
||||
<value>Allow you to chose what you want to do with your input files if the conversion succeed</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedTitle" xml:space="preserve">
|
||||
<value>Action when conversion succeed</value>
|
||||
</data>
|
||||
<data name="AddNewPreset" xml:space="preserve">
|
||||
<value>Add new preset (duplicate selected preset)</value>
|
||||
</data>
|
||||
<data name="Application" xml:space="preserve">
|
||||
<value>Application</value>
|
||||
</data>
|
||||
<data name="AudioTitle" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="AutomaticallyCheckForUpdates" xml:space="preserve">
|
||||
<value>Automatically check for updates when File Converter starts</value>
|
||||
</data>
|
||||
<data name="AutomaticallyExitWhenAllConversionsFinished" xml:space="preserve">
|
||||
<value>Automatically exit when all conversions finished</value>
|
||||
</data>
|
||||
<data name="ClampToLowestPowerOfTwoSize" xml:space="preserve">
|
||||
<value>Clamp to lowest power of 2 size</value>
|
||||
</data>
|
||||
<data name="Close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="ConversionPresets" xml:space="preserve">
|
||||
<value>Conversion Presets</value>
|
||||
</data>
|
||||
<data name="ConversionQueueTitle" xml:space="preserve">
|
||||
<value>Files to convert</value>
|
||||
</data>
|
||||
<data name="ConvertedFrom" xml:space="preserve">
|
||||
<value>Converted from</value>
|
||||
</data>
|
||||
<data name="Diagnostics" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="DiagnosticsButtonTitle" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="DocumentationButtonDescription" xml:space="preserve">
|
||||
<value>Open documentation</value>
|
||||
</data>
|
||||
<data name="DonateButtonTitle" xml:space="preserve">
|
||||
<value>Donate</value>
|
||||
</data>
|
||||
<data name="DonateDescription" xml:space="preserve">
|
||||
<value>Don't forget to reward my work if you like it :)</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonDescription" xml:space="preserve">
|
||||
<value>The update will be downloaded in background, and installed once you exit File Converter.</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonTitle" xml:space="preserve">
|
||||
<value>Install when I exit File Converter</value>
|
||||
</data>
|
||||
<data name="Encoding" xml:space="preserve">
|
||||
<value>Encoding :</value>
|
||||
</data>
|
||||
<data name="EncodingSpeed" xml:space="preserve">
|
||||
<value>Encoding speed :</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp1" xml:space="preserve">
|
||||
<value>File Converter is a shell extension.</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp2" xml:space="preserve">
|
||||
<value>That means it is integrated into the Windows explorer.</value>
|
||||
</data>
|
||||
<data name="FileNameTemplate" xml:space="preserve">
|
||||
<value>File name template</value>
|
||||
</data>
|
||||
<data name="FramesPerSecond" xml:space="preserve">
|
||||
<value>Frames per second :</value>
|
||||
</data>
|
||||
<data name="GitHubButtonDescription" xml:space="preserve">
|
||||
<value>Open GitHub project page</value>
|
||||
</data>
|
||||
<data name="Help" xml:space="preserve">
|
||||
<value>help ?</value>
|
||||
</data>
|
||||
<data name="InputExample" xml:space="preserve">
|
||||
<value>Input example</value>
|
||||
</data>
|
||||
<data name="InputFormats" xml:space="preserve">
|
||||
<value>Input formats</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionDeleteName" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionMoveInArchiveFolderName" xml:space="preserve">
|
||||
<value>Move in an archive folder</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionNoneName" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="InstallButtonDescription" xml:space="preserve">
|
||||
<value>The update has been downloaded. Exit File Converter and install the update now.</value>
|
||||
</data>
|
||||
<data name="InstallButtonTitle" xml:space="preserve">
|
||||
<value>Install when I exit File Converter</value>
|
||||
</data>
|
||||
<data name="IssueButtonDescription" xml:space="preserve">
|
||||
<value>Report an issue</value>
|
||||
</data>
|
||||
<data name="MoveDownSelectedPreset" xml:space="preserve">
|
||||
<value>Move down selected preset</value>
|
||||
</data>
|
||||
<data name="MoveUpSelectedPreset" xml:space="preserve">
|
||||
<value>Move up selected preset</value>
|
||||
</data>
|
||||
<data name="Mp3CbrDescription" xml:space="preserve">
|
||||
<value>Constant bitrate encoding</value>
|
||||
</data>
|
||||
<data name="Mp3VbrDescription" xml:space="preserve">
|
||||
<value>Variable bitrate encoding</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>90°</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>90° counter clockwise rotation</value>
|
||||
</data>
|
||||
<data name="Ok" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>180°</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>180° rotation</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Music\Artist\Album\Song.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
<value>Output</value>
|
||||
</data>
|
||||
<data name="OutputFilePathTemplateHelp" xml:space="preserve">
|
||||
<value>(p): input file path
|
||||
(f): input filename
|
||||
(o): output extension type
|
||||
(i): input extension type
|
||||
(d0): input parent folder
|
||||
(d1): input sub parent folder
|
||||
...
|
||||
(n:i): page number index
|
||||
(n:c): total page count
|
||||
|
||||
Special paths:
|
||||
(p:d): my documents path
|
||||
(p:m): my music path
|
||||
(p:v): my videos path
|
||||
(p:p): my pictures path
|
||||
|
||||
use maj for uppercase version</value>
|
||||
</data>
|
||||
<data name="OutputFormat" xml:space="preserve">
|
||||
<value>Output format</value>
|
||||
</data>
|
||||
<data name="Preset" xml:space="preserve">
|
||||
<value>Preset</value>
|
||||
</data>
|
||||
<data name="PresetName" xml:space="preserve">
|
||||
<value>Preset Name</value>
|
||||
</data>
|
||||
<data name="Quality" xml:space="preserve">
|
||||
<value>Quality :</value>
|
||||
</data>
|
||||
<data name="RecommendeBitrateRangeInBlue" xml:space="preserve">
|
||||
<value>Recommended bitrate range in blue</value>
|
||||
</data>
|
||||
<data name="RemoveSelectedPreset" xml:space="preserve">
|
||||
<value>Remove selected preset</value>
|
||||
</data>
|
||||
<data name="Rotate" xml:space="preserve">
|
||||
<value>Rotate :</value>
|
||||
</data>
|
||||
<data name="Save" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name="Scale" xml:space="preserve">
|
||||
<value>Scale :</value>
|
||||
</data>
|
||||
<data name="SeeChangeLog" xml:space="preserve">
|
||||
<value>See change log ...</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>File Converter Settings</value>
|
||||
</data>
|
||||
<data name="SettingsButtonTitle" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>270°</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>90° clockwise rotation</value>
|
||||
</data>
|
||||
<data name="UpgradeAvailable" xml:space="preserve">
|
||||
<value>An update for File Converter is available. It is strongly recommended that you install it as soon as possible!</value>
|
||||
</data>
|
||||
<data name="UpgradeDownloadInProgress" xml:space="preserve">
|
||||
<value>Upgrade download in progress...</value>
|
||||
</data>
|
||||
<data name="UpgradeWindowTitle" xml:space="preserve">
|
||||
<value>File Converter Updates</value>
|
||||
</data>
|
||||
<data name="VideoEncodingQualityTooltip" xml:space="preserve">
|
||||
<value>Define the ratio 'file size' versus 'video quality'. A lower value will give you a smaller file, a greater value give you a better video quality.</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFasterName" xml:space="preserve">
|
||||
<value>Faster</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFastName" xml:space="preserve">
|
||||
<value>Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedMediumName" xml:space="preserve">
|
||||
<value>Medium</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowerName" xml:space="preserve">
|
||||
<value>Slower</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowName" xml:space="preserve">
|
||||
<value>Slow</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSuperFastName" xml:space="preserve">
|
||||
<value>Super Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedTooltip" xml:space="preserve">
|
||||
<value>Define the ratio 'file size' versus 'compression duration'. A slow compression will give you a smaller file (for the same video quality) than a faster compression.</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedUltraFastName" xml:space="preserve">
|
||||
<value>Ultra Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVeryFastName" xml:space="preserve">
|
||||
<value>Very Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVerySlowName" xml:space="preserve">
|
||||
<value>Very Slow</value>
|
||||
</data>
|
||||
<data name="VideoTitle" xml:space="preserve">
|
||||
<value>Video</value>
|
||||
</data>
|
||||
<data name="Wav16bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 16-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav24bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 24-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav32bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 32-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav8bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 8-bit little-endian</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTitle" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>No rotation</value>
|
||||
</data>
|
||||
<data name="ConversionStateConversion" xml:space="preserve">
|
||||
<value>Conversion</value>
|
||||
</data>
|
||||
<data name="ConversionStateDone" xml:space="preserve">
|
||||
<value>Done</value>
|
||||
</data>
|
||||
<data name="ConversionStateExtraction" xml:space="preserve">
|
||||
<value>Extraction</value>
|
||||
</data>
|
||||
<data name="ConversionStateFailed" xml:space="preserve">
|
||||
<value>Failed</value>
|
||||
</data>
|
||||
<data name="ConversionStateInQueue" xml:space="preserve">
|
||||
<value>In queue</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadIntputImage" xml:space="preserve">
|
||||
<value>Read input image</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadDocument" xml:space="preserve">
|
||||
<value>Read document</value>
|
||||
</data>
|
||||
<data name="StringAnimatedImageName" xml:space="preserve">
|
||||
<value>Animated Image</value>
|
||||
</data>
|
||||
<data name="StringAudioName" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="StringDocumentName" xml:space="preserve">
|
||||
<value>Document</value>
|
||||
</data>
|
||||
<data name="StringImageName" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="StringVideoName" xml:space="preserve">
|
||||
<value>Video</value>
|
||||
</data>
|
||||
<data name="ExitWaitingDuration" xml:space="preserve">
|
||||
<value>Waiting duration before application exit</value>
|
||||
</data>
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="MaximumNumberOfSimultaneousConversions" xml:space="preserve">
|
||||
<value>Maximum number of simultaneous conversions</value>
|
||||
</data>
|
||||
<data name="DefaultPresetName" xml:space="preserve">
|
||||
<value>New preset</value>
|
||||
</data>
|
||||
<data name="DownloadingChangeLog" xml:space="preserve">
|
||||
<value>###Downloading change log ...</value>
|
||||
</data>
|
||||
<data name="ConversionArchives" xml:space="preserve">
|
||||
<value>Conversion Archives</value>
|
||||
</data>
|
||||
<data name="ErrorCanceled" xml:space="preserve">
|
||||
<value>Canceled.</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindFFMPEG" xml:space="preserve">
|
||||
<value>Fail to find ffmpeg executable. You should try to reinstall the application.</value>
|
||||
</data>
|
||||
<data name="ErrorCDAExtractionFailed" xml:space="preserve">
|
||||
<value>Audio CD track extraction failed</value>
|
||||
</data>
|
||||
<data name="ErrorCDDriveNotReady" xml:space="preserve">
|
||||
<value>CD drive is not ready.</value>
|
||||
</data>
|
||||
<data name="ErrorFailedToLaunchFFMPEG" xml:space="preserve">
|
||||
<value>Fail to launch ffmpeg.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToCreateOutputPathFolders" xml:space="preserve">
|
||||
<value>Fail to create output path folders.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToGenerateUniqueOutputPath" xml:space="preserve">
|
||||
<value>Fail to generate a unique output file path.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToReadCDDrive" xml:space="preserve">
|
||||
<value>Fail to read cd drive '{0}'.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveInputPathDriveLetter" xml:space="preserve">
|
||||
<value>Fail to retrieve input path drive letter.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveTrackNumber" xml:space="preserve">
|
||||
<value>Fail to retrieve track number from the cda input path.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToUseCDDriveOpen" xml:space="preserve">
|
||||
<value>Fail to use the CD drive because it is oppened.</value>
|
||||
</data>
|
||||
<data name="ErrorInputTypeIncompatibleWithOutputType" xml:space="preserve">
|
||||
<value>The input file type is not compatible with the selected output file type.</value>
|
||||
</data>
|
||||
<data name="ErrorInvalidOutputPath" xml:space="preserve">
|
||||
<value>Invalid output path generated by output file path template.</value>
|
||||
</data>
|
||||
<data name="ErrorUnsupportedOutputFormat" xml:space="preserve">
|
||||
<value>Unsupported output format '{0}'.</value>
|
||||
</data>
|
||||
<data name="ChannelCountTitle" xml:space="preserve">
|
||||
<value>Channel count :</value>
|
||||
</data>
|
||||
<data name="ChannelCountTooltip" xml:space="preserve">
|
||||
<value>Change the number of channels of the input file.</value>
|
||||
</data>
|
||||
<data name="MonoOption" xml:space="preserve">
|
||||
<value>Mono</value>
|
||||
</data>
|
||||
<data name="SameChannelCountOption" xml:space="preserve">
|
||||
<value>Same than input file</value>
|
||||
</data>
|
||||
<data name="StereoOption" xml:space="preserve">
|
||||
<value>Stereo</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp3" xml:space="preserve">
|
||||
<value>To use File Converter please open the explorer and right-click on any file you like to bring up the context menu where you will find File Converter commands (see the online documentation to see the list of compatible file formats).</value>
|
||||
</data>
|
||||
<data name="LicenceHeader1" xml:space="preserve">
|
||||
<value>**This program is free software**.</value>
|
||||
</data>
|
||||
<data name="LicenceHeader2" xml:space="preserve">
|
||||
<value>You can redistribute it and/or modify it under the terms of the GNU General Public License.</value>
|
||||
</data>
|
||||
<data name="LicenceHeader3" xml:space="preserve">
|
||||
<value>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the GNU General Public License (available in the installation folder: `LICENSE.md`) for more details.</value>
|
||||
</data>
|
||||
<data name="ApplicationIsTerminating" xml:space="preserve">
|
||||
<value>The application is terminating.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInMultipleSeconds" xml:space="preserve">
|
||||
<value>The application will automatically terminate in {0} seconds.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInOneSecond" xml:space="preserve">
|
||||
<value>The application will automatically terminate in 1 second.</value>
|
||||
</data>
|
||||
<data name="StringMiscName" xml:space="preserve">
|
||||
<value>Misc</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindOutputFiles" xml:space="preserve">
|
||||
<value>Can't find the output file(s).</value>
|
||||
</data>
|
||||
<data name="ErrorConversionFailedWithOutput" xml:space="preserve">
|
||||
<value>The conversion job failed but there is an output file that does exists.</value>
|
||||
</data>
|
||||
<data name="ConversionStatePrepareConversion" xml:space="preserve">
|
||||
<value>Prepare conversion</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftOfficeIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Office must be installed in order to convert Office documents.</value>
|
||||
</data>
|
||||
<data name="ErrorUnableToUseMicrosoftOffice" xml:space="preserve">
|
||||
<value>Fail to open document with Microsoft Office (check if your licence/installation are valid).</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftExcelIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Excel must be installed in order to convert Excel documents.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftPowerPointIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft PowerPoint must be installed in order to convert PowerPoint documents.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftWordIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Word must be installed in order to convert Word documents.</value>
|
||||
</data>
|
||||
<data name="WebsiteButtonDescription" xml:space="preserve">
|
||||
<value>Open File Converter website</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,565 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="About" xml:space="preserve">
|
||||
<value>A propos</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedDescription" xml:space="preserve">
|
||||
<value>Cette option vous permet de choisir ce que vous souhaitez faire du fichier d'origine après une conversion réussie</value>
|
||||
<comment>Allow you to chose what you want to do with your input files if the conversion succeed</comment>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedTitle" xml:space="preserve">
|
||||
<value>Action après conversion réussie</value>
|
||||
</data>
|
||||
<data name="AddNewPreset" xml:space="preserve">
|
||||
<value>Ajoute un nouveau preset (duplique le preset selectionné)</value>
|
||||
</data>
|
||||
<data name="Application" xml:space="preserve">
|
||||
<value>Application</value>
|
||||
</data>
|
||||
<data name="AudioTitle" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="AutomaticallyCheckForUpdates" xml:space="preserve">
|
||||
<value>Vérifier automatiquement les mises à jour au démarage de File Converter</value>
|
||||
<comment>Automatically check for updates when File Converter starts</comment>
|
||||
</data>
|
||||
<data name="AutomaticallyExitWhenAllConversionsFinished" xml:space="preserve">
|
||||
<value>Terminer File Converter lorsque toutes les conversions ont réussies</value>
|
||||
</data>
|
||||
<data name="ClampToLowestPowerOfTwoSize" xml:space="preserve">
|
||||
<value>Ajuster à la taille en puissance de 2 la plus proche</value>
|
||||
</data>
|
||||
<data name="Close" xml:space="preserve">
|
||||
<value>Fermer</value>
|
||||
</data>
|
||||
<data name="ConversionPresets" xml:space="preserve">
|
||||
<value>Presets de conversion</value>
|
||||
</data>
|
||||
<data name="ConversionQueueTitle" xml:space="preserve">
|
||||
<value>Fichiers à convertir</value>
|
||||
</data>
|
||||
<data name="ConvertedFrom" xml:space="preserve">
|
||||
<value>Converti depuis</value>
|
||||
</data>
|
||||
<data name="Diagnostics" xml:space="preserve">
|
||||
<value>Historique d'activité</value>
|
||||
</data>
|
||||
<data name="DiagnosticsButtonTitle" xml:space="preserve">
|
||||
<value>Historique d'activité</value>
|
||||
</data>
|
||||
<data name="DocumentationButtonDescription" xml:space="preserve">
|
||||
<value>Ouvrir la documentation</value>
|
||||
</data>
|
||||
<data name="DonateButtonTitle" xml:space="preserve">
|
||||
<value>Faire un don</value>
|
||||
</data>
|
||||
<data name="DonateDescription" xml:space="preserve">
|
||||
<value>N'oubliez pas de récompenser mon travail si vous l'apréciez :)</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonDescription" xml:space="preserve">
|
||||
<value>La mise à jour sera téléchargé en tache de fond et sera installé à la fermeture de File Converter.</value>
|
||||
<comment>The update will be downloaded in background, and installed once you exit File Converter.</comment>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonTitle" xml:space="preserve">
|
||||
<value>Installer lorsque je quitte File Converter</value>
|
||||
<comment>Install when I exit File Converter</comment>
|
||||
</data>
|
||||
<data name="Encoding" xml:space="preserve">
|
||||
<value>Encodage :</value>
|
||||
</data>
|
||||
<data name="EncodingSpeed" xml:space="preserve">
|
||||
<value>Vitesse d'encodage :</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp1" xml:space="preserve">
|
||||
<value>File Converter est une extension.</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp2" xml:space="preserve">
|
||||
<value>Cela signifie qu'il est intégré dans l'explorateur Windows.</value>
|
||||
<comment>That means it is integrated into the Windows explorer.</comment>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp3" xml:space="preserve">
|
||||
<value>Pour utiliser File Converter, ouvrez l'explorateur et faites un clic droit sur le ou les fichier(s) que vous souhaitez convertir pour faire apparaitre le menu contextuel ou vous trouverez File Converter (visitez la documentation en ligne pour connaître la liste des extensions de fichiers compatibles).</value>
|
||||
<comment>To use File Converter please open the explorer and right-click on any file you like to bring up the context menu where you will find File Converter commands (see the online documentation to see the list of compatible file formats).</comment>
|
||||
</data>
|
||||
<data name="FileNameTemplate" xml:space="preserve">
|
||||
<value>Modèle de nom de fichier</value>
|
||||
</data>
|
||||
<data name="FramesPerSecond" xml:space="preserve">
|
||||
<value>Images par seconde :</value>
|
||||
</data>
|
||||
<data name="GitHubButtonDescription" xml:space="preserve">
|
||||
<value>Ouvrir la page de projet GitHub</value>
|
||||
</data>
|
||||
<data name="Help" xml:space="preserve">
|
||||
<value>aide ?</value>
|
||||
</data>
|
||||
<data name="InputExample" xml:space="preserve">
|
||||
<value>Example de chemin d'origine</value>
|
||||
</data>
|
||||
<data name="InputFormats" xml:space="preserve">
|
||||
<value>Formats compatibles</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionDeleteName" xml:space="preserve">
|
||||
<value>Supprimer</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionMoveInArchiveFolderName" xml:space="preserve">
|
||||
<value>Déplacer dans un dossier d'archive</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionNoneName" xml:space="preserve">
|
||||
<value>Aucune</value>
|
||||
</data>
|
||||
<data name="InstallButtonDescription" xml:space="preserve">
|
||||
<value>La mise à jour a été téléchargé. Quitte File Conveter et installe la mise à jour maintenant.</value>
|
||||
<comment>The update has been downloaded. Exit File Converter and install the update now.</comment>
|
||||
</data>
|
||||
<data name="InstallButtonTitle" xml:space="preserve">
|
||||
<value>Installer quand je quitte File Converter</value>
|
||||
<comment>Install when I exit File Converter</comment>
|
||||
</data>
|
||||
<data name="IssueButtonDescription" xml:space="preserve">
|
||||
<value>Signaler un problème</value>
|
||||
</data>
|
||||
<data name="MoveDownSelectedPreset" xml:space="preserve">
|
||||
<value>Déplace le preset selectionné vers le bas</value>
|
||||
</data>
|
||||
<data name="MoveUpSelectedPreset" xml:space="preserve">
|
||||
<value>Déplace le preset selectionné vers le haut</value>
|
||||
</data>
|
||||
<data name="Mp3CbrDescription" xml:space="preserve">
|
||||
<value>Taux d'encodage constant</value>
|
||||
</data>
|
||||
<data name="Mp3VbrDescription" xml:space="preserve">
|
||||
<value>Taux d'encodage variable</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>90°</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>rotation de 90° dans le sens antihoraire</value>
|
||||
</data>
|
||||
<data name="Ok" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>180°</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>rotation de 180°</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Musique\Artiste\Album\Chanson.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
<value>Destination</value>
|
||||
</data>
|
||||
<data name="OutputFilePathTemplateHelp" xml:space="preserve">
|
||||
<value>(p): chemin du fichier d'origine
|
||||
(f): nom du fichier d'origine
|
||||
(o): extension du fichier de destination
|
||||
(i): extension du fichier d'origine
|
||||
(d0): dossier parent du fichier d'origine
|
||||
(d1): parent du dossier parent du fichier d'origine
|
||||
...
|
||||
(n:i): index du numéro de page
|
||||
(n:c): nombre total de pages
|
||||
|
||||
Chemin spéciaux:
|
||||
(p:d): chemin vers mes documents
|
||||
(p:m): chemin vers ma musique
|
||||
(p:v): chemin vers mes vidéos
|
||||
(p:p): chemin vers mes images
|
||||
|
||||
utilisez maj pour une version en majuscules</value>
|
||||
</data>
|
||||
<data name="OutputFormat" xml:space="preserve">
|
||||
<value>Format de destination</value>
|
||||
</data>
|
||||
<data name="Preset" xml:space="preserve">
|
||||
<value>Preset</value>
|
||||
</data>
|
||||
<data name="PresetName" xml:space="preserve">
|
||||
<value>Nom du preset</value>
|
||||
</data>
|
||||
<data name="Quality" xml:space="preserve">
|
||||
<value>Qualité :</value>
|
||||
</data>
|
||||
<data name="RecommendeBitrateRangeInBlue" xml:space="preserve">
|
||||
<value>Taux recommandés en bleu</value>
|
||||
</data>
|
||||
<data name="RemoveSelectedPreset" xml:space="preserve">
|
||||
<value>Supprime le preset selectionné</value>
|
||||
</data>
|
||||
<data name="Rotate" xml:space="preserve">
|
||||
<value>Rotation :</value>
|
||||
</data>
|
||||
<data name="Save" xml:space="preserve">
|
||||
<value>Enregistrer</value>
|
||||
</data>
|
||||
<data name="Scale" xml:space="preserve">
|
||||
<value>Echelle :</value>
|
||||
</data>
|
||||
<data name="SeeChangeLog" xml:space="preserve">
|
||||
<value>Voir les changements ...</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>Configuration de File Converter</value>
|
||||
</data>
|
||||
<data name="SettingsButtonTitle" xml:space="preserve">
|
||||
<value>Configuration</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>270°</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>rotation de 90° dans le sens horaire</value>
|
||||
</data>
|
||||
<data name="UpgradeAvailable" xml:space="preserve">
|
||||
<value>Une mise à jour de File Converter est disponible. Il est vivement recommandé de l'installer dès que possible!</value>
|
||||
<comment>An update for File Converter is available. It is strongly recommended that you install it as soon as possible!</comment>
|
||||
</data>
|
||||
<data name="UpgradeDownloadInProgress" xml:space="preserve">
|
||||
<value>Téléchargement de la mise à jour en cours...</value>
|
||||
</data>
|
||||
<data name="UpgradeWindowTitle" xml:space="preserve">
|
||||
<value>Mise à jour de File Converter</value>
|
||||
</data>
|
||||
<data name="VideoEncodingQualityTooltip" xml:space="preserve">
|
||||
<value>Défini le rapport 'poid du fichier' contre 'qualité vidéo'. Une valeur basse donnera un fichier plus léger, une valeur haute une meilleur qualité vidéo.</value>
|
||||
<comment>Define the ratio 'file size' versus 'video quality'. A lower value will give you a smaller file, a greater value give you a better video quality.</comment>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFasterName" xml:space="preserve">
|
||||
<value>Très Rapide</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFastName" xml:space="preserve">
|
||||
<value>Rapide</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedMediumName" xml:space="preserve">
|
||||
<value>Normal</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowerName" xml:space="preserve">
|
||||
<value>Très Lent</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowName" xml:space="preserve">
|
||||
<value>Lent</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSuperFastName" xml:space="preserve">
|
||||
<value>Super Rapide</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedTooltip" xml:space="preserve">
|
||||
<value>Défini le ratio 'poid du fichier' contre 'temps de compression'. Une compression lente donnera un fichier plus léger (pour la même qualité vidéo) qu'une compression rapide.</value>
|
||||
<comment>Define the ratio 'file size' versus 'compression duration'. A slow compression will give you a smaller file (for the same video quality) than a faster compression.</comment>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedUltraFastName" xml:space="preserve">
|
||||
<value>Ultra Rapide</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVeryFastName" xml:space="preserve">
|
||||
<value>Très Très Rapide</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVerySlowName" xml:space="preserve">
|
||||
<value>Très Très Lent</value>
|
||||
</data>
|
||||
<data name="VideoTitle" xml:space="preserve">
|
||||
<value>Vidéo</value>
|
||||
</data>
|
||||
<data name="Wav16bitsDescription" xml:space="preserve">
|
||||
<value>PCM signé 16-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav24bitsDescription" xml:space="preserve">
|
||||
<value>PCM signé 24-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav32bitsDescription" xml:space="preserve">
|
||||
<value>PCM signé 32-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav8bitsDescription" xml:space="preserve">
|
||||
<value>PCM signé gned 8-bit little-endian</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTitle" xml:space="preserve">
|
||||
<value>Aucune</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Aucune rotation</value>
|
||||
</data>
|
||||
<data name="ConversionStateConversion" xml:space="preserve">
|
||||
<value>Conversion</value>
|
||||
</data>
|
||||
<data name="ConversionStateDone" xml:space="preserve">
|
||||
<value>Réussi</value>
|
||||
</data>
|
||||
<data name="ConversionStateExtraction" xml:space="preserve">
|
||||
<value>Extraction</value>
|
||||
</data>
|
||||
<data name="ConversionStateFailed" xml:space="preserve">
|
||||
<value>Echec</value>
|
||||
</data>
|
||||
<data name="ConversionStateInQueue" xml:space="preserve">
|
||||
<value>En attente</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadIntputImage" xml:space="preserve">
|
||||
<value>Lecture de l'image d'origine</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadDocument" xml:space="preserve">
|
||||
<value>Lecture du document</value>
|
||||
</data>
|
||||
<data name="StringAnimatedImageName" xml:space="preserve">
|
||||
<value>Image Animée</value>
|
||||
</data>
|
||||
<data name="StringAudioName" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="StringDocumentName" xml:space="preserve">
|
||||
<value>Document</value>
|
||||
</data>
|
||||
<data name="StringImageName" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="StringVideoName" xml:space="preserve">
|
||||
<value>Vidéo</value>
|
||||
</data>
|
||||
<data name="ExitWaitingDuration" xml:space="preserve">
|
||||
<value>Temps d'attente avant l'arret de l'application</value>
|
||||
</data>
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Langue</value>
|
||||
</data>
|
||||
<data name="MaximumNumberOfSimultaneousConversions" xml:space="preserve">
|
||||
<value>Nombre maximum de conversions simultanées</value>
|
||||
</data>
|
||||
<data name="DefaultPresetName" xml:space="preserve">
|
||||
<value>Nouveau preset</value>
|
||||
</data>
|
||||
<data name="DownloadingChangeLog" xml:space="preserve">
|
||||
<value>###Téléchargement des notes de mise à jour ...</value>
|
||||
</data>
|
||||
<data name="ConversionArchives" xml:space="preserve">
|
||||
<value>Archives de conversions</value>
|
||||
</data>
|
||||
<data name="ErrorCanceled" xml:space="preserve">
|
||||
<value>Annulé.</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindFFMPEG" xml:space="preserve">
|
||||
<value>L'exécutable ffmpeg n'a pas été trouvé. Vous pouvez essayer de réinstaller l'application pour corriger le problème.</value>
|
||||
</data>
|
||||
<data name="ErrorCDAExtractionFailed" xml:space="preserve">
|
||||
<value>Echec de l'extraction de la piste audio.</value>
|
||||
</data>
|
||||
<data name="ErrorCDDriveNotReady" xml:space="preserve">
|
||||
<value>Le lecteur CD n'est pas prêt.</value>
|
||||
</data>
|
||||
<data name="ErrorFailedToLaunchFFMPEG" xml:space="preserve">
|
||||
<value>Ffmpeg n'a pas pu être lancé.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToCreateOutputPathFolders" xml:space="preserve">
|
||||
<value>Les dossiers de destination n'ont pas pu être créés.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToGenerateUniqueOutputPath" xml:space="preserve">
|
||||
<value>La génération d'un chemin de destination unique a échoué.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToReadCDDrive" xml:space="preserve">
|
||||
<value>Impossible de lire le lecteur cd '{0}'.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveInputPathDriveLetter" xml:space="preserve">
|
||||
<value>Impossible de récupérer la lettre du disque du chemin d'origine.</value>
|
||||
<comment>Fail to retrieve input path drive letter.</comment>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveTrackNumber" xml:space="preserve">
|
||||
<value>Impossible de récupérer le numéro de piste à partir du chemin d'origine.</value>
|
||||
<comment>Fail to retrieve track number from the cda input path.</comment>
|
||||
</data>
|
||||
<data name="ErrorFailToUseCDDriveOpen" xml:space="preserve">
|
||||
<value>Impossible d'utiliser le lecteur CD car il est ouvert.</value>
|
||||
</data>
|
||||
<data name="ErrorInputTypeIncompatibleWithOutputType" xml:space="preserve">
|
||||
<value>Le type du fichier d'origine n'est pas compatible avec le type de fichier de destination selectionné.</value>
|
||||
<comment>The input file type is not compatible with the selected output file type.</comment>
|
||||
</data>
|
||||
<data name="ErrorInvalidOutputPath" xml:space="preserve">
|
||||
<value>Le chemin de destination généré par le modèle de nom de fichier est invalide.</value>
|
||||
<comment>Invalid output path generated by output file path template.</comment>
|
||||
</data>
|
||||
<data name="ErrorUnsupportedOutputFormat" xml:space="preserve">
|
||||
<value>Format de fichier de destination non supporté '{0}'.</value>
|
||||
</data>
|
||||
<data name="ChannelCountTitle" xml:space="preserve">
|
||||
<value>Nombre de canaux :</value>
|
||||
</data>
|
||||
<data name="ChannelCountTooltip" xml:space="preserve">
|
||||
<value>Change le nombre de canaux du fichier d'origine</value>
|
||||
</data>
|
||||
<data name="MonoOption" xml:space="preserve">
|
||||
<value>Mono</value>
|
||||
</data>
|
||||
<data name="SameChannelCountOption" xml:space="preserve">
|
||||
<value>Identique au fichier d'origine</value>
|
||||
</data>
|
||||
<data name="StereoOption" xml:space="preserve">
|
||||
<value>Stéréo</value>
|
||||
</data>
|
||||
<data name="LicenceHeader1" xml:space="preserve">
|
||||
<value>**Ce programme est gratuit**.</value>
|
||||
<comment>**This program is free software**.</comment>
|
||||
</data>
|
||||
<data name="LicenceHeader2" xml:space="preserve">
|
||||
<value>Vous pouvez le redistribuer et/ou le modifier selon les termes de la licence GNU General Public Licence.</value>
|
||||
<comment>You can redistribute it and/or modify it under the terms of the GNU General Public License.</comment>
|
||||
</data>
|
||||
<data name="LicenceHeader3" xml:space="preserve">
|
||||
<value>Ce programme est distribué dans l'espoir d'être utile, mais SANS AUCUNE GARANTIE. Voir la GNU General Public Licence (disponible dans le dossier d'installation: `LICENCE.md`) pour plus de détails.</value>
|
||||
<comment>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the GNU General Public License (available in the installation folder: `LICENSE.md`) for more details.</comment>
|
||||
</data>
|
||||
<data name="ApplicationIsTerminating" xml:space="preserve">
|
||||
<value>Fermeture de l'application.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInMultipleSeconds" xml:space="preserve">
|
||||
<value>L'application se fermera automatiquement dans {0} secondes.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInOneSecond" xml:space="preserve">
|
||||
<value>L'application se fermera automatiquement dans 1 seconde.</value>
|
||||
</data>
|
||||
<data name="StringMiscName" xml:space="preserve">
|
||||
<value>Autre</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindOutputFiles" xml:space="preserve">
|
||||
<value>Les fichiers n'ont pas pu être converti.</value>
|
||||
</data>
|
||||
<data name="ErrorConversionFailedWithOutput" xml:space="preserve">
|
||||
<value>Des fichiers sont présents malgré l'echec de la conversion.</value>
|
||||
</data>
|
||||
<data name="ConversionStatePrepareConversion" xml:space="preserve">
|
||||
<value>Préparation</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftOfficeIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Office doit être installé pour pouvoir convertir les documents Office.</value>
|
||||
</data>
|
||||
<data name="ErrorUnableToUseMicrosoftOffice" xml:space="preserve">
|
||||
<value>Impossible d'ouvrir le document avec Microsoft Office (vérifiez que la licence/l'installation sont valides).</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftExcelIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Excel doit être installé pour pouvoir convertir les documents Excel.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftPowerPointIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft PowerPoint doit être installé pour pouvoir convertir les documents PowerPoint.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftWordIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Word doit être installé pour pouvoir convertir les documents Word.</value>
|
||||
</data>
|
||||
<data name="WebsiteButtonDescription" xml:space="preserve">
|
||||
<value>Ouvrir le site web de File Converter</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,547 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="About" xml:space="preserve">
|
||||
<value>Sobre</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedDescription" xml:space="preserve">
|
||||
<value>Se a conversão for bem sucedida, o que pretende fazer com o ficheiro original?</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedTitle" xml:space="preserve">
|
||||
<value>Ação a fazer aquando conversão bem sucedida</value>
|
||||
</data>
|
||||
<data name="AddNewPreset" xml:space="preserve">
|
||||
<value>Adicional nova predefinição (duplicar predefinição selecionada)</value>
|
||||
</data>
|
||||
<data name="Application" xml:space="preserve">
|
||||
<value>Programa</value>
|
||||
</data>
|
||||
<data name="AudioTitle" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="AutomaticallyCheckForUpdates" xml:space="preserve">
|
||||
<value>verificar por atualizações automaticamente quando o File converter iniciar</value>
|
||||
</data>
|
||||
<data name="AutomaticallyExitWhenAllConversionsFinished" xml:space="preserve">
|
||||
<value>Sair do programa automaticamente quando todas as conversões estiverem concluídas</value>
|
||||
</data>
|
||||
<data name="ClampToLowestPowerOfTwoSize" xml:space="preserve">
|
||||
<value>Clamp to lowest power of 2 size</value>
|
||||
</data>
|
||||
<data name="Close" xml:space="preserve">
|
||||
<value>Fechar</value>
|
||||
</data>
|
||||
<data name="ConversionPresets" xml:space="preserve">
|
||||
<value>Predefinições de conversão</value>
|
||||
</data>
|
||||
<data name="ConversionQueueTitle" xml:space="preserve">
|
||||
<value>Ficheiros para converter</value>
|
||||
</data>
|
||||
<data name="ConvertedFrom" xml:space="preserve">
|
||||
<value>Convertidos de</value>
|
||||
</data>
|
||||
<data name="Diagnostics" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="DiagnosticsButtonTitle" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="DocumentationButtonDescription" xml:space="preserve">
|
||||
<value>Abrir documentação</value>
|
||||
</data>
|
||||
<data name="DonateButtonTitle" xml:space="preserve">
|
||||
<value>Doar</value>
|
||||
</data>
|
||||
<data name="DonateDescription" xml:space="preserve">
|
||||
<value>Não se esqueça de recompensar o meu trabalho se gostou :)</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonDescription" xml:space="preserve">
|
||||
<value>A atualização irá ser decarregada em background e instalada assim que fechar o File Converter.</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonTitle" xml:space="preserve">
|
||||
<value>instalar quando eu sair do File Converter</value>
|
||||
</data>
|
||||
<data name="Encoding" xml:space="preserve">
|
||||
<value>Codificação :</value>
|
||||
</data>
|
||||
<data name="EncodingSpeed" xml:space="preserve">
|
||||
<value>Velocidade de codificação :</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp1" xml:space="preserve">
|
||||
<value>O File Converter é uma extensão shell.</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp2" xml:space="preserve">
|
||||
<value>Isso quer dizer que está integrada no explorador de ficheiros.</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp3" xml:space="preserve">
|
||||
<value>Para usar o File Converter abra o explorador de ficheiros e clique com o botão direito do rato em qualquer ficheiro que goste para mostrar o menu de contexto, onde encontrará os comandos do File Converter (veja o ficheiro readme para ver a lista de formatos de ficheiro compatíveis).</value>
|
||||
</data>
|
||||
<data name="FileNameTemplate" xml:space="preserve">
|
||||
<value>Nome do ficheiro de modelo</value>
|
||||
</data>
|
||||
<data name="FramesPerSecond" xml:space="preserve">
|
||||
<value>Quadros por segundo :</value>
|
||||
</data>
|
||||
<data name="GitHubButtonDescription" xml:space="preserve">
|
||||
<value>Abrir a página do projeto no GitHub</value>
|
||||
</data>
|
||||
<data name="Help" xml:space="preserve">
|
||||
<value>Ajuda ?</value>
|
||||
</data>
|
||||
<data name="InputExample" xml:space="preserve">
|
||||
<value>Exemplo de origem</value>
|
||||
</data>
|
||||
<data name="InputFormats" xml:space="preserve">
|
||||
<value>Formatos de origem</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionDeleteName" xml:space="preserve">
|
||||
<value>Apagar</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionMoveInArchiveFolderName" xml:space="preserve">
|
||||
<value>Mover-se para um ficheiro</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionNoneName" xml:space="preserve">
|
||||
<value>Nenhum</value>
|
||||
</data>
|
||||
<data name="InstallButtonDescription" xml:space="preserve">
|
||||
<value>A atualização foi transferida. Saia do File Converter e instale a atualização agora.</value>
|
||||
</data>
|
||||
<data name="InstallButtonTitle" xml:space="preserve">
|
||||
<value>Instalar quando eu saia do File Converter</value>
|
||||
</data>
|
||||
<data name="IssueButtonDescription" xml:space="preserve">
|
||||
<value>Reportar um problema</value>
|
||||
</data>
|
||||
<data name="MoveDownSelectedPreset" xml:space="preserve">
|
||||
<value>Mover a predefinição selecionada para baixo</value>
|
||||
</data>
|
||||
<data name="MoveUpSelectedPreset" xml:space="preserve">
|
||||
<value>Mover a predefinição selecionada para cima</value>
|
||||
</data>
|
||||
<data name="Mp3CbrDescription" xml:space="preserve">
|
||||
<value>Codificação de bitrate constante</value>
|
||||
</data>
|
||||
<data name="Mp3VbrDescription" xml:space="preserve">
|
||||
<value>Codificação de bitrate variável</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>90°</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Rotacionar 90° sentido inverso aos ponteiros do relógio</value>
|
||||
</data>
|
||||
<data name="Ok" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>180°</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Rotacionar 180°</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Música\Artista\Álbum\música.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
<value>Destino</value>
|
||||
</data>
|
||||
<data name="OutputFilePathTemplateHelp" xml:space="preserve">
|
||||
<value>(P): caminho do ficheiro original
|
||||
(F): nome do arquivo original
|
||||
(O): tipo de extensão de destino
|
||||
(I): tipo de extensão de entrada
|
||||
(D0): input parent folder
|
||||
(d1): input sub parent folder
|
||||
...
|
||||
(N: i): índice de número de página
|
||||
(N: c): contagem total de páginas
|
||||
|
||||
Caminhos especiais:
|
||||
(P: d): caminho para Documentos
|
||||
(P: m): caminho para música
|
||||
(P: v): caminho para vídeos
|
||||
(P: p): caminho para fotos
|
||||
|
||||
Use maj para a versão em maiúsculas</value>
|
||||
</data>
|
||||
<data name="OutputFormat" xml:space="preserve">
|
||||
<value>Formato de saída</value>
|
||||
</data>
|
||||
<data name="Preset" xml:space="preserve">
|
||||
<value>Predefinição</value>
|
||||
</data>
|
||||
<data name="PresetName" xml:space="preserve">
|
||||
<value>Nome da predefinição</value>
|
||||
</data>
|
||||
<data name="Quality" xml:space="preserve">
|
||||
<value>Qualidade :</value>
|
||||
</data>
|
||||
<data name="RecommendeBitrateRangeInBlue" xml:space="preserve">
|
||||
<value>O bitrate recomendado está representado a azul</value>
|
||||
</data>
|
||||
<data name="RemoveSelectedPreset" xml:space="preserve">
|
||||
<value>Remover a predefinição selecionada</value>
|
||||
</data>
|
||||
<data name="Rotate" xml:space="preserve">
|
||||
<value>Rotacionar :</value>
|
||||
</data>
|
||||
<data name="Save" xml:space="preserve">
|
||||
<value>Guardar</value>
|
||||
</data>
|
||||
<data name="Scale" xml:space="preserve">
|
||||
<value>Escala :</value>
|
||||
</data>
|
||||
<data name="SeeChangeLog" xml:space="preserve">
|
||||
<value>Ver log de alterações ...</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>Definições</value>
|
||||
</data>
|
||||
<data name="SettingsButtonTitle" xml:space="preserve">
|
||||
<value>Definições</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>270°</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Rotacionar 90° na direção dos ponteiros do relógio</value>
|
||||
</data>
|
||||
<data name="UpgradeAvailable" xml:space="preserve">
|
||||
<value>Uma atualização para o File Converter está disponível. É altamente recomendado instala-la assim que puder!</value>
|
||||
</data>
|
||||
<data name="UpgradeDownloadInProgress" xml:space="preserve">
|
||||
<value>Download da atualização em progresso...</value>
|
||||
</data>
|
||||
<data name="UpgradeWindowTitle" xml:space="preserve">
|
||||
<value>Atualizações do File Converter</value>
|
||||
</data>
|
||||
<data name="VideoEncodingQualityTooltip" xml:space="preserve">
|
||||
<value>Define a relação "tamanho x qualidade". Um valor mais baixo produz um ficheiro mais pequeno, um valor mais alto produz um ficheiro com mais qualidade.</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFasterName" xml:space="preserve">
|
||||
<value>Mais rápido</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFastName" xml:space="preserve">
|
||||
<value>Rápido</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedMediumName" xml:space="preserve">
|
||||
<value>Médio</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowerName" xml:space="preserve">
|
||||
<value>Mais lento</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowName" xml:space="preserve">
|
||||
<value>Lento</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSuperFastName" xml:space="preserve">
|
||||
<value>Super rápido</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedTooltip" xml:space="preserve">
|
||||
<value>Define a relação "tamanho x duração de compressão". Uma compressão lenta produz um ficheiro mais pequeno (pela mesma qualidade) do que uma compressão mais rapida.</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedUltraFastName" xml:space="preserve">
|
||||
<value>Ultra rápido</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVeryFastName" xml:space="preserve">
|
||||
<value>Bastante rápido</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVerySlowName" xml:space="preserve">
|
||||
<value>bastante lento</value>
|
||||
</data>
|
||||
<data name="VideoTitle" xml:space="preserve">
|
||||
<value>Video</value>
|
||||
</data>
|
||||
<data name="Wav16bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 16-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav24bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 24-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav32bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 32-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav8bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 8-bit little-endian</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTitle" xml:space="preserve">
|
||||
<value>Nenhum</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Sem rotação</value>
|
||||
</data>
|
||||
<data name="ConversionStateConversion" xml:space="preserve">
|
||||
<value>Conversão</value>
|
||||
</data>
|
||||
<data name="ConversionStateDone" xml:space="preserve">
|
||||
<value>Feito</value>
|
||||
</data>
|
||||
<data name="ConversionStateExtraction" xml:space="preserve">
|
||||
<value>Extração</value>
|
||||
</data>
|
||||
<data name="ConversionStateFailed" xml:space="preserve">
|
||||
<value>Falhou</value>
|
||||
</data>
|
||||
<data name="ConversionStateInQueue" xml:space="preserve">
|
||||
<value>Em espera</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadIntputImage" xml:space="preserve">
|
||||
<value>Ler a imagem de entradae</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadDocument" xml:space="preserve">
|
||||
<value>Ler o documento</value>
|
||||
</data>
|
||||
<data name="StringAnimatedImageName" xml:space="preserve">
|
||||
<value>Imagem animada</value>
|
||||
</data>
|
||||
<data name="StringAudioName" xml:space="preserve">
|
||||
<value>Áudio</value>
|
||||
</data>
|
||||
<data name="StringDocumentName" xml:space="preserve">
|
||||
<value>Documento</value>
|
||||
</data>
|
||||
<data name="StringImageName" xml:space="preserve">
|
||||
<value>Imagem</value>
|
||||
</data>
|
||||
<data name="StringVideoName" xml:space="preserve">
|
||||
<value>Vídeo</value>
|
||||
</data>
|
||||
<data name="ExitWaitingDuration" xml:space="preserve">
|
||||
<value>Duração de espera antes da saída do programa</value>
|
||||
</data>
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Idioma</value>
|
||||
</data>
|
||||
<data name="MaximumNumberOfSimultaneousConversions" xml:space="preserve">
|
||||
<value>Número máximo de conversões simultâneas</value>
|
||||
</data>
|
||||
<data name="DefaultPresetName" xml:space="preserve">
|
||||
<value>Nova predefinição</value>
|
||||
</data>
|
||||
<data name="DownloadingChangeLog" xml:space="preserve">
|
||||
<value>###A transferir registo de alterações ...</value>
|
||||
</data>
|
||||
<data name="ConversionArchives" xml:space="preserve">
|
||||
<value>Arquivos de conversão</value>
|
||||
</data>
|
||||
<data name="ErrorCanceled" xml:space="preserve">
|
||||
<value>Cancelado.</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindFFMPEG" xml:space="preserve">
|
||||
<value>Não foi possível encontrar o executável do ffmpeg. você deveria tentar reinstalar o programa.</value>
|
||||
</data>
|
||||
<data name="ErrorCDAExtractionFailed" xml:space="preserve">
|
||||
<value>A extração da faixa de áudio do CD falhou.</value>
|
||||
</data>
|
||||
<data name="ErrorCDDriveNotReady" xml:space="preserve">
|
||||
<value>A unidade de CD não está pronta</value>
|
||||
</data>
|
||||
<data name="ErrorFailedToLaunchFFMPEG" xml:space="preserve">
|
||||
<value>Foi impossível abrir o ffmpeg.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToCreateOutputPathFolders" xml:space="preserve">
|
||||
<value>Foi impossível criar as pastas no caminho de saída.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToGenerateUniqueOutputPath" xml:space="preserve">
|
||||
<value>Foi impossível criar um caminho único de saída.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToReadCDDrive" xml:space="preserve">
|
||||
<value>Foi impossível ler a unidade de CD '{0}'.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveInputPathDriveLetter" xml:space="preserve">
|
||||
<value>Foi impossível conseguir a letra da unidade do ficheiro original.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveTrackNumber" xml:space="preserve">
|
||||
<value>Foi impossível conseguir o número de faixa do caminho de entrada do CDA.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToUseCDDriveOpen" xml:space="preserve">
|
||||
<value>Foi impossível usar a unidade de CD porque não está aberta.</value>
|
||||
</data>
|
||||
<data name="ErrorInputTypeIncompatibleWithOutputType" xml:space="preserve">
|
||||
<value>O ficheiro original é incompatível com o formato de ficheiro selecionado.</value>
|
||||
</data>
|
||||
<data name="ErrorInvalidOutputPath" xml:space="preserve">
|
||||
<value>Caminho de saída inválido gerado pelo modelo de caminho do ficheiro de saída.</value>
|
||||
</data>
|
||||
<data name="ErrorUnsupportedOutputFormat" xml:space="preserve">
|
||||
<value>Formato de saída não suportado '{0}'.</value>
|
||||
</data>
|
||||
<data name="ChannelCountTitle" xml:space="preserve">
|
||||
<value>Contagem de canais :</value>
|
||||
</data>
|
||||
<data name="ChannelCountTooltip" xml:space="preserve">
|
||||
<value>Mudar o número de canais do ficheiro original</value>
|
||||
</data>
|
||||
<data name="MonoOption" xml:space="preserve">
|
||||
<value>Mono</value>
|
||||
</data>
|
||||
<data name="SameChannelCountOption" xml:space="preserve">
|
||||
<value>O mesmo que o ficheiro original</value>
|
||||
</data>
|
||||
<data name="StereoOption" xml:space="preserve">
|
||||
<value>Stereo</value>
|
||||
</data>
|
||||
<data name="LicenceHeader1" xml:space="preserve">
|
||||
<value>**Este programa é gratuito**.</value>
|
||||
</data>
|
||||
<data name="LicenceHeader2" xml:space="preserve">
|
||||
<value>Você pode redistribuí-lo e/ou modificá-lo sob os termos da GNU General Public License.</value>
|
||||
</data>
|
||||
<data name="LicenceHeader3" xml:space="preserve">
|
||||
<value>Este programa é distribuído na esperança de que seja útil, mas SEM QUALQUER GARANTIA. Veja a GNU General Public License (disponível na pasta de instalação do programa: "LICENSE.md") para mais detalhes.</value>
|
||||
</data>
|
||||
<data name="ApplicationIsTerminating" xml:space="preserve">
|
||||
<value>O programa está a terminar.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInMultipleSeconds" xml:space="preserve">
|
||||
<value>O programa irá terminar automáticamente em {0} segundos.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInOneSecond" xml:space="preserve">
|
||||
<value>O programa irá terminar automáticamente em 1 segundo.</value>
|
||||
</data>
|
||||
<data name="StringMiscName" xml:space="preserve">
|
||||
<value>Variadoc</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindOutputFiles" xml:space="preserve">
|
||||
<value>É impossivel encontrar o(s) ficheiro(s) de saída.</value>
|
||||
</data>
|
||||
<data name="ErrorConversionFailedWithOutput" xml:space="preserve">
|
||||
<value>A conversão falhou mas existem ficheiros presentes na localização.</value>
|
||||
</data>
|
||||
<data name="ConversionStatePrepareConversion" xml:space="preserve">
|
||||
<value>Preparar conversão</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftOfficeIsNotAvailable" xml:space="preserve">
|
||||
<value>O Microsoft Office deve estar instalado para sr possível converter documentos do Office.</value>
|
||||
</data>
|
||||
<data name="ErrorUnableToUseMicrosoftOffice" xml:space="preserve">
|
||||
<value>É impossível abrir o documento Microsoft Office (verifique se a sua licença/instalação é válida)</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftExcelIsNotAvailable" xml:space="preserve">
|
||||
<value>O Microsoft Excel tem de estar instalado para converter documentos Excel.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftPowerPointIsNotAvailable" xml:space="preserve">
|
||||
<value>O Microsoft PowerPoint tem de estar instalado para converter documentos PowerPoint.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftWordIsNotAvailable" xml:space="preserve">
|
||||
<value>O Microsoft Word tem de estar instalado para converter documentos Word.</value>
|
||||
</data>
|
||||
<data name="WebsiteButtonDescription" xml:space="preserve">
|
||||
<value>Abrir o site do File Converter</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
@@ -60,6 +60,7 @@
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
@@ -68,9 +69,10 @@
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
@@ -85,9 +87,10 @@
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
@@ -109,9 +112,436 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.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>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="About" xml:space="preserve">
|
||||
<value>About</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedDescription" xml:space="preserve">
|
||||
<value>Allow you to chose what you want to do with your input files if the conversion succeed</value>
|
||||
</data>
|
||||
<data name="ActionWhenConversionSucceedTitle" xml:space="preserve">
|
||||
<value>Action when conversion succeed</value>
|
||||
</data>
|
||||
<data name="AddNewPreset" xml:space="preserve">
|
||||
<value>Add new preset (duplicate selected preset)</value>
|
||||
</data>
|
||||
<data name="Application" xml:space="preserve">
|
||||
<value>Application</value>
|
||||
</data>
|
||||
<data name="AudioTitle" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="AutomaticallyCheckForUpdates" xml:space="preserve">
|
||||
<value>Automatically check for updates when File Converter starts</value>
|
||||
</data>
|
||||
<data name="AutomaticallyExitWhenAllConversionsFinished" xml:space="preserve">
|
||||
<value>Automatically exit when all conversions finished</value>
|
||||
</data>
|
||||
<data name="ClampToLowestPowerOfTwoSize" xml:space="preserve">
|
||||
<value>Clamp to lowest power of 2 size</value>
|
||||
</data>
|
||||
<data name="Close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="ConversionPresets" xml:space="preserve">
|
||||
<value>Conversion Presets</value>
|
||||
</data>
|
||||
<data name="ConversionQueueTitle" xml:space="preserve">
|
||||
<value>Files to convert</value>
|
||||
</data>
|
||||
<data name="ConvertedFrom" xml:space="preserve">
|
||||
<value>Converted from</value>
|
||||
</data>
|
||||
<data name="Diagnostics" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="DiagnosticsButtonTitle" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="DocumentationButtonDescription" xml:space="preserve">
|
||||
<value>Open documentation</value>
|
||||
</data>
|
||||
<data name="DonateButtonTitle" xml:space="preserve">
|
||||
<value>Donate</value>
|
||||
</data>
|
||||
<data name="DonateDescription" xml:space="preserve">
|
||||
<value>Don't forget to reward my work if you like it :)</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonDescription" xml:space="preserve">
|
||||
<value>The update will be downloaded in background, and installed once you exit File Converter.</value>
|
||||
</data>
|
||||
<data name="DownloadAndInstallButtonTitle" xml:space="preserve">
|
||||
<value>Install when I exit File Converter</value>
|
||||
</data>
|
||||
<data name="Encoding" xml:space="preserve">
|
||||
<value>Encoding :</value>
|
||||
</data>
|
||||
<data name="EncodingSpeed" xml:space="preserve">
|
||||
<value>Encoding speed :</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp1" xml:space="preserve">
|
||||
<value>File Converter is a shell extension.</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp2" xml:space="preserve">
|
||||
<value>That means it is integrated into the Windows explorer.</value>
|
||||
</data>
|
||||
<data name="FileConverterStartHelp3" xml:space="preserve">
|
||||
<value>To use File Converter please open the explorer and right-click on any file you like to bring up the context menu where you will find File Converter commands (see the readme file to see the list of compatible file formats).</value>
|
||||
</data>
|
||||
<data name="FileNameTemplate" xml:space="preserve">
|
||||
<value>File name template</value>
|
||||
</data>
|
||||
<data name="FramesPerSecond" xml:space="preserve">
|
||||
<value>Frames per second :</value>
|
||||
</data>
|
||||
<data name="GitHubButtonDescription" xml:space="preserve">
|
||||
<value>Open GitHub project page</value>
|
||||
</data>
|
||||
<data name="Help" xml:space="preserve">
|
||||
<value>help ?</value>
|
||||
</data>
|
||||
<data name="InputExample" xml:space="preserve">
|
||||
<value>Input example</value>
|
||||
</data>
|
||||
<data name="InputFormats" xml:space="preserve">
|
||||
<value>Input formats</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionDeleteName" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionMoveInArchiveFolderName" xml:space="preserve">
|
||||
<value>Move in an archive folder</value>
|
||||
</data>
|
||||
<data name="InputPostConversionActionNoneName" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="InstallButtonDescription" xml:space="preserve">
|
||||
<value>The update has been downloaded. Exit File Converter and install the update now.</value>
|
||||
</data>
|
||||
<data name="InstallButtonTitle" xml:space="preserve">
|
||||
<value>Install when I exit File Converter</value>
|
||||
</data>
|
||||
<data name="IssueButtonDescription" xml:space="preserve">
|
||||
<value>Report an issue</value>
|
||||
</data>
|
||||
<data name="MoveDownSelectedPreset" xml:space="preserve">
|
||||
<value>Move down selected preset</value>
|
||||
</data>
|
||||
<data name="MoveUpSelectedPreset" xml:space="preserve">
|
||||
<value>Move up selected preset</value>
|
||||
</data>
|
||||
<data name="Mp3CbrDescription" xml:space="preserve">
|
||||
<value>Constant bitrate encoding</value>
|
||||
</data>
|
||||
<data name="Mp3VbrDescription" xml:space="preserve">
|
||||
<value>Variable bitrate encoding</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>90°</value>
|
||||
</data>
|
||||
<data name="NinetyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>90° counter clockwise rotation</value>
|
||||
</data>
|
||||
<data name="Ok" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>180°</value>
|
||||
</data>
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>180° rotation</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Music\Artist\Album\Song.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
<value>Output</value>
|
||||
</data>
|
||||
<data name="OutputFilePathTemplateHelp" xml:space="preserve">
|
||||
<value>(p): input file path
|
||||
(f): input filename
|
||||
(o): output extension type
|
||||
(i): input extension type
|
||||
(d0): input parent folder
|
||||
(d1): input sub parent folder
|
||||
...
|
||||
(n:i): page number index
|
||||
(n:c): total page count
|
||||
|
||||
Special paths:
|
||||
(p:d): my documents path
|
||||
(p:m): my music path
|
||||
(p:v): my videos path
|
||||
(p:p): my pictures path
|
||||
|
||||
use maj for uppercase version</value>
|
||||
</data>
|
||||
<data name="OutputFormat" xml:space="preserve">
|
||||
<value>Output format</value>
|
||||
</data>
|
||||
<data name="Preset" xml:space="preserve">
|
||||
<value>Preset</value>
|
||||
</data>
|
||||
<data name="PresetName" xml:space="preserve">
|
||||
<value>Preset Name</value>
|
||||
</data>
|
||||
<data name="Quality" xml:space="preserve">
|
||||
<value>Quality :</value>
|
||||
</data>
|
||||
<data name="RecommendeBitrateRangeInBlue" xml:space="preserve">
|
||||
<value>Recommended bitrate range in blue</value>
|
||||
</data>
|
||||
<data name="RemoveSelectedPreset" xml:space="preserve">
|
||||
<value>Remove selected preset</value>
|
||||
</data>
|
||||
<data name="Rotate" xml:space="preserve">
|
||||
<value>Rotate :</value>
|
||||
</data>
|
||||
<data name="Save" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name="Scale" xml:space="preserve">
|
||||
<value>Scale :</value>
|
||||
</data>
|
||||
<data name="SeeChangeLog" xml:space="preserve">
|
||||
<value>See change log ...</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="SettingsButtonTitle" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTitle" xml:space="preserve">
|
||||
<value>270°</value>
|
||||
</data>
|
||||
<data name="TwoSeventyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>90° clockwise rotation</value>
|
||||
</data>
|
||||
<data name="UpgradeAvailable" xml:space="preserve">
|
||||
<value>An update for File Converter is available. It is strongly recommended that you install it as soon as possible!</value>
|
||||
</data>
|
||||
<data name="UpgradeDownloadInProgress" xml:space="preserve">
|
||||
<value>Upgrade download in progress...</value>
|
||||
</data>
|
||||
<data name="UpgradeWindowTitle" xml:space="preserve">
|
||||
<value>File Converter Updates</value>
|
||||
</data>
|
||||
<data name="VideoEncodingQualityTooltip" xml:space="preserve">
|
||||
<value>Define the ratio 'file size' versus 'video quality'. A lower value will give you a smaller file, a greater value give you a better video quality.</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFasterName" xml:space="preserve">
|
||||
<value>Faster</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedFastName" xml:space="preserve">
|
||||
<value>Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedMediumName" xml:space="preserve">
|
||||
<value>Medium</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowerName" xml:space="preserve">
|
||||
<value>Slower</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSlowName" xml:space="preserve">
|
||||
<value>Slow</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedSuperFastName" xml:space="preserve">
|
||||
<value>Super Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedTooltip" xml:space="preserve">
|
||||
<value>Define the ratio 'file size' versus 'compression duration'. A slow compression will give you a smaller file (for the same video quality) than a faster compression.</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedUltraFastName" xml:space="preserve">
|
||||
<value>Ultra Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVeryFastName" xml:space="preserve">
|
||||
<value>Very Fast</value>
|
||||
</data>
|
||||
<data name="VideoEncodingSpeedVerySlowName" xml:space="preserve">
|
||||
<value>Very Slow</value>
|
||||
</data>
|
||||
<data name="VideoTitle" xml:space="preserve">
|
||||
<value>Video</value>
|
||||
</data>
|
||||
<data name="Wav16bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 16-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav24bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 24-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav32bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 32-bit little-endian</value>
|
||||
</data>
|
||||
<data name="Wav8bitsDescription" xml:space="preserve">
|
||||
<value>PCM signed 8-bit little-endian</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTitle" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="ZeroDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>No rotation</value>
|
||||
</data>
|
||||
<data name="ConversionStateConversion" xml:space="preserve">
|
||||
<value>Conversion</value>
|
||||
</data>
|
||||
<data name="ConversionStateDone" xml:space="preserve">
|
||||
<value>Done</value>
|
||||
</data>
|
||||
<data name="ConversionStateExtraction" xml:space="preserve">
|
||||
<value>Extraction</value>
|
||||
</data>
|
||||
<data name="ConversionStateFailed" xml:space="preserve">
|
||||
<value>Failed</value>
|
||||
</data>
|
||||
<data name="ConversionStateInQueue" xml:space="preserve">
|
||||
<value>In queue</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadIntputImage" xml:space="preserve">
|
||||
<value>Read input image</value>
|
||||
</data>
|
||||
<data name="ConversionStateReadDocument" xml:space="preserve">
|
||||
<value>Read document</value>
|
||||
</data>
|
||||
<data name="StringAnimatedImageName" xml:space="preserve">
|
||||
<value>Animated Image</value>
|
||||
</data>
|
||||
<data name="StringAudioName" xml:space="preserve">
|
||||
<value>Audio</value>
|
||||
</data>
|
||||
<data name="StringDocumentName" xml:space="preserve">
|
||||
<value>Document</value>
|
||||
</data>
|
||||
<data name="StringImageName" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="StringVideoName" xml:space="preserve">
|
||||
<value>Video</value>
|
||||
</data>
|
||||
<data name="ExitWaitingDuration" xml:space="preserve">
|
||||
<value>Waiting duration before application exit</value>
|
||||
</data>
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="MaximumNumberOfSimultaneousConversions" xml:space="preserve">
|
||||
<value>Maximum number of simultaneous conversions</value>
|
||||
</data>
|
||||
<data name="DefaultPresetName" xml:space="preserve">
|
||||
<value>New preset</value>
|
||||
</data>
|
||||
<data name="DownloadingChangeLog" xml:space="preserve">
|
||||
<value>###Downloading change log ...</value>
|
||||
</data>
|
||||
<data name="ConversionArchives" xml:space="preserve">
|
||||
<value>Conversion Archives</value>
|
||||
</data>
|
||||
<data name="ErrorCanceled" xml:space="preserve">
|
||||
<value>Canceled.</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindFFMPEG" xml:space="preserve">
|
||||
<value>Fail to find ffmpeg executable. You should try to reinstall the application.</value>
|
||||
</data>
|
||||
<data name="ErrorCDAExtractionFailed" xml:space="preserve">
|
||||
<value>Audio CD track extraction failed.</value>
|
||||
</data>
|
||||
<data name="ErrorCDDriveNotReady" xml:space="preserve">
|
||||
<value>CD drive is not ready.</value>
|
||||
</data>
|
||||
<data name="ErrorFailedToLaunchFFMPEG" xml:space="preserve">
|
||||
<value>Fail to launch ffmpeg.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToCreateOutputPathFolders" xml:space="preserve">
|
||||
<value>Fail to create output path folders.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToGenerateUniqueOutputPath" xml:space="preserve">
|
||||
<value>Fail to generate a unique output file path.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToReadCDDrive" xml:space="preserve">
|
||||
<value>Fail to read cd drive '{0}'.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveInputPathDriveLetter" xml:space="preserve">
|
||||
<value>Fail to retrieve input path drive letter.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToRetrieveTrackNumber" xml:space="preserve">
|
||||
<value>Fail to retrieve track number from the cda input path.</value>
|
||||
</data>
|
||||
<data name="ErrorFailToUseCDDriveOpen" xml:space="preserve">
|
||||
<value>Fail to use the CD drive because it is oppened.</value>
|
||||
</data>
|
||||
<data name="ErrorInputTypeIncompatibleWithOutputType" xml:space="preserve">
|
||||
<value>The input file type is not compatible with the selected output file type.</value>
|
||||
</data>
|
||||
<data name="ErrorInvalidOutputPath" xml:space="preserve">
|
||||
<value>Invalid output path generated by output file path template.</value>
|
||||
</data>
|
||||
<data name="ErrorUnsupportedOutputFormat" xml:space="preserve">
|
||||
<value>Unsupported output format '{0}'.</value>
|
||||
</data>
|
||||
<data name="ChannelCountTitle" xml:space="preserve">
|
||||
<value>Channel count :</value>
|
||||
</data>
|
||||
<data name="ChannelCountTooltip" xml:space="preserve">
|
||||
<value>Change the number of channels of the input file.</value>
|
||||
</data>
|
||||
<data name="MonoOption" xml:space="preserve">
|
||||
<value>Mono</value>
|
||||
</data>
|
||||
<data name="SameChannelCountOption" xml:space="preserve">
|
||||
<value>Same than input file</value>
|
||||
</data>
|
||||
<data name="StereoOption" xml:space="preserve">
|
||||
<value>Stereo</value>
|
||||
</data>
|
||||
<data name="LicenceHeader1" xml:space="preserve">
|
||||
<value>**This program is free software**.</value>
|
||||
</data>
|
||||
<data name="LicenceHeader2" xml:space="preserve">
|
||||
<value>You can redistribute it and/or modify it under the terms of the GNU General Public License.</value>
|
||||
</data>
|
||||
<data name="LicenceHeader3" xml:space="preserve">
|
||||
<value>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the GNU General Public License (available in the installation folder: `LICENSE.md`) for more details.</value>
|
||||
</data>
|
||||
<data name="ApplicationIsTerminating" xml:space="preserve">
|
||||
<value>The application is terminating.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInMultipleSeconds" xml:space="preserve">
|
||||
<value>The application will automatically terminate in {0} seconds.</value>
|
||||
</data>
|
||||
<data name="ApplicationWillTerminateInOneSecond" xml:space="preserve">
|
||||
<value>The application will automatically terminate in 1 second.</value>
|
||||
</data>
|
||||
<data name="StringMiscName" xml:space="preserve">
|
||||
<value>Misc</value>
|
||||
</data>
|
||||
<data name="ErrorCantFindOutputFiles" xml:space="preserve">
|
||||
<value>Can't find the output file(s).</value>
|
||||
</data>
|
||||
<data name="ErrorConversionFailedWithOutput" xml:space="preserve">
|
||||
<value>The conversion job failed but there is an output file that does exists.</value>
|
||||
</data>
|
||||
<data name="ConversionStatePrepareConversion" xml:space="preserve">
|
||||
<value>Prepare conversion</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftOfficeIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Office must be installed in order to convert Office documents.</value>
|
||||
</data>
|
||||
<data name="ErrorUnableToUseMicrosoftOffice" xml:space="preserve">
|
||||
<value>Fail to open document with Microsoft Office (check if your licence/installation is valid).</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftExcelIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Excel must be installed in order to convert Excel documents.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftPowerPointIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft PowerPoint must be installed in order to convert PowerPoint documents.</value>
|
||||
</data>
|
||||
<data name="ErrorMicrosoftWordIsNotAvailable" xml:space="preserve">
|
||||
<value>Microsoft Word must be installed in order to convert Word documents.</value>
|
||||
</data>
|
||||
<data name="WebsiteButtonDescription" xml:space="preserve">
|
||||
<value>Open File Converter website</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,203 @@
|
||||
// <copyright file="Registry.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public class Registry : IDisposable
|
||||
{
|
||||
private static Registry instance;
|
||||
|
||||
private Dictionary<string, string> registryEntries = new Dictionary<string, string>();
|
||||
|
||||
~Registry()
|
||||
{
|
||||
this.Dispose();
|
||||
Registry.instance = null;
|
||||
}
|
||||
|
||||
[XmlElement("Entry")]
|
||||
public Entry[] SerializableEntries
|
||||
{
|
||||
get
|
||||
{
|
||||
Entry[] entries = new Entry[this.registryEntries.Count];
|
||||
int index = 0;
|
||||
foreach (KeyValuePair<string, string> kvp in this.registryEntries)
|
||||
{
|
||||
if (kvp.Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entries[index] = new Entry(kvp.Key, kvp.Value);
|
||||
index++;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.registryEntries.Clear();
|
||||
for (int index = 0; index < value.Length; index++)
|
||||
{
|
||||
Entry entry = value[index];
|
||||
if (entry.Key == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.registryEntries.ContainsKey(entry.Key))
|
||||
{
|
||||
Diagnostics.Debug.Log("Ignore registry entry {0}.", entry.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.registryEntries.Add(entry.Key, entry.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Registry Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Registry.instance == null)
|
||||
{
|
||||
Registry.Load();
|
||||
}
|
||||
|
||||
return Registry.instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static T GetValue<T>(string key)
|
||||
{
|
||||
Registry registry = Registry.Instance;
|
||||
|
||||
string stringValue;
|
||||
if (!registry.registryEntries.TryGetValue(key, out stringValue))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
object value = System.Convert.ChangeType(stringValue, typeof(T));
|
||||
return (T)value;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Can't convert registry value: {0}.", exception.Message);
|
||||
}
|
||||
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public static void SetValue<T>(string key, T value)
|
||||
{
|
||||
Registry registry = Registry.Instance;
|
||||
|
||||
if (!registry.registryEntries.ContainsKey(key))
|
||||
{
|
||||
registry.registryEntries.Add(key, null);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string stringValue = (string)System.Convert.ChangeType(value, typeof(string));
|
||||
registry.registryEntries[key] = stringValue;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Can't convert registry value: {0}.", exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// SAVE
|
||||
string registryFilePath = Registry.GetUserRegistryFilePath();
|
||||
|
||||
try
|
||||
{
|
||||
XmlHelpers.SaveToFile("Registry", registryFilePath, this);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Fail to save registry. {0}", exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Load()
|
||||
{
|
||||
string registryFilePath = Registry.GetUserRegistryFilePath();
|
||||
if (!File.Exists(registryFilePath))
|
||||
{
|
||||
Registry.instance = new Registry();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Registry.instance = null;
|
||||
XmlHelpers.LoadFromFile<Registry>("Registry", registryFilePath, out Registry.instance);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Registry.instance = new Registry();
|
||||
Diagnostics.Debug.LogError("Fail to load registry. {0}", exception.Message);
|
||||
while (exception.InnerException != null)
|
||||
{
|
||||
exception = exception.InnerException;
|
||||
Diagnostics.Debug.LogError("Inner exception: {0}", exception.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetUserRegistryFilePath()
|
||||
{
|
||||
string path = PathHelpers.GetUserDataFolderPath();
|
||||
path = Path.Combine(path, "Registry.xml");
|
||||
return path;
|
||||
}
|
||||
|
||||
[XmlRoot("Entry")]
|
||||
public struct Entry
|
||||
{
|
||||
public Entry(string key, string value)
|
||||
{
|
||||
this.Key = key;
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string Key
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlText]
|
||||
public string Value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Keys
|
||||
{
|
||||
public static readonly string LastUpdateCheckDate = "LastUpdateCheckDate";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 294 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 551 B |
|
After Width: | Height: | Size: 376 KiB |
|
After Width: | Height: | Size: 625 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,75 @@
|
||||
// // <copyright file="Settings.Migration.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
|
||||
using FileConverter.ConversionJobs;
|
||||
|
||||
public partial class Settings
|
||||
{
|
||||
private static void MigrateSettingsToCurrentVersion(Settings settings)
|
||||
{
|
||||
int settingsVersion = settings.SerializationVersion;
|
||||
|
||||
// Migrate conversion settings.
|
||||
if (settings.ConversionPresets != null)
|
||||
{
|
||||
foreach (ConversionPreset conversionPreset in settings.ConversionPresets)
|
||||
{
|
||||
Settings.MigrateConversionPresetToCurrentVersion(conversionPreset, settingsVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void MigrateConversionPresetToCurrentVersion(ConversionPreset preset, int settingsVersion)
|
||||
{
|
||||
if (settingsVersion <= 2)
|
||||
{
|
||||
// Migrate video encoding speed.
|
||||
string videoEncodingSpeed = preset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed);
|
||||
if (videoEncodingSpeed != null)
|
||||
{
|
||||
VideoEncodingSpeed encodingSpeed;
|
||||
if (!Enum.TryParse(videoEncodingSpeed, out encodingSpeed))
|
||||
{
|
||||
switch (videoEncodingSpeed)
|
||||
{
|
||||
case "Ultra Fast":
|
||||
preset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, VideoEncodingSpeed.UltraFast.ToString());
|
||||
break;
|
||||
|
||||
case "Super Fast":
|
||||
preset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, VideoEncodingSpeed.SuperFast.ToString());
|
||||
break;
|
||||
|
||||
case "Very Fast":
|
||||
preset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, VideoEncodingSpeed.VeryFast.ToString());
|
||||
break;
|
||||
|
||||
case "Very Slow":
|
||||
preset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed, VideoEncodingSpeed.VerySlow.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsVersion <= 3)
|
||||
{
|
||||
// Try to fix corrupted settings (GitHub issue #5).
|
||||
string scale = preset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale);
|
||||
if (scale != null)
|
||||
{
|
||||
preset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale, scale.Replace(',', '.'));
|
||||
}
|
||||
|
||||
scale = preset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale);
|
||||
if (scale != null)
|
||||
{
|
||||
preset.SetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale, scale.Replace(',', '.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
// <copyright file="Settings.Settings.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public partial class Settings : IXmlSerializable
|
||||
{
|
||||
public const int Version = 4;
|
||||
|
||||
private bool exitApplicationWhenConversionsFinished = true;
|
||||
private float durationBetweenEndOfConversionsAndApplicationExit = 3f;
|
||||
private ObservableCollection<ConversionPreset> conversionPresets = new ObservableCollection<ConversionPreset>();
|
||||
private bool checkUpgradeAtStartup = true;
|
||||
private CultureInfo applicationLanguage;
|
||||
private int maximumNumberOfSimultaneousConversions;
|
||||
|
||||
[XmlAttribute]
|
||||
public int SerializationVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = Version;
|
||||
|
||||
[XmlIgnore]
|
||||
public CultureInfo ApplicationLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.applicationLanguage;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.applicationLanguage != null && this.applicationLanguage.Equals(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.applicationLanguage = value;
|
||||
if (this.applicationLanguage != null)
|
||||
{
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = this.applicationLanguage;
|
||||
System.Threading.Thread.CurrentThread.CurrentUICulture = this.applicationLanguage;
|
||||
}
|
||||
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public string ApplicationLanguageName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.ApplicationLanguage == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return this.ApplicationLanguage.Name;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
this.ApplicationLanguage = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.ApplicationLanguage = CultureInfo.GetCultureInfo(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public ObservableCollection<ConversionPreset> ConversionPresets
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.conversionPresets;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.conversionPresets = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public bool ExitApplicationWhenConversionsFinished
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.exitApplicationWhenConversionsFinished;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.exitApplicationWhenConversionsFinished = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public float DurationBetweenEndOfConversionsAndApplicationExit
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.durationBetweenEndOfConversionsAndApplicationExit;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.durationBetweenEndOfConversionsAndApplicationExit = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public int MaximumNumberOfSimultaneousConversions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.maximumNumberOfSimultaneousConversions;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.maximumNumberOfSimultaneousConversions = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("ConversionPreset")]
|
||||
public ConversionPreset[] SerializableConversionPresets
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ConversionPresets.ToArray();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
for (int index = 0; index < value.Length; index++)
|
||||
{
|
||||
this.ConversionPresets.Add(value[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public bool CheckUpgradeAtStartup
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.checkUpgradeAtStartup;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.checkUpgradeAtStartup = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDeserializationComplete()
|
||||
{
|
||||
this.DurationBetweenEndOfConversionsAndApplicationExit = System.Math.Max(0, System.Math.Min(10, this.DurationBetweenEndOfConversionsAndApplicationExit));
|
||||
|
||||
for (int index = 0; index < this.ConversionPresets.Count; index++)
|
||||
{
|
||||
this.ConversionPresets[index].OnDeserializationComplete();
|
||||
}
|
||||
|
||||
// Initialize application if it was not deserialized from the settings.
|
||||
if (this.ApplicationLanguage == null)
|
||||
{
|
||||
CultureInfo bestCandidate = null;
|
||||
CultureInfo currentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
|
||||
foreach (CultureInfo culture in Helpers.GetSupportedCultures())
|
||||
{
|
||||
if (culture.Equals(currentUICulture))
|
||||
{
|
||||
bestCandidate = culture;
|
||||
break;
|
||||
}
|
||||
else if (culture.Equals(currentUICulture.Parent))
|
||||
{
|
||||
bestCandidate = culture;
|
||||
}
|
||||
}
|
||||
|
||||
if (bestCandidate != null)
|
||||
{
|
||||
this.ApplicationLanguage = bestCandidate;
|
||||
}
|
||||
else
|
||||
{
|
||||
Diagnostics.Debug.Log("Can't find supported culture info for culture {0}. Fallback to default culture.", currentUICulture);
|
||||
this.ApplicationLanguage = CultureInfo.GetCultureInfo("en");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,505 @@
|
||||
// <copyright file="Settings.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Principal;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
using Microsoft.Win32;
|
||||
|
||||
[XmlRoot]
|
||||
[XmlType]
|
||||
public partial class Settings : INotifyPropertyChanged, IDataErrorInfo
|
||||
{
|
||||
private const char PresetSeparator = ';';
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[XmlIgnore]
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int index = 0; index < this.ConversionPresets.Count; index++)
|
||||
{
|
||||
string error = this.ConversionPresets[index].Error;
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsInAdmininstratorPrivileges
|
||||
{
|
||||
get
|
||||
{
|
||||
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Error;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ApplyTemporarySettings()
|
||||
{
|
||||
// Load temporary settings.
|
||||
string temporaryFilePath = Settings.GetUserSettingsTemporaryFilePath();
|
||||
if (!File.Exists(temporaryFilePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Settings settings = null;
|
||||
XmlHelpers.LoadFromFile("Settings", temporaryFilePath, out settings);
|
||||
|
||||
RegistryKey registryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\FileConverter");
|
||||
if (registryKey == null)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Can't apply settings in registry. (code 0x03)");
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute the registry entries data from settings.
|
||||
Dictionary<string, List<string>> registryEntries = ComputeRegistryEntriesFromConvertionPresets(settings.ConversionPresets);
|
||||
|
||||
bool succeed = Settings.ApplyRegistryModifications(registryEntries);
|
||||
|
||||
if (succeed)
|
||||
{
|
||||
// Copy temporary settings file to the real settings file.
|
||||
string userFilePath = Settings.GetUserSettingsFilePath();
|
||||
File.Copy(temporaryFilePath, userFilePath, true);
|
||||
File.Delete(temporaryFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PostInstallationInitialization()
|
||||
{
|
||||
Settings defaultSettings = null;
|
||||
|
||||
// Load the default settings.
|
||||
string defaultFilePath = Settings.GetDefaultSettingsFilePath();
|
||||
if (File.Exists(defaultFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlHelpers.LoadFromFile<Settings>("Settings", defaultFilePath, out defaultSettings);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Fail to load file converter default settings. {0}", exception.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Diagnostics.Debug.LogError("Default settings not found at path {0}. You should try to reinstall the application.", defaultFilePath);
|
||||
}
|
||||
|
||||
// Load user settings if exists.
|
||||
Settings userSettings = null;
|
||||
string userFilePath = Settings.GetUserSettingsFilePath();
|
||||
if (File.Exists(userFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlHelpers.LoadFromFile<Settings>("Settings", userFilePath, out userSettings);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
System.IO.File.Delete(userFilePath);
|
||||
}
|
||||
|
||||
if (userSettings != null)
|
||||
{
|
||||
if (userSettings.SerializationVersion != Version)
|
||||
{
|
||||
Settings.MigrateSettingsToCurrentVersion(userSettings);
|
||||
|
||||
Diagnostics.Debug.Log("File converter settings have been imported from version {0} to version {1}.", userSettings.SerializationVersion, Version);
|
||||
userSettings.SerializationVersion = Version;
|
||||
}
|
||||
|
||||
// Remove default settings.
|
||||
if (userSettings.ConversionPresets != null)
|
||||
{
|
||||
for (int index = userSettings.ConversionPresets.Count - 1; index >= 0; index--)
|
||||
{
|
||||
if (userSettings.ConversionPresets[index].IsDefaultSettings)
|
||||
{
|
||||
userSettings.ConversionPresets.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Settings settings = userSettings != null ? userSettings.Merge(defaultSettings) : defaultSettings;
|
||||
settings.Save();
|
||||
}
|
||||
|
||||
public static Settings Load()
|
||||
{
|
||||
Settings settings = null;
|
||||
string userFilePath = Settings.GetUserSettingsFilePath();
|
||||
if (File.Exists(userFilePath))
|
||||
{
|
||||
Settings userSettings = null;
|
||||
try
|
||||
{
|
||||
XmlHelpers.LoadFromFile<Settings>("Settings", userFilePath, out userSettings);
|
||||
settings = userSettings;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBoxResult messageBoxResult =
|
||||
MessageBox.Show(
|
||||
"Can't load file converter user settings. Do you want to fall back to default settings ?",
|
||||
"Error",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Exclamation);
|
||||
|
||||
if (messageBoxResult == MessageBoxResult.Yes)
|
||||
{
|
||||
System.IO.File.Delete(userFilePath);
|
||||
return Settings.Load();
|
||||
}
|
||||
else if (messageBoxResult == MessageBoxResult.No)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (userSettings != null && userSettings.SerializationVersion != Version)
|
||||
{
|
||||
Settings.MigrateSettingsToCurrentVersion(userSettings);
|
||||
|
||||
Diagnostics.Debug.Log("File converter settings has been imported from version {0} to version {1}.", userSettings.SerializationVersion, Version);
|
||||
userSettings.SerializationVersion = Version;
|
||||
userSettings.Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the default settings.
|
||||
string defaultFilePath = Settings.GetDefaultSettingsFilePath();
|
||||
if (File.Exists(defaultFilePath))
|
||||
{
|
||||
Settings defaultSettings = null;
|
||||
try
|
||||
{
|
||||
XmlHelpers.LoadFromFile<Settings>("Settings", defaultFilePath, out defaultSettings);
|
||||
settings = defaultSettings;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Fail to load file converter default settings. {0}", exception.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Diagnostics.Debug.LogError("Default settings not found at path {0}. You should try to reinstall the application.", defaultFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public ConversionPreset GetPresetFromName(string presetName)
|
||||
{
|
||||
return this.conversionPresets.FirstOrDefault(match => match.Name == presetName);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
this.Clean();
|
||||
|
||||
// Save the settings in a temporary files (we'll write the settings file when we'll succeed to write the registry keys).
|
||||
string temporaryFilePath = Settings.GetUserSettingsTemporaryFilePath();
|
||||
XmlHelpers.SaveToFile("Settings", temporaryFilePath, this);
|
||||
|
||||
// Compute the registry entries data from settings.
|
||||
Dictionary<string, List<string>> registryEntries = Settings.ComputeRegistryEntriesFromConvertionPresets(this.ConversionPresets);
|
||||
|
||||
// Detect if existing registry configuration need to be modified.
|
||||
bool registryNeedModifications = Settings.IsRegistryNeedModifications(registryEntries);
|
||||
|
||||
if (registryNeedModifications)
|
||||
{
|
||||
// Write the settings in registry.
|
||||
if (Settings.IsInAdmininstratorPrivileges)
|
||||
{
|
||||
// We are in admin mode, write registry ...
|
||||
bool succeed = Settings.ApplyRegistryModifications(registryEntries);
|
||||
if (succeed)
|
||||
{
|
||||
// ... and copy temporary settings file to the real settings file.
|
||||
string userFilePath = Settings.GetUserSettingsFilePath();
|
||||
File.Copy(temporaryFilePath, userFilePath, true);
|
||||
File.Delete(temporaryFilePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Run the application in admin mode in order to perform modifications.
|
||||
Settings.RunSaveInAdminMode();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy temporary settings file to the real settings file.
|
||||
string userFilePath = Settings.GetUserSettingsFilePath();
|
||||
File.Copy(temporaryFilePath, userFilePath, true);
|
||||
File.Delete(temporaryFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
for (int index = 0; index < this.ConversionPresets.Count; index++)
|
||||
{
|
||||
this.ConversionPresets[index].Clean();
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ApplyRegistryModifications(Dictionary<string, List<string>> registryEntries)
|
||||
{
|
||||
if (!Settings.IsInAdmininstratorPrivileges)
|
||||
{
|
||||
MessageBox.Show("Can't apply settings in registry because the application is not in administrator privileges. (code 0x04)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
RegistryKey registryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\FileConverter", RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
if (registryKey == null)
|
||||
{
|
||||
MessageBox.Show("Can't apply settings in registry. (code 0x05)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete previous settings.
|
||||
string[] subKeyNames = registryKey.GetSubKeyNames();
|
||||
for (int index = 0; index < subKeyNames.Length; index++)
|
||||
{
|
||||
try
|
||||
{
|
||||
registryKey.DeleteSubKey(subKeyNames[index]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("Can't apply settings in registry. (code 0x06)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply settings in registry.
|
||||
foreach (KeyValuePair<string, List<string>> registryEntry in registryEntries)
|
||||
{
|
||||
string presets = string.Empty;
|
||||
for (int index = 0; index < registryEntry.Value.Count; index++)
|
||||
{
|
||||
if (index > 0)
|
||||
{
|
||||
presets += ";";
|
||||
}
|
||||
|
||||
presets += registryEntry.Value[index];
|
||||
}
|
||||
|
||||
RegistryKey subKey = null;
|
||||
try
|
||||
{
|
||||
subKey = registryKey.CreateSubKey(registryEntry.Key);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Diagnostics.Debug.Log(exception.Message);
|
||||
}
|
||||
|
||||
if (subKey == null)
|
||||
{
|
||||
MessageBox.Show("Can't apply settings in registry. (code 0x07)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
subKey.SetValue("Presets", presets);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Dictionary<string, List<string>> ComputeRegistryEntriesFromConvertionPresets(ICollection<ConversionPreset> conversionPresets)
|
||||
{
|
||||
Dictionary<string, List<string>> registryEntries = new Dictionary<string, List<string>>();
|
||||
|
||||
foreach (ConversionPreset conversionPreset in conversionPresets)
|
||||
{
|
||||
List<string> inputTypes = conversionPreset.InputTypes;
|
||||
for (int inputIndex = 0; inputIndex < inputTypes.Count; inputIndex++)
|
||||
{
|
||||
string inputType = inputTypes[inputIndex].ToLowerInvariant();
|
||||
if (!registryEntries.ContainsKey(inputType))
|
||||
{
|
||||
registryEntries.Add(inputType, new List<string>());
|
||||
}
|
||||
|
||||
registryEntries[inputType].Add(conversionPreset.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return registryEntries;
|
||||
}
|
||||
|
||||
private static string GetDefaultSettingsFilePath()
|
||||
{
|
||||
string path = Assembly.GetEntryAssembly().Location;
|
||||
path = Path.GetDirectoryName(path);
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
path = Path.Combine(path, "Settings.default.xml");
|
||||
return path;
|
||||
}
|
||||
|
||||
private static string GetUserSettingsFilePath()
|
||||
{
|
||||
string path = PathHelpers.GetUserDataFolderPath();
|
||||
path = Path.Combine(path, "Settings.user.xml");
|
||||
return path;
|
||||
}
|
||||
|
||||
private static string GetUserSettingsTemporaryFilePath()
|
||||
{
|
||||
string path = PathHelpers.GetUserDataFolderPath();
|
||||
path = Path.Combine(path, "Settings.temp.xml");
|
||||
return path;
|
||||
}
|
||||
|
||||
private static bool IsRegistryNeedModifications(Dictionary<string, List<string>> registryEntries)
|
||||
{
|
||||
// Compare to registry entries.
|
||||
RegistryKey registryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\FileConverter");
|
||||
if (registryKey == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
string[] subKeyNames = registryKey.GetSubKeyNames();
|
||||
if (subKeyNames.Length == registryEntries.Count)
|
||||
{
|
||||
for (int index = 0; index < subKeyNames.Length; index++)
|
||||
{
|
||||
string subKeyName = subKeyNames[index];
|
||||
if (!registryEntries.ContainsKey(subKeyName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
List<string> presetsList = registryEntries[subKeyName];
|
||||
|
||||
RegistryKey subKey = registryKey.OpenSubKey(subKeyName);
|
||||
if (subKey == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
string presetsString = subKey.GetValue("Presets", string.Empty) as string;
|
||||
string[] presets = presetsString != null ? presetsString.Split(Settings.PresetSeparator) : new string[0];
|
||||
if (presets.Length != presetsList.Count)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int presetIndex = 0; presetIndex < presets.Length; presetIndex++)
|
||||
{
|
||||
if (presetsList[presetIndex] != presets[presetIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void RunSaveInAdminMode()
|
||||
{
|
||||
ProcessStartInfo processStartInfo = new ProcessStartInfo(Assembly.GetEntryAssembly().Location, "--apply-settings")
|
||||
{
|
||||
UseShellExecute = true,
|
||||
Verb = "runas", // indicates to elevate privileges
|
||||
};
|
||||
|
||||
Process process = new Process
|
||||
{
|
||||
EnableRaisingEvents = true, // enable WaitForExit()
|
||||
StartInfo = processStartInfo
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("Can't apply settings in registry because the application has no administrator privileges. (code 0x08)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private Settings Merge(Settings settings)
|
||||
{
|
||||
if (settings == null || settings.conversionPresets == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
for (int index = 0; index < settings.conversionPresets.Count; index++)
|
||||
{
|
||||
ConversionPreset conversionPreset = settings.conversionPresets[index];
|
||||
if (this.conversionPresets.Any(match => match.Name == conversionPreset.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
this.conversionPresets.Add(conversionPreset);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,613 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SerializationVersion="4">
|
||||
<ExitApplicationWhenConversionsFinished>true</ExitApplicationWhenConversionsFinished>
|
||||
<DurationBetweenEndOfConversionsAndApplicationExit>3</DurationBetweenEndOfConversionsAndApplicationExit>
|
||||
<MaximumNumberOfSimultaneousConversions>2</MaximumNumberOfSimultaneousConversions>
|
||||
<ConversionPreset Name="To Mkv" OutputType="Mkv" IsDefaultSettings="true">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp4" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp4 (low quality)" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="20" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="96" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp4 (rotate left)" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp4 (rotate right)" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Webm" OutputType="Webm" IsDefaultSettings="true">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<Settings Key="VideoQuality" Value="40" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Ogv" OutputType="Ogv" IsDefaultSettings="true">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="8" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Avi" OutputType="Avi" IsDefaultSettings="true">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="27" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="190" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Gif" OutputType="Gif" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="VideoFramesPerSecond" Value="15" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Gif (low quality)" OutputType="Gif" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="VideoScale" Value="0.75" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="VideoFramesPerSecond" Value="10" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Ogg" OutputType="Ogg" IsDefaultSettings="true">
|
||||
<InputTypes>aac</InputTypes>
|
||||
<InputTypes>aiff</InputTypes>
|
||||
<InputTypes>ape</InputTypes>
|
||||
<InputTypes>flac</InputTypes>
|
||||
<InputTypes>m4a</InputTypes>
|
||||
<InputTypes>mp3</InputTypes>
|
||||
<InputTypes>wma</InputTypes>
|
||||
<InputTypes>wav</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>oga</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Flac" OutputType="Flac" IsDefaultSettings="true">
|
||||
<InputTypes>wav</InputTypes>
|
||||
<InputTypes>ape</InputTypes>
|
||||
<InputTypes>wma</InputTypes>
|
||||
<InputTypes>aiff</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Wav" OutputType="Wav" IsDefaultSettings="true">
|
||||
<InputTypes>aac</InputTypes>
|
||||
<InputTypes>aiff</InputTypes>
|
||||
<InputTypes>ape</InputTypes>
|
||||
<InputTypes>flac</InputTypes>
|
||||
<InputTypes>m4a</InputTypes>
|
||||
<InputTypes>mp3</InputTypes>
|
||||
<InputTypes>ogg</InputTypes>
|
||||
<InputTypes>wma</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>oga</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioEncodingMode" Value="Wav16" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp3" OutputType="Mp3" IsDefaultSettings="true">
|
||||
<InputTypes>aac</InputTypes>
|
||||
<InputTypes>aiff</InputTypes>
|
||||
<InputTypes>ape</InputTypes>
|
||||
<InputTypes>flac</InputTypes>
|
||||
<InputTypes>m4a</InputTypes>
|
||||
<InputTypes>ogg</InputTypes>
|
||||
<InputTypes>wma</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>wav</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>oga</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioEncodingMode" Value="Mp3VBR" />
|
||||
<Settings Key="AudioBitrate" Value="190" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Aac" OutputType="Aac" IsDefaultSettings="true">
|
||||
<InputTypes>aiff</InputTypes>
|
||||
<InputTypes>ape</InputTypes>
|
||||
<InputTypes>m4a</InputTypes>
|
||||
<InputTypes>mp3</InputTypes>
|
||||
<InputTypes>ogg</InputTypes>
|
||||
<InputTypes>wma</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>wav</InputTypes>
|
||||
<InputTypes>flac</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>oga</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioBitrate" Value="128" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract DVD to Mp4" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>vob</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p:v)DVD Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract DVD to Mkv" OutputType="Mkv" IsDefaultSettings="true">
|
||||
<InputTypes>vob</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p:v)DVD Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract DVD to Flac" OutputType="Flac" IsDefaultSettings="true">
|
||||
<InputTypes>vob</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p:m)DVD Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract DVD to Ogg" OutputType="Ogg" IsDefaultSettings="true">
|
||||
<InputTypes>vob</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioBitrate" Value="192" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p:m)DVD Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract DVD to Mp3" OutputType="Mp3" IsDefaultSettings="true">
|
||||
<InputTypes>vob</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioEncodingMode" Value="Mp3VBR" />
|
||||
<Settings Key="AudioBitrate" Value="225" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p:m)DVD Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract CDA to Flac" OutputType="Flac" IsDefaultSettings="true">
|
||||
<InputTypes>cda</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p:m)CDA Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract CDA to Ogg" OutputType="Ogg" IsDefaultSettings="true">
|
||||
<InputTypes>cda</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioBitrate" Value="192" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p:m)CDA Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Extract CDA to Mp3" OutputType="Mp3" IsDefaultSettings="true">
|
||||
<InputTypes>cda</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="AudioEncodingMode" Value="Mp3VBR" />
|
||||
<Settings Key="AudioBitrate" Value="225" />
|
||||
<Settings Key="AudioChannelCount" Value="0" />
|
||||
<OutputFileNameTemplate>(p:m)CDA Extraction\(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Png" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Png (paged)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>doc</InputTypes>
|
||||
<InputTypes>docx</InputTypes>
|
||||
<InputTypes>odp</InputTypes>
|
||||
<InputTypes>ods</InputTypes>
|
||||
<InputTypes>odt</InputTypes>
|
||||
<InputTypes>pdf</InputTypes>
|
||||
<InputTypes>ppt</InputTypes>
|
||||
<InputTypes>pptx</InputTypes>
|
||||
<InputTypes>xls</InputTypes>
|
||||
<InputTypes>xlsx</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f) (n:i) of (n:c)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Webp" OutputType="Webp" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To small Png (25%)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="0.25" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)-small</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Png (rotate left)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="90" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Png (rotate right)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="270" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Jpg" OutputType="Jpg" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Ico" OutputType="Ico" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Pdf" OutputType="Pdf" IsDefaultSettings="true">
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputTypes>doc</InputTypes>
|
||||
<InputTypes>docx</InputTypes>
|
||||
<InputTypes>odp</InputTypes>
|
||||
<InputTypes>ods</InputTypes>
|
||||
<InputTypes>odt</InputTypes>
|
||||
<InputTypes>ppt</InputTypes>
|
||||
<InputTypes>pptx</InputTypes>
|
||||
<InputTypes>xls</InputTypes>
|
||||
<InputTypes>xlsx</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<CheckUpgradeAtStartup>true</CheckUpgradeAtStartup>
|
||||
</Settings>
|
||||
@@ -0,0 +1,156 @@
|
||||
// <copyright file="Helpers.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Upgrade
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public static class Helpers
|
||||
{
|
||||
#if DEBUG
|
||||
private const string BaseURI = "https://raw.githubusercontent.com/Tichau/FileConverter/development/";
|
||||
#else
|
||||
private const string BaseURI = "https://raw.githubusercontent.com/Tichau/FileConverter/master/";
|
||||
#endif
|
||||
|
||||
private static WebClient webClient = new WebClient();
|
||||
private static UpgradeVersionDescription currentlyDownloadedVersionDescription;
|
||||
|
||||
public delegate void OnUpgradeOperationCompletedEventHandler(UpgradeVersionDescription upgradeVersionDescription);
|
||||
|
||||
public static async Task<UpgradeVersionDescription> GetLatestVersionDescriptionAsync(OnUpgradeOperationCompletedEventHandler onGetCompleteDelegate = null)
|
||||
{
|
||||
#if BUILD32
|
||||
Uri uri = new Uri(Helpers.BaseURI + "version (x86).xml");
|
||||
#else
|
||||
Uri uri = new Uri(Helpers.BaseURI + "version.xml");
|
||||
#endif
|
||||
|
||||
Stream stream = await Helpers.webClient.OpenReadTaskAsync(uri);
|
||||
|
||||
UpgradeVersionDescription upgradeVersionDescription = null;
|
||||
try
|
||||
{
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute
|
||||
{
|
||||
ElementName = "Version"
|
||||
};
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(UpgradeVersionDescription), xmlRoot);
|
||||
|
||||
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings
|
||||
{
|
||||
IgnoreWhitespace = true,
|
||||
IgnoreComments = true
|
||||
};
|
||||
|
||||
using (XmlReader xmlReader = XmlReader.Create(stream, xmlReaderSettings))
|
||||
{
|
||||
upgradeVersionDescription = (UpgradeVersionDescription)serializer.Deserialize(xmlReader);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Error while retrieving change log.");
|
||||
return null;
|
||||
}
|
||||
|
||||
onGetCompleteDelegate?.Invoke(upgradeVersionDescription);
|
||||
|
||||
return upgradeVersionDescription;
|
||||
}
|
||||
|
||||
public static async Task<string> GetChangeLogAsync(UpgradeVersionDescription upgradeVersionDescription, OnUpgradeOperationCompletedEventHandler onGetCompleteDelegate = null)
|
||||
{
|
||||
if (upgradeVersionDescription == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(upgradeVersionDescription));
|
||||
}
|
||||
|
||||
Uri uri = new Uri(Helpers.BaseURI + "CHANGELOG.md");
|
||||
Stream stream = await Helpers.webClient.OpenReadTaskAsync(uri);
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
upgradeVersionDescription.ChangeLog = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Error while retrieving change log.");
|
||||
return null;
|
||||
}
|
||||
|
||||
onGetCompleteDelegate?.Invoke(upgradeVersionDescription);
|
||||
|
||||
return upgradeVersionDescription.ChangeLog;
|
||||
}
|
||||
|
||||
public static async Task DownloadInstallerAsync(UpgradeVersionDescription upgradeVersionDescription)
|
||||
{
|
||||
if (upgradeVersionDescription == null)
|
||||
{
|
||||
throw new ArgumentNullException("upgradeVersionDescription");
|
||||
}
|
||||
|
||||
if (Helpers.currentlyDownloadedVersionDescription != null)
|
||||
{
|
||||
throw new Exception("The installer download is currently in progress.");
|
||||
}
|
||||
|
||||
Uri uri = new Uri(upgradeVersionDescription.InstallerURL);
|
||||
|
||||
string fileName = "FileConverter-setup.msi";
|
||||
Regex retrieveFileNameRegex = new Regex("/([^/]*)");
|
||||
MatchCollection matchCollection = retrieveFileNameRegex.Matches(upgradeVersionDescription.InstallerURL);
|
||||
if (matchCollection.Count > 0)
|
||||
{
|
||||
Match match = matchCollection[matchCollection.Count - 1];
|
||||
if (match.Groups.Count > 1)
|
||||
{
|
||||
fileName = match.Groups[1].Value;
|
||||
}
|
||||
}
|
||||
|
||||
string tempPath = System.IO.Path.GetTempPath();
|
||||
string installerPath = System.IO.Path.Combine(tempPath, fileName);
|
||||
|
||||
upgradeVersionDescription.InstallerPath = installerPath;
|
||||
upgradeVersionDescription.InstallerDownloadInProgress = true;
|
||||
upgradeVersionDescription.InstallerDownloadProgress = 0;
|
||||
|
||||
Helpers.currentlyDownloadedVersionDescription = upgradeVersionDescription;
|
||||
|
||||
Helpers.webClient.DownloadProgressChanged += Helpers.WebClient_DownloadProgressChanged;
|
||||
Helpers.webClient.DownloadFileCompleted += Helpers.WebClient_DownloadFileCompleted;
|
||||
Task downloadTask = Helpers.webClient.DownloadFileTaskAsync(uri, installerPath);
|
||||
}
|
||||
|
||||
private static void WebClient_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
|
||||
{
|
||||
Helpers.webClient.DownloadProgressChanged -= WebClient_DownloadProgressChanged;
|
||||
Helpers.webClient.DownloadFileCompleted -= WebClient_DownloadFileCompleted;
|
||||
|
||||
if (Helpers.currentlyDownloadedVersionDescription != null)
|
||||
{
|
||||
Helpers.currentlyDownloadedVersionDescription.InstallerDownloadProgress = 100;
|
||||
Helpers.currentlyDownloadedVersionDescription.InstallerDownloadInProgress = false;
|
||||
Helpers.currentlyDownloadedVersionDescription = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs eventArgs)
|
||||
{
|
||||
if (Helpers.currentlyDownloadedVersionDescription != null)
|
||||
{
|
||||
Helpers.currentlyDownloadedVersionDescription.InstallerDownloadProgress = eventArgs.ProgressPercentage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// <copyright file="UpgradeVersionDescription.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
|
||||
public class UpgradeVersionDescription : INotifyPropertyChanged
|
||||
{
|
||||
private int installerDownloadProgress;
|
||||
private bool installerDownloadInProgress;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[XmlElement("Latest")]
|
||||
public Version LatestVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlElement("URL")]
|
||||
public string InstallerURL
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string ChangeLog
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string InstallerPath
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool InstallerDownloadInProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.installerDownloadInProgress;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.installerDownloadInProgress = value;
|
||||
this.OnPropertyChanged();
|
||||
this.OnPropertyChanged(nameof(this.InstallerDownloadDone));
|
||||
this.OnPropertyChanged(nameof(this.InstallerDownloadNotStarted));
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public int InstallerDownloadProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.installerDownloadProgress;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.installerDownloadProgress = value;
|
||||
this.OnPropertyChanged();
|
||||
this.OnPropertyChanged(nameof(this.InstallerDownloadDone));
|
||||
this.OnPropertyChanged(nameof(this.InstallerDownloadNotStarted));
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool InstallerDownloadDone
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.InstallerDownloadInProgress && this.InstallerDownloadProgress == 100;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool InstallerDownloadNotStarted
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.InstallerDownloadInProgress && this.InstallerDownloadProgress == 0;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool NeedToUpgrade
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// <copyright file="ApplicationVersionToApplicationName.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ApplicationVersionToApplicationName : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is FileConverter.Version))
|
||||
{
|
||||
return "File Converter";
|
||||
}
|
||||
|
||||
FileConverter.Version version = (FileConverter.Version)value;
|
||||
|
||||
return string.Format("File Converter v{0}", version.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// <copyright file="BitrateToString.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class BitrateToString : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is double))
|
||||
{
|
||||
throw new ArgumentException("The value must be a double value.");
|
||||
}
|
||||
|
||||
double bitrate = (double)value;
|
||||
|
||||
return string.Format("{0} kbit/s", bitrate.ToString("0"));
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// <copyright file="ConversionSettingsToString.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ConversionSettingsToString : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(value is IConversionSettings))
|
||||
{
|
||||
throw new ArgumentException("The value must be a conversion preset array.");
|
||||
}
|
||||
|
||||
IConversionSettings settings = (IConversionSettings)value;
|
||||
|
||||
string parameterString = parameter as string;
|
||||
if (parameterString == null)
|
||||
{
|
||||
throw new ArgumentException("The parameter must be a string value.");
|
||||
}
|
||||
|
||||
string[] parameters = parameterString.Split(',');
|
||||
if (parameters.Length < 1 || parameters.Length > 2)
|
||||
{
|
||||
throw new ArgumentException("The parameter format must be 'SettingsKey[,DefaultValue]'.");
|
||||
}
|
||||
|
||||
string key = parameters[0];
|
||||
string setting;
|
||||
if (settings.TryGetValue(key, out setting))
|
||||
{
|
||||
return setting;
|
||||
}
|
||||
|
||||
if (parameters.Length >= 2)
|
||||
{
|
||||
return parameters[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(value is string))
|
||||
{
|
||||
throw new ArgumentException("value");
|
||||
}
|
||||
|
||||
string settingsValue = (string)value;
|
||||
|
||||
if (!(parameter is string))
|
||||
{
|
||||
throw new ArgumentException("parameter");
|
||||
}
|
||||
|
||||
string settingsKey = (string)parameter;
|
||||
|
||||
return new ConversionSettingsOverride(settingsKey, settingsValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
// <copyright file="ConversionStateToBrush.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
using FileConverter.ConversionJobs;
|
||||
|
||||
public class ConversionStateToBrush : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
@@ -0,0 +1,35 @@
|
||||
// <copyright file="FileNameConverter.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class FileNameConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values == null || values.Length != 3)
|
||||
{
|
||||
throw new ArgumentException("The values must contains the input file path, the output file extension and the ouput file template.");
|
||||
}
|
||||
|
||||
if (!(values[1] is OutputType))
|
||||
{
|
||||
return "Invalid output file extension (argument 1).";
|
||||
}
|
||||
|
||||
string inputFilePath = values[0] as string;
|
||||
OutputType outputFileExtension = (OutputType)values[1];
|
||||
string outputFileTemplate = values[2] as string;
|
||||
|
||||
return PathHelpers.GenerateFilePathFromTemplate(inputFilePath, outputFileExtension, outputFileTemplate, 1, 3);
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// <copyright file="BoolInverterConverter.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class BoolInverterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
{
|
||||
throw new System.ArgumentException("The object must be a boolean value.");
|
||||
}
|
||||
|
||||
bool boolValue = (bool)value;
|
||||
|
||||
return !boolValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// <copyright file="BoolToVisibility.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class BoolToVisibility : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
{
|
||||
throw new ArgumentException("The value must be a boolean.");
|
||||
}
|
||||
|
||||
string stringParameter = parameter as string;
|
||||
|
||||
string falseResult = stringParameter ?? "Hidden";
|
||||
|
||||
bool booleanValue = (bool)value;
|
||||
|
||||
return booleanValue ? "Visible" : falseResult;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// <copyright file="CollectionContainsElementToBool.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class CollectionContainsElementToBool : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values == null || values.Length != 2)
|
||||
{
|
||||
throw new ArgumentException("The values must contains the collection of elements and the researched element.");
|
||||
}
|
||||
|
||||
//// TODO: Make this converter generic.
|
||||
|
||||
if (!(values[0] is ICollection<string>))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool? result = null;
|
||||
if (values[1] is IEnumerable<string>)
|
||||
{
|
||||
ICollection<string> collection = values[0] as ICollection<string>;
|
||||
IEnumerable<string> objectsToFind = values[1] as IEnumerable<string>;
|
||||
|
||||
bool all = true;
|
||||
bool none = true;
|
||||
foreach (string objectToFind in objectsToFind)
|
||||
{
|
||||
bool contains = collection.Contains(objectToFind);
|
||||
all &= contains;
|
||||
none &= !contains;
|
||||
}
|
||||
|
||||
if (all)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (none)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ICollection<string> collection = values[0] as ICollection<string>;
|
||||
string objectToFind = values[1] as string;
|
||||
|
||||
result = collection.Contains(objectToFind);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// <copyright file="CultureInfoToStringConverter.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class CultureInfoToStringConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
CultureInfo cultureInfo = value as CultureInfo;
|
||||
if (cultureInfo == null)
|
||||
{
|
||||
throw new System.ArgumentException("The object must be a culture info instance.");
|
||||
}
|
||||
|
||||
string nativeName = cultureInfo.NativeName;
|
||||
if (string.IsNullOrEmpty(nativeName))
|
||||
{
|
||||
return cultureInfo.Name;
|
||||
}
|
||||
|
||||
if (nativeName.Length == 1)
|
||||
{
|
||||
return nativeName.ToUpper(cultureInfo);
|
||||
}
|
||||
|
||||
return nativeName.Substring(0, 1).ToUpper(cultureInfo) + nativeName.Substring(1, nativeName.Length - 1);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// <copyright file="DoubleToTimeString.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class DoubleToTimeString : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is double))
|
||||
{
|
||||
throw new ArgumentException("The value must be a boolean.");
|
||||
}
|
||||
|
||||
double doubleValue = (double)value;
|
||||
|
||||
return string.Format("{0} second{1}", doubleValue.ToString("0.#"), doubleValue >= 2 ? "s" : string.Empty);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// <copyright file="EqualsConverter.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class EqualsConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return parameter == null;
|
||||
}
|
||||
|
||||
return value.Equals(parameter);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
{
|
||||
throw new ArgumentException("value");
|
||||
}
|
||||
|
||||
bool equals = (bool)value;
|
||||
if (equals)
|
||||
{
|
||||
return parameter;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// <copyright file="FormatStringConverter.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class FormatStringConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values == null)
|
||||
{
|
||||
throw new ArgumentException("The values must not be null.");
|
||||
}
|
||||
|
||||
string format = parameter as string;
|
||||
if (format == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Format(format, values);
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// <copyright file="ObjectToLocalizedString.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ObjectToLocalizedString : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new System.ArgumentNullException("value.");
|
||||
}
|
||||
|
||||
string stringValue = value.ToString();
|
||||
string typeName = value.GetType().Name;
|
||||
|
||||
string localizationKey = $"{typeName}{stringValue}Name";
|
||||
localizationKey = localizationKey.Replace(" ", string.Empty);
|
||||
|
||||
string resource = Properties.Resources.ResourceManager.GetString(localizationKey);
|
||||
if (resource == null)
|
||||
{
|
||||
return localizationKey;
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// <copyright file="StringToEnum.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class StringToEnum : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string stringValue = value as string;
|
||||
if (value == null)
|
||||
{
|
||||
// TODO default value ?
|
||||
return null;
|
||||
}
|
||||
|
||||
string typeName = parameter as string;
|
||||
if (typeName == null)
|
||||
{
|
||||
throw new ArgumentNullException("parameter", "The parameter must contains the enum type.");
|
||||
}
|
||||
|
||||
Type enumType = Type.GetType(typeName);
|
||||
if (enumType == null)
|
||||
{
|
||||
throw new Exception("Invalid enum type " + typeName + ".");
|
||||
}
|
||||
|
||||
return Enum.Parse(enumType, stringValue);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value?.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// <copyright file="StringToValueType.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class StringToValueType : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string typeName = parameter as string;
|
||||
if (typeName == null)
|
||||
{
|
||||
throw new ArgumentNullException("parameter", "The parameter must contains a convertible type.");
|
||||
}
|
||||
|
||||
Type type = Type.GetType(typeName);
|
||||
if (type == null)
|
||||
{
|
||||
throw new Exception("Invalid enum type " + typeName + ".");
|
||||
}
|
||||
|
||||
return System.Convert.ChangeType(value, type, culture);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return System.Convert.ChangeType(value, typeof(string), culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// <copyright file="ValueConverterGroup.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ValueConverterGroup : List<IValueConverter>, IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
string[] parameters = null;
|
||||
if (parameter == null)
|
||||
{
|
||||
parameters = new string[this.Count];
|
||||
}
|
||||
else
|
||||
{
|
||||
string parameterString = parameter as string;
|
||||
if (parameterString == null)
|
||||
{
|
||||
throw new ArgumentException("The parameter must be a string value.");
|
||||
}
|
||||
|
||||
parameters = parameterString.Split('|');
|
||||
if (parameters.Length != this.Count)
|
||||
{
|
||||
throw new ArgumentException("The parameter format must be 'Converter1Parameters|Converter2Parameters|...'.");
|
||||
}
|
||||
}
|
||||
|
||||
object result = value;
|
||||
for (int index = 0; index < this.Count; index++)
|
||||
{
|
||||
IValueConverter converter = this[index];
|
||||
result = converter.Convert(result, targetType, parameters[index], culture);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
string parameterString = parameter as string;
|
||||
if (parameterString == null)
|
||||
{
|
||||
throw new ArgumentException("The parameter must be a string value.");
|
||||
}
|
||||
|
||||
string[] parameters = parameterString.Split('|');
|
||||
if (parameters.Length != this.Count)
|
||||
{
|
||||
throw new ArgumentException("The parameter format must be 'Converter1Parameters|Converter2Parameters|...'.");
|
||||
}
|
||||
|
||||
object result = value;
|
||||
for (int index = this.Count - 1; index >= 0; index--)
|
||||
{
|
||||
IValueConverter converter = this[index];
|
||||
result = converter.ConvertBack(result, targetType, parameters[index], culture);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// <copyright file="ValueToString.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ValueToString : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value?.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// <copyright file="InputTypesToBool.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class InputTypesToBool : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
List<string> intputTypes = value as List<string>;
|
||||
if (intputTypes == null)
|
||||
{
|
||||
throw new ArgumentException("The value must be an list of string.");
|
||||
}
|
||||
|
||||
string referenceTypeName = parameter as string;
|
||||
if (string.IsNullOrEmpty(referenceTypeName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return intputTypes.Contains(referenceTypeName);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// <copyright file="OutputTypeEnumToViewModel.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
using FileConverter.Windows;
|
||||
|
||||
public class OutputTypeEnumToViewModel : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is OutputType))
|
||||
{
|
||||
throw new ArgumentException("The value must be an output type value.");
|
||||
}
|
||||
|
||||
OutputType outputType = (OutputType)value;
|
||||
|
||||
return SettingsWindow.OutputTypeViewModels.FirstOrDefault(match => match.Type == outputType);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
OutputTypeViewModel outputTypeViewModel = value as OutputTypeViewModel;
|
||||
if (outputTypeViewModel == null)
|
||||
{
|
||||
return OutputType.None;
|
||||
}
|
||||
|
||||
return outputTypeViewModel.Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// <copyright file="OutputTypeToVisibility.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class OutputTypeToVisibility : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is OutputType))
|
||||
{
|
||||
throw new ArgumentException("The value must be an output type enum value.");
|
||||
}
|
||||
|
||||
OutputType outputType = (OutputType)value;
|
||||
|
||||
string referenceTypeName = parameter as string;
|
||||
if (string.IsNullOrEmpty(referenceTypeName))
|
||||
{
|
||||
return "Hidden";
|
||||
}
|
||||
|
||||
OutputType referenceType;
|
||||
if (!Enum.TryParse<OutputType>(referenceTypeName, out referenceType))
|
||||
{
|
||||
return "Hidden";
|
||||
}
|
||||
|
||||
return outputType == referenceType ? "Visible" : "Hidden";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
// <copyright file="Version.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
public struct Version
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public struct Version : System.IComparable<Version>
|
||||
{
|
||||
[XmlAttribute]
|
||||
public int Major;
|
||||
|
||||
[XmlAttribute]
|
||||
public int Minor;
|
||||
|
||||
[XmlAttribute]
|
||||
public int Patch;
|
||||
|
||||
public static bool operator !=(Version a, Version b)
|
||||
{
|
||||
return a.CompareTo(b) != 0;
|
||||
}
|
||||
|
||||
public static bool operator ==(Version a, Version b)
|
||||
{
|
||||
return a.CompareTo(b) == 0;
|
||||
}
|
||||
|
||||
public static bool operator <=(Version a, Version b)
|
||||
{
|
||||
return a.CompareTo(b) <= 0;
|
||||
}
|
||||
|
||||
public static bool operator >=(Version a, Version b)
|
||||
{
|
||||
return a.CompareTo(b) >= 0;
|
||||
}
|
||||
|
||||
public static bool operator <(Version a, Version b)
|
||||
{
|
||||
return a.CompareTo(b) < 0;
|
||||
}
|
||||
|
||||
public static bool operator >(Version a, Version b)
|
||||
{
|
||||
return a.CompareTo(b) > 0;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}.{1}", this.Major, this.Minor);
|
||||
if (this.Patch == 0)
|
||||
{
|
||||
return string.Format("{0}.{1}", this.Major, this.Minor);
|
||||
}
|
||||
|
||||
return string.Format("{0}.{1}.{2}", this.Major, this.Minor, this.Patch);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is Version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Version other = (Version)obj;
|
||||
|
||||
return this.Major == other.Major && this.Minor == other.Minor && this.Patch == other.Patch;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public int CompareTo(Version other)
|
||||
{
|
||||
if (this.Major == other.Major && this.Minor == other.Minor && this.Patch == other.Patch)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this.Major > other.Major ||
|
||||
(this.Major == other.Major && this.Minor > other.Minor) ||
|
||||
(this.Major == other.Major && this.Minor == other.Minor && this.Patch > other.Patch))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<Window x:Class="FileConverter.Windows.ApplicationStartHelp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:fileConverter="clr-namespace:FileConverter"
|
||||
xmlns:project="clr-namespace:FileConverter.Properties"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
||||
mc:Ignorable="d" Icon="/FileConverter;component/Resources/ApplicationIcon.ico" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize"
|
||||
Width="640" Height="545">
|
||||
<Window.Resources>
|
||||
</Window.Resources>
|
||||
<Window.Title>
|
||||
<Binding Converter="{StaticResource ApplicationVersionToApplicationName}" Mode="OneWay" Path="(fileConverter:Application.ApplicationVersion)"/>
|
||||
</Window.Title>
|
||||
<StackPanel Margin="5" VerticalAlignment="Center">
|
||||
<TextBlock Margin="0,0,0,4" Text="{x:Static project:Resources.FileConverterStartHelp1}" TextWrapping="Wrap" FontWeight="Bold" FontSize="13.333"/>
|
||||
<TextBlock Text="{x:Static project:Resources.FileConverterStartHelp2}" TextWrapping="Wrap"/>
|
||||
<TextBlock Text="{x:Static project:Resources.FileConverterStartHelp3}" TextWrapping="Wrap" />
|
||||
<Image Margin="0,7,0,7" HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" Width="Auto"
|
||||
gif:ImageBehavior.AnimatedSource="/FileConverter;component/Resources/FileConverterUsage.gif"
|
||||
Stretch="Fill"/>
|
||||
<Button Content="{x:Static project:Resources.Ok}" Height="28" Click="OkButton_Click"/>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,29 @@
|
||||
// <copyright file="ApplicationStartHelp.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Windows
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
public partial class ApplicationStartHelp : Window
|
||||
{
|
||||
public ApplicationStartHelp()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public static FileConverter.Version ApplicationVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return FileConverter.Application.ApplicationVersion;
|
||||
}
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// <copyright file="ConversionSettingsTemplateSelector.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Windows
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
public class ConversionSettingsTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
public DataTemplate DefaultDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate AviSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate FlacSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate WavSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate Mp3SettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate Mp4SettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate OggSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate OgvSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate AacSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate GifSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate JpgSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate PngSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate MkvSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate WebmSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public DataTemplate WebpSettingsDataTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return this.DefaultDataTemplate;
|
||||
}
|
||||
|
||||
OutputType outputType = (OutputType)item;
|
||||
|
||||
switch (outputType)
|
||||
{
|
||||
case OutputType.Aac:
|
||||
return this.AacSettingsDataTemplate;
|
||||
|
||||
case OutputType.Avi:
|
||||
return this.AviSettingsDataTemplate;
|
||||
|
||||
case OutputType.Flac:
|
||||
return this.FlacSettingsDataTemplate;
|
||||
|
||||
case OutputType.Gif:
|
||||
return this.GifSettingsDataTemplate;
|
||||
|
||||
case OutputType.Jpg:
|
||||
return this.JpgSettingsDataTemplate;
|
||||
|
||||
case OutputType.Mkv:
|
||||
return this.MkvSettingsDataTemplate;
|
||||
|
||||
case OutputType.Mp3:
|
||||
return this.Mp3SettingsDataTemplate;
|
||||
|
||||
case OutputType.Mp4:
|
||||
return this.Mp4SettingsDataTemplate;
|
||||
|
||||
case OutputType.Ogg:
|
||||
return this.OggSettingsDataTemplate;
|
||||
|
||||
case OutputType.Ogv:
|
||||
return this.OgvSettingsDataTemplate;
|
||||
|
||||
case OutputType.Png:
|
||||
return this.PngSettingsDataTemplate;
|
||||
|
||||
case OutputType.Wav:
|
||||
return this.WavSettingsDataTemplate;
|
||||
|
||||
case OutputType.Webm:
|
||||
return this.WebmSettingsDataTemplate;
|
||||
|
||||
case OutputType.Webp:
|
||||
return this.WebpSettingsDataTemplate;
|
||||
}
|
||||
|
||||
return this.DefaultDataTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<Window x:Class="FileConverter.Windows.DiagnosticsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:diagnostics="clr-namespace:FileConverter.Diagnostics"
|
||||
xmlns:project="clr-namespace:FileConverter.Properties"
|
||||
xmlns:local="clr-namespace:FileConverter"
|
||||
mc:Ignorable="d"
|
||||
Height="600" Width="800" Icon="/FileConverter;component/Resources/ApplicationIcon.ico">
|
||||
<Window.Title>
|
||||
<Binding Converter="{StaticResource ApplicationVersionToApplicationName}" Mode="OneWay" Path="(local:Application.ApplicationVersion)"/>
|
||||
</Window.Title>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="{x:Static project:Resources.Diagnostics}" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold" />
|
||||
|
||||
<TabControl Grid.Row="1" Margin="5" ItemsSource="{Binding Path=(diagnostics:Debug.Data), Mode=OneWay}">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<TextBlock Name="Diagnostics" TextWrapping="NoWrap" Text="{Binding Content}" FontFamily="Consolas" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="False"/>
|
||||
</ScrollViewer>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,17 @@
|
||||
// <copyright file="DiagnosticsWindow.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Windows
|
||||
{
|
||||
using System.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DiagnosticsWindow.
|
||||
/// </summary>
|
||||
public partial class DiagnosticsWindow : Window
|
||||
{
|
||||
public DiagnosticsWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// <copyright file="InputExtension.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
using FileConverter.ConversionJobs;
|
||||
|
||||
public class InputExtension : INotifyPropertyChanged
|
||||
{
|
||||
private readonly Brush defaultBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0));
|
||||
private readonly Brush errorBrush = new SolidColorBrush(Color.FromRgb(255, 65, 0));
|
||||
|
||||
private string name;
|
||||
private Brush foregroundBrush;
|
||||
private string toolTip;
|
||||
|
||||
public InputExtension(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
||||
ConversionJob_Office.ApplicationName officeApplication = Helpers.GetOfficeApplicationCompatibleWithExtension(name);
|
||||
|
||||
if (officeApplication == ConversionJob_Office.ApplicationName.None || Helpers.IsMicrosoftOfficeApplicationAvailable(officeApplication))
|
||||
{
|
||||
this.ForegroundBrush = this.defaultBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ForegroundBrush = this.errorBrush;
|
||||
switch (officeApplication)
|
||||
{
|
||||
case ConversionJob_Office.ApplicationName.Word:
|
||||
this.ToolTip = Properties.Resources.ErrorMicrosoftWordIsNotAvailable;
|
||||
break;
|
||||
|
||||
case ConversionJob_Office.ApplicationName.PowerPoint:
|
||||
this.ToolTip = Properties.Resources.ErrorMicrosoftPowerPointIsNotAvailable;
|
||||
break;
|
||||
|
||||
case ConversionJob_Office.ApplicationName.Excel:
|
||||
this.ToolTip = Properties.Resources.ErrorMicrosoftExcelIsNotAvailable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Brush ForegroundBrush
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.foregroundBrush;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.foregroundBrush = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string ToolTip
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.toolTip;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.toolTip = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// <copyright file="InputExtensionCategory.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
|
||||
public class InputExtensionCategory : INotifyPropertyChanged
|
||||
{
|
||||
private string name;
|
||||
private List<InputExtension> inputExtensions = new List<InputExtension>();
|
||||
|
||||
public InputExtensionCategory(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<InputExtension> InputExtensions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inputExtensions;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> InputExtensionNames
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (InputExtension inputExtension in this.inputExtensions)
|
||||
{
|
||||
yield return inputExtension.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddExtension(string extension)
|
||||
{
|
||||
InputExtension inputExtension = this.inputExtensions.Find(match => match.Name == extension);
|
||||
if (inputExtension == null)
|
||||
{
|
||||
inputExtension = new InputExtension(extension);
|
||||
this.inputExtensions.Add(inputExtension);
|
||||
this.OnPropertyChanged("InputExtensions");
|
||||
this.OnPropertyChanged("InputExtensionNames");
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FileConverter"
|
||||
xmlns:valueConverters="clr-namespace:FileConverter.ValueConverters"
|
||||
xmlns:conversionJobs="clr-namespace:FileConverter.ConversionJobs"
|
||||
xmlns:generic="clr-namespace:FileConverter.ValueConverters.Generic"
|
||||
xmlns:project="clr-namespace:FileConverter.Properties"
|
||||
mc:Ignorable="d" x:Class="FileConverter.MainWindow"
|
||||
x:Name="FileConverterMainWindow" Height="500" Width="950" MinHeight="250" MinWidth="500" WindowStartupLocation="CenterScreen" Icon="/FileConverter;component/Resources/ApplicationIcon.ico">
|
||||
<Window.Resources>
|
||||
<valueConverters:ConversionStateToBrush x:Key="ConversionStateToColor" />
|
||||
|
||||
<generic:ValueConverterGroup x:Key="EnumEqualsToVisibility">
|
||||
<generic:ValueToString/>
|
||||
<generic:EqualsConverter/>
|
||||
<generic:BoolToVisibility/>
|
||||
</generic:ValueConverterGroup>
|
||||
</Window.Resources>
|
||||
<Window.Title>
|
||||
<Binding Converter="{StaticResource ApplicationVersionToApplicationName}" Mode="OneWay" Path="(local:Application.ApplicationVersion)"/>
|
||||
</Window.Title>
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="120" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<DockPanel Grid.Column="0">
|
||||
<Label Content="{x:Static project:Resources.ConversionQueueTitle}" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold"/>
|
||||
<Label Content="{Binding InformationMessage, ElementName=FileConverterMainWindow}" VerticalAlignment="Top" Height="30" FontSize="13.333" HorizontalAlignment="Right"/>
|
||||
</DockPanel>
|
||||
<Button x:Name="DiagnosticsButton" Grid.Column="1" Content="{x:Static project:Resources.DiagnosticsButtonTitle}" Margin="3,3" Click="DiagnosticsButton_OnClick"/>
|
||||
<Button x:Name="SettingsButton" Grid.Column="2" Content="{x:Static project:Resources.SettingsButtonTitle}" Margin="3,3" Click="SettingsButton_OnClick"/>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer x:Name="ScrollViewer" Grid.Row="1" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<ItemsControl x:Name="ConverterJobsList">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Background="{Binding State, ConverterParameter=Background, Converter={StaticResource ConversionStateToColor}}" Margin="0,4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="70"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Margin="10" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2.5*" MinWidth="300" />
|
||||
<ColumnDefinition Width="*" MinWidth="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding OutputFilePath}" FontWeight="Bold" />
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Margin="10,0,0,0">
|
||||
<WrapPanel>
|
||||
<TextBlock Text="{x:Static project:Resources.ConvertedFrom}" FontSize="11" FontStyle="Italic" Margin="0,0,5,0" />
|
||||
<TextBlock Text="{Binding InputFilePath}" FontSize="11" FontStyle="Italic" />
|
||||
</WrapPanel>
|
||||
<TextBlock Text="{Binding ErrorMessage}" Foreground="{Binding State, ConverterParameter=Foreground, Converter={StaticResource ConversionStateToColor}}" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding UserState}" FontWeight="Bold" Foreground="{Binding State, ConverterParameter=Foreground, Converter={StaticResource ConversionStateToColor}}" />
|
||||
|
||||
<ProgressBar Grid.Row="1" Grid.Column="1" Height="18" Width="Auto" Minimum="0" Maximum="1" SmallChange="0.001" Value="{Binding Progress, Mode=OneWay}" Foreground="{Binding State, ConverterParameter=Foreground, Converter={StaticResource ConversionStateToColor}}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" MinWidth="100" LargeChange="0.1" />
|
||||
</Grid>
|
||||
|
||||
<Button Margin="5" Grid.Column="1" Background="WhiteSmoke" Foreground="#FF3E3E3E" Visibility="{Binding State, Converter={StaticResource EnumEqualsToVisibility}, ConverterParameter=|InProgress|Collapsed}" Command="{Binding CancelCommand}" ToolTip="Cancel">
|
||||
<Button.Content>
|
||||
<Image Source="/FileConverter;component/Resources/CancelIcon.png" Width="48" Height="48" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Image Margin="5" Grid.Column="1" Source="/FileConverter;component/Resources/SuccessIcon.png" Width="48" Height="48" Visibility="{Binding State, Converter={StaticResource EnumEqualsToVisibility}, ConverterParameter=|Done|Collapsed}"/>
|
||||
<Image Margin="5" Grid.Column="1" Source="/FileConverter;component/Resources/FailIcon.png" Width="48" Height="48" Visibility="{Binding State, Converter={StaticResource EnumEqualsToVisibility}, ConverterParameter=|Failed|Collapsed}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<ItemsControl.DataContext>
|
||||
<conversionJobs:ConversionJob/>
|
||||
</ItemsControl.DataContext>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,198 @@
|
||||
// <copyright file="MainWindow.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
using FileConverter.Windows;
|
||||
|
||||
public partial class MainWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
private DiagnosticsWindow diagnosticsWindow;
|
||||
private SettingsWindow settingsWindow;
|
||||
private UpgradeWindow upgradeWindow;
|
||||
|
||||
private string informationMessage;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
|
||||
application.OnApplicationTerminate += this.Application_OnApplicationTerminate;
|
||||
|
||||
this.ConverterJobsList.ItemsSource = application.ConvertionJobs;
|
||||
|
||||
if (application.HideMainWindow)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
if (application.Verbose)
|
||||
{
|
||||
this.ShowDiagnosticsWindow();
|
||||
}
|
||||
|
||||
if (application.ShowSettings)
|
||||
{
|
||||
this.ShowSettingsWindow();
|
||||
this.settingsWindow.OnSettingsWindowHide += this.SettingsWindow_Closed;
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string InformationMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.informationMessage;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
this.informationMessage = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNewVersionReleased(UpgradeVersionDescription upgradeVersionDescription)
|
||||
{
|
||||
this.ShowUpgradeWindow();
|
||||
this.upgradeWindow.VersionDescription = upgradeVersionDescription;
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs eventArgs)
|
||||
{
|
||||
base.OnClosing(eventArgs);
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
|
||||
if (application.UpgradeVersionDescription != null && application.UpgradeVersionDescription.NeedToUpgrade && !application.UpgradeVersionDescription.InstallerDownloadDone)
|
||||
{
|
||||
eventArgs.Cancel = true;
|
||||
this.ShowUpgradeWindow();
|
||||
this.upgradeWindow.VersionDescription = application.UpgradeVersionDescription;
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingsButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShowSettingsWindow();
|
||||
}
|
||||
|
||||
private void SettingsWindow_Closed(object sender, System.EventArgs e)
|
||||
{
|
||||
this.settingsWindow.OnSettingsWindowHide -= this.SettingsWindow_Closed;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void DiagnosticsButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShowDiagnosticsWindow();
|
||||
}
|
||||
|
||||
private void ShowDiagnosticsWindow()
|
||||
{
|
||||
if (this.diagnosticsWindow != null && this.diagnosticsWindow.IsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.diagnosticsWindow = new DiagnosticsWindow();
|
||||
}
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
application?.CancelAutoExit();
|
||||
this.diagnosticsWindow.Show();
|
||||
}
|
||||
|
||||
private void ShowSettingsWindow()
|
||||
{
|
||||
if (this.settingsWindow != null && this.settingsWindow.IsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.settingsWindow = new SettingsWindow();
|
||||
}
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
application?.CancelAutoExit();
|
||||
this.settingsWindow.Show();
|
||||
}
|
||||
|
||||
private void ShowUpgradeWindow()
|
||||
{
|
||||
if (this.upgradeWindow != null && this.upgradeWindow.IsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (this.upgradeWindow == null)
|
||||
{
|
||||
this.upgradeWindow = new UpgradeWindow();
|
||||
this.upgradeWindow.Closed += this.UpgradeWindow_Closed;
|
||||
}
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
application?.CancelAutoExit();
|
||||
this.upgradeWindow.Show();
|
||||
}
|
||||
|
||||
private void UpgradeWindow_Closed(object sender, System.EventArgs e)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
|
||||
if (this.IsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (application.UpgradeVersionDescription != null && application.UpgradeVersionDescription.NeedToUpgrade && application.UpgradeVersionDescription.InstallerDownloadDone)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void Application_OnApplicationTerminate(object sender, ApplicationTerminateArgs eventArgs)
|
||||
{
|
||||
if (float.IsNaN(eventArgs.RemainingTimeBeforeTermination))
|
||||
{
|
||||
this.InformationMessage = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
int remaingingSeconds = (int)eventArgs.RemainingTimeBeforeTermination;
|
||||
|
||||
if (remaingingSeconds >= 2)
|
||||
{
|
||||
this.InformationMessage = string.Format(Properties.Resources.ApplicationWillTerminateInMultipleSeconds, remaingingSeconds);
|
||||
}
|
||||
else if (remaingingSeconds == 1)
|
||||
{
|
||||
this.InformationMessage = Properties.Resources.ApplicationWillTerminateInOneSecond;
|
||||
}
|
||||
|
||||
if (remaingingSeconds <= 0)
|
||||
{
|
||||
this.InformationMessage = Properties.Resources.ApplicationIsTerminating;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||