Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit 3962940

Browse files
committed
Fixes #4
1 parent 62d194d commit 3962940

File tree

4 files changed

+27
-78
lines changed

4 files changed

+27
-78
lines changed

WPFMETRO/Converter.xaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xmlns:local="clr-namespace:WPFMETRO"
1111
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
1212
mc:Ignorable="d"
13-
Title="{x:Static localization:Strings.Converter}" Height="463" Width="440">
13+
Title="{x:Static localization:Strings.Converter}" Height="463" Width="480">
1414
<Grid>
1515
<Grid.RowDefinitions>
1616
<RowDefinition Height="0.00085*" />
@@ -59,12 +59,11 @@
5959
</StackPanel>
6060

6161
<StackPanel Margin="13,6, 0, 0" Grid.Column = "0" Grid.Row = "3" Orientation = "Horizontal">
62-
<Label Content = "{x:Static localization:Strings.Other}" VerticalAlignment = "Center" Width = "75"/>
63-
<Button IsEnabled="False" x:Name="JoinVideosButton" Content = "{x:Static localization:Strings.JoinVideos}" MinWidth="203" MaxWidth="210"/>
64-
<Button Margin="10,0,0,0" x:Name="CancelJoinButton" Click="ImportButton_Click" MinWidth="150" MaxWidth="160" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
62+
<Button Name="MergeButton" Click="MergeButton_Click" Content="{x:Static localization:Strings.MergeAV}" HorizontalAlignment="Left" MinWidth="203" MaxWidth="210" Margin="75,0,0,0"/>
63+
<Button Name="CancelMergeButton" Margin="10,0,0,0" Click="CancelMergeButton_Click" MinWidth="150" MaxWidth="160" HorizontalAlignment="Left" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
6564
</StackPanel>
66-
67-
<StackPanel Margin="13,2" Orientation="Vertical" Grid.Row = "4" >
65+
66+
<StackPanel Margin="13,2" Orientation="Vertical" Grid.Row = "4" >
6867
<StackPanel Grid.Column = "0" Grid.Row = "4" Orientation = "Horizontal">
6968
<Button IsEnabled="False" Name="AddSubsButton" Content="{x:Static localization:Strings.AddSubtitles}" HorizontalAlignment="Left" MinWidth="203" MaxWidth="210" Margin="75,2"/>
7069
<Button Margin="10,0,0,0" x:Name="CancelSubsButton" Click="ImportButton_Click" MinWidth="150" MaxWidth="160" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
@@ -74,10 +73,6 @@
7473
<TextBox Name="IntervalSnagBox" Width = "50" IsEnabled="False" TextInput="IntervalSnagBox_TextInput"/>
7574
<Label Content = "{x:Static localization:Strings.Seconds}" VerticalAlignment = "Center" Width = "75"/>
7675
</StackPanel>
77-
<StackPanel Grid.Column = "0" Grid.Row = "4" Orientation = "Horizontal">
78-
<Button IsEnabled="False" Name="MergeButton" Content="{x:Static localization:Strings.MergeAV}" HorizontalAlignment="Left" MinWidth="203" MaxWidth="210" Margin="75,2"/>
79-
<Button Margin="10,0,0,0" x:Name="CancelMergeButton" Click="ImportButton_Click" MinWidth="150" MaxWidth="160" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
80-
</StackPanel>
8176
</StackPanel>
8277

8378
<GroupBox Margin="13,2" Grid.Row="5" Header="{x:Static localization:Strings.Information}">

WPFMETRO/Converter.xaml.cs

Lines changed: 17 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public Converter()
4848

4949
private void ImportButton_Click(object sender, RoutedEventArgs e)
5050
{
51-
JoinVideosButton.IsEnabled = false;
52-
5351
importAVDialog.ShowDialog();
5452
if (importAVDialog.CheckFileExists)
5553
{
@@ -97,32 +95,26 @@ private void ExportButton_Click(object sender, RoutedEventArgs e)
9795
private void ConvertButton_Click(object sender, RoutedEventArgs e)
9896
{
9997
string args = "";
100-
if (JoinVideosButton.IsEnabled)
98+
99+
args = "-i \"" + inputFile + "\"";
100+
string output = Path.GetExtension(outputFile) == ".png" ? "\"" + outputFile.Substring(0, outputFile.LastIndexOf('.')) + "_%03d.png\"" : " \"" + saveAVDialog.FileName + "\"";
101+
if (Path.GetExtension(outputFile) == ".png") { args += " -vf fps=" + IntervalSnagBox.Text + " "; }
102+
if (CutStartTextbox.Text == "00:00:00.0" && EndOfVideoCheckbox.IsChecked == true)
101103
{
102-
args = "-f concat -i file -list.txt -c copy " + saveAVDialog.FileName;
104+
if (openMergeDialog.FileName != "" && openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
105+
else if (openSubtitlesDialog.FileName != "") { args += " -i \"" + openSubtitlesDialog.FileName + "\" - map 0 - map 1 - c copy - c:v"; }
106+
else if (openMergeDialog.FileName != "") { args += " -i \"" + openMergeDialog.FileName + "\" -c:v copy -c:a aac -map 0:v:0 -map 1:a:0"; }
103107
}
104108
else
105109
{
106-
args = "-i \"" + inputFile + "\"";
107-
string output = Path.GetExtension(outputFile) == ".png" ? "\"" + outputFile.Substring(0, outputFile.LastIndexOf('.')) + "_%03d.png\"" : " \"" + saveAVDialog.FileName + "\"";
108-
if (Path.GetExtension(outputFile) == ".png") { args += " -vf fps=" + IntervalSnagBox.Text + " "; }
109-
if (CutStartTextbox.Text == "00:00:00.0" && EndOfVideoCheckbox.IsChecked == true)
110-
{
111-
if (openMergeDialog.FileName != "" && openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
112-
else if (openSubtitlesDialog.FileName != "") { args += "-i " + openSubtitlesDialog.FileName + " - map 0 - map 1 - c copy - c:v"; }
113-
else if (openMergeDialog.FileName != "") { args += "-i " + openMergeDialog.FileName + " -c:v copy -c:a aac -strict experimental"; }
114-
}
110+
if (openMergeDialog.FileName != "" || openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
115111
else
116112
{
117-
if (openMergeDialog.FileName != "" || openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
118-
else
119-
{
120-
args += " -ss " + CutStartTextbox.Text;
121-
args += EndOfVideoCheckbox.IsChecked == true ? "" : " -to " + CutEndTextbox.Text + " ";
122-
}
113+
args += " -ss " + CutStartTextbox.Text;
114+
args += EndOfVideoCheckbox.IsChecked == true ? "" : " -to " + CutEndTextbox.Text + " ";
123115
}
124-
args += output;
125116
}
117+
args += output;
126118

127119
ffMpegProc.StartInfo.Arguments = args;
128120
ffMpegProc.StartInfo.UseShellExecute = false;
@@ -136,7 +128,7 @@ private void ConvertButton_Click(object sender, RoutedEventArgs e)
136128

137129
ffMpegProc.Start();
138130

139-
CancelButton.Visibility = CancelJoinButton.Visibility = CancelMergeButton.Visibility = CancelSubsButton.Visibility = Visibility.Hidden;
131+
CancelButton.Visibility = CancelMergeButton.Visibility = CancelSubsButton.Visibility = Visibility.Hidden;
140132

141133
EndOfVideoCheckbox.IsEnabled = ConvertButton.IsEnabled = ExportButton.IsEnabled = ImportButton.IsEnabled = false;
142134
MergeButton.IsEnabled = CutStartTextbox.IsEnabled = EndOfVideoCheckbox.IsEnabled = AddSubsButton.IsEnabled = false;
@@ -155,7 +147,7 @@ private void ffMpegProc_Exited(object sender, EventArgs e)
155147
ConvertFromLabel.Content = "";
156148
ConvertToLabel.Content = "";
157149

158-
ImportButton.IsEnabled = CutStartTextbox.IsEnabled = EndOfVideoCheckbox.IsEnabled = JoinVideosButton.IsEnabled = true;
150+
ImportButton.IsEnabled = CutStartTextbox.IsEnabled = EndOfVideoCheckbox.IsEnabled = true;
159151

160152
StatusLabel.Content = Localization.Strings.Done;
161153
}));
@@ -167,43 +159,16 @@ private void EndOfVideoCheckbox_CheckedChanged(object sender, EventArgs e)
167159
CutEndTextbox.Text = "0000000";
168160
}
169161

170-
private void JoinVideosButton_Click(object sender, EventArgs e)
171-
{
172-
ImportButton.IsEnabled = false;
173-
AddSubsButton.IsEnabled = false;
174-
IntervalSnagBox.IsEnabled = false;
175-
MergeButton.IsEnabled = false;
176-
CancelJoinButton.Visibility = Visibility.Visible;
177-
178-
/*openVideoListDialog.ShowDialog();
179-
180-
if (openVideoListDialog.CheckFileExists)
181-
{
182-
ExportButton.IsEnabled = true;
183-
}*/
184-
}
185-
186162
private void CancelImportButton_Click(object sender, EventArgs e)
187163
{
188164
importAVDialog.FileName = "";
189165
inputFile = "";
190166

191167
OriginalFileLabel.Content = "";
192168

193-
JoinVideosButton.IsEnabled = true;
194169
CancelButton.Visibility = Visibility.Hidden;
195170
}
196171

197-
private void CancelJoinButton_Click(object sender, EventArgs e)
198-
{
199-
ConvertButton.IsEnabled = false;
200-
ImportButton.IsEnabled = true;
201-
202-
//openVideoListDialog.FileName = ""; Will implement later
203-
204-
CancelJoinButton.Visibility = Visibility.Hidden;
205-
}
206-
207172
private void AddSubsButton_Click(object sender, EventArgs e)
208173
{
209174
CancelSubsButton.Visibility = Visibility.Visible;
@@ -218,20 +183,9 @@ private void AddSubsButton_Click(object sender, EventArgs e)
218183

219184
private void MergeButton_Click(object sender, EventArgs e)
220185
{
221-
if (videoFormats.Any(Path.GetExtension(inputFile).Contains))
222-
{
223-
CancelMergeButton.Visibility = Visibility.Visible;
224-
AddSubsButton.IsEnabled = false;
225-
openMergeDialog.Filter = videoFilter;
226-
openMergeDialog.ShowDialog();
227-
}
228-
else if (audioFormats.Any(Path.GetExtension(inputFile).Contains))
229-
{
230-
AddSubsButton.IsEnabled = false;
231-
CancelMergeButton.Visibility = Visibility.Visible;
232-
openMergeDialog.FileName = audioFilter;
233-
openMergeDialog.ShowDialog();
234-
}
186+
CancelMergeButton.Visibility = Visibility.Visible;
187+
AddSubsButton.IsEnabled = false;
188+
openMergeDialog.ShowDialog();
235189
}
236190

237191
private void CancelMergeButton_Click(object sender, EventArgs e)

WPFMETRO/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.5.0.7")]
55-
[assembly: AssemblyFileVersion("1.5.0.7")]
54+
[assembly: AssemblyVersion("1.5.1.0")]
55+
[assembly: AssemblyFileVersion("1.5.1.0")]

WPFMETRO/WPFMETRO.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<UpdateRequired>false</UpdateRequired>
2727
<MapFileExtensions>false</MapFileExtensions>
2828
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
29-
<ApplicationRevision>7</ApplicationRevision>
30-
<ApplicationVersion>1.5.0.%2a</ApplicationVersion>
29+
<ApplicationRevision>0</ApplicationRevision>
30+
<ApplicationVersion>1.5.1.%2a</ApplicationVersion>
3131
<UseApplicationTrust>false</UseApplicationTrust>
3232
<PublishWizardCompleted>true</PublishWizardCompleted>
3333
<BootstrapperEnabled>true</BootstrapperEnabled>
@@ -52,7 +52,7 @@
5252
<WarningLevel>4</WarningLevel>
5353
</PropertyGroup>
5454
<PropertyGroup>
55-
<ManifestCertificateThumbprint>6EC2C9CFFD1C18115525233621D8D7F404685BD1</ManifestCertificateThumbprint>
55+
<ManifestCertificateThumbprint>07BF3C69710D4229175A128FD11DB7AFC4FE483F</ManifestCertificateThumbprint>
5656
</PropertyGroup>
5757
<PropertyGroup>
5858
<ManifestKeyFile>WPFMETRO_TemporaryKey.pfx</ManifestKeyFile>

0 commit comments

Comments
 (0)