Skip to content

Commit d9e7c01

Browse files
committed
4.6 bug fixed
1. Add warning non empty temp folder. 2. Screen default size change to 800x600 3. Fix no language subtitle, using "und". 4. Block program close if encoding still running
1 parent 55f1c07 commit d9e7c01

File tree

16 files changed

+65
-60
lines changed

16 files changed

+65
-60
lines changed

ifme/Globals.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ public static string NameCode
6666
get { return Properties.Resources.EpicWord; }
6767
}
6868

69-
/// <summary>
70-
/// Return preformatted string for title
71-
/// </summary>
72-
public static string NameTitle
73-
{
74-
get { return String.Format("{0} v{1} ( '{2}' )", NameShort, Version, NameCode); }
75-
}
69+
public static string NameTitle = String.Format("{0} v{1} ( '{2}' )", NameShort, Version, NameCode);
7670

7771
/// <summary>
7872
/// Return program complied date via PE Header
@@ -90,7 +84,7 @@ public static string Version
9084
get { return System.Windows.Forms.Application.ProductVersion; }
9185
}
9286

93-
public static string VersionMsg = null;
87+
public static string VersionMsg = "Unable to fetch latest version, no internet connected.";
9488
public static string VersionNew = null;
9589
public static bool VersionEqual = true;
9690

ifme/Language.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public static class IMessage
117117
public static string ProTipTitle = "";
118118
public static string ProTipUpdate = "";
119119
public static string MKVOnly = "";
120+
public static string NotEmptyFolder = "";
120121
}
121122

122123
public static class IOptions

ifme/frmAbout.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ private void frmAbout_Load(object sender, EventArgs e)
8080

8181
// Get first
8282
Names[cnt++] = "People @ MulticoreWare";
83+
Names[cnt++] = "Pis Kawaii Neko";
8384

8485
// Get Names for Langauge author
8586
for (int i = 0; i < Language.Installed.Data.GetLength(0); i++)
@@ -137,21 +138,21 @@ private void btnUpdate_Click(object sender, EventArgs e)
137138

138139
if (OS.IsWindows)
139140
{
140-
File.WriteAllText(Path.Combine(Globals.AppInfo.TempFolder, "update.cmd"), framework.ShellScript.ScriptWin);
141141
cmd = "cmd.exe";
142142
arg = "/c START \"\" /B update.cmd \"{0}\" \"{1}\" \"ifme.exe\"";
143143
file = "x265ui.7z";
144144

145+
File.WriteAllText(Path.Combine(Globals.AppInfo.TempFolder, "update.cmd"), framework.ShellScript.ScriptWin);
145146
File.Copy(Path.Combine(Globals.AppInfo.CurrentFolder, "unpack.exe"), Path.Combine(Globals.AppInfo.TempFolder, "7za.exe"), true);
146147
File.Copy(Path.Combine(Globals.AppInfo.CurrentFolder, "wget.exe"), Path.Combine(Globals.AppInfo.TempFolder, "wget.exe"), true);
147148
}
148149
else
149150
{
150-
File.WriteAllText(Path.Combine(Globals.AppInfo.TempFolder, "update.sh"), framework.ShellScript.ScriptLinux);
151151
cmd = "sh";
152152
arg = "update.sh \"{0}\" \"{1}\" \"ifme.sh\"";
153153
file = "x265ui_linux.tar.gz";
154154

155+
File.WriteAllText(Path.Combine(Globals.AppInfo.TempFolder, "update.sh"), framework.ShellScript.ScriptLinux);
155156
File.Copy(Path.Combine(Globals.AppInfo.CurrentFolder, "unpack"), Path.Combine(Globals.AppInfo.TempFolder, "7za"), true);
156157
}
157158

ifme/frmMain.cs

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public frmMain()
2525
// Form Init.
2626
this.Size = Properties.Settings.Default.FormSize;
2727
this.Icon = Properties.Resources.ifme_green;
28-
this.Text = Globals.AppInfo.NameTitle;
2928
pictBannerRight.Parent = pictBannerMain;
3029

3130
// Fix Mono WinForms Drawing
@@ -36,24 +35,30 @@ public frmMain()
3635
pictBannerMain.Width += 9;
3736
pictBannerRight.Left += 116;
3837

39-
if (Properties.Settings.Default.FormSize.Width < 800)
40-
this.Width = 800;
41-
if (Properties.Settings.Default.FormSize.Height < 600)
42-
this.Height = 600;
43-
4438
// In UNIX, shutdown require root
4539
chkDoneOffMachine.Visible = false;
4640
}
41+
42+
// Enhanced screen, some text (languages) not fit
43+
if (Properties.Settings.Default.FormSize.Width < 800)
44+
this.Width = 800;
45+
if (Properties.Settings.Default.FormSize.Height < 600)
46+
this.Height = 600;
4747
}
4848

4949
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
5050
{
51-
var msgbox = MessageBox.Show(Language.IMessage.Quit, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
51+
if (BGThread.IsBusy)
52+
{
53+
e.Cancel = true;
54+
return;
55+
}
5256

57+
var msgbox = MessageBox.Show(Language.IMessage.Quit, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
5358
if (msgbox == DialogResult.No)
5459
e.Cancel = true;
55-
56-
UserSettingsSave();
60+
else
61+
UserSettingsSave();
5762

5863
if (OS.IsLinux)
5964
Console.Write("[info] Your settings has been saved, {0} exit safely\n", Globals.AppInfo.NameShort);
@@ -93,14 +98,17 @@ private void frmMain_Load(object sender, EventArgs e)
9398
PrintLog(Log.OK, "New default temporary folder created!");
9499
}
95100

96-
// Check for updates
101+
// Check for updates and load addons
97102
PrintLog(Log.Info, "Checking for updates");
98103
frmSplashScreen SS = new frmSplashScreen();
99104
SS.ShowDialog();
100105

101106
// Display that IFME has new version
102107
PrintLog(Log.Info, Globals.AppInfo.VersionMsg);
103108

109+
// Update form title
110+
this.Text = Globals.AppInfo.NameTitle;
111+
104112
// Load list of ISO language file to control
105113
try
106114
{
@@ -908,7 +916,7 @@ private void btnResume_Click(object sender, EventArgs e)
908916

909917
private void btnStart_Click(object sender, EventArgs e)
910918
{
911-
if (btnStart.Text.Equals(Language.IControl.btnStop))
919+
if (BGThread.IsBusy)
912920
{
913921
var msgbox = MessageBox.Show(Language.IMessage.Halt, "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
914922
if (msgbox == DialogResult.Yes)
@@ -1107,8 +1115,8 @@ private void BGThread_DoWork(object sender, DoWorkEventArgs e)
11071115
if (!IsInterlaced && String.Equals(video[0].frameRateMode, "VFR"))
11081116
{
11091117
// Tell user
1110-
FormTitle(String.Format("Queue {0} of {1}: Get timecodes for synchronisation", x + 1, queue.Length));
1111-
InvokeLog(Log.Info, "Reading source time codes for reference. Please Wait...");
1118+
FormTitle(String.Format("Queue {0} of {1}: Indexing source video", x + 1, queue.Length));
1119+
InvokeLog(Log.Info, "Indexing source for future reference. Please Wait...");
11121120

11131121
// Get source timecode, this gurantee video and audio in sync (https://github.com/FFMS/ffms2/issues/165)
11141122
// FFmpeg mkvtimestamp_v2 give wrong timecodes, DTS or duplicate frame issue, using FFms Index to provide timecodes
@@ -1183,6 +1191,10 @@ private void BGThread_DoWork(object sender, DoWorkEventArgs e)
11831191
string fmt = stext[s].format.ToLower();
11841192
string file = String.Format("subtitle_id_{0}_{1}.{2}", id, iso, fmt);
11851193

1194+
// Just in case
1195+
if (String.IsNullOrEmpty(iso))
1196+
iso = "und";
1197+
11861198
MkvExtractId.SubtitleData[s, 0] = iso;
11871199
MkvExtractId.SubtitleData[s, 1] = file;
11881200
MkvExtractId.SubtitleData[s, 2] = id.ToString();
@@ -1502,16 +1514,16 @@ private void BGThread_DoWork(object sender, DoWorkEventArgs e)
15021514
}
15031515
else if (HasSubtitle)
15041516
{
1505-
// Turn to disable
1517+
// Turn to disable for next queue
15061518
HasSubtitle = false;
15071519
for (int i = 0; i < MkvExtractId.SubtitleData.GetLength(0); i++)
15081520
{
15091521
if (MkvExtractId.SubtitleData[i, 0] == null)
15101522
break;
15111523
string[] sp = new string[3];
15121524
sp[0] = MkvExtractId.SubtitleData[i, 0]; //lang
1513-
sp[1] = MkvExtractId.SubtitleData[i, 1].ToUpper(); //file name only (description?)
1514-
sp[2] = Path.Combine(tmp, MkvExtractId.SubtitleData[i, 1]); //full path
1525+
sp[1] = MkvExtractId.SubtitleData[i, 1].ToUpper().Replace('_', ' '); //file name only (description?)
1526+
sp[2] = Path.Combine(tmp, MkvExtractId.SubtitleData[i, 1]); //full path
15151527
command += String.Format("--language \"0:{0}\" --track-name \"0:{1}\" --forced-track 0:no -s 0 -D -A -T --no-global-tags --no-chapters \"(\" \"{2}\" \")\" ", sp);
15161528
trackorder = trackorder + "," + id.ToString() + ":0";
15171529
id++;
@@ -1598,8 +1610,17 @@ private int StartProcess(string exe, string args)
15981610

15991611
if (OS.IsWindows)
16001612
{
1601-
SI.FileName = "cmd.exe";
1602-
SI.Arguments = String.Format("/c start \"IFME\" /D \"{2}\" /WAIT /B \"{0}\" {1}", exe, args, Globals.AppInfo.CurrentFolder);
1613+
1614+
if (args.Contains('>'))
1615+
{
1616+
SI.FileName = "cmd";
1617+
SI.Arguments = String.Format("/c start \"\" /D \"{2}\" /WAIT /B \"{0}\" {1}", exe, args, Globals.AppInfo.CurrentFolder);
1618+
}
1619+
else
1620+
{
1621+
SI.FileName = exe;
1622+
SI.Arguments = args;
1623+
}
16031624
}
16041625
else
16051626
{
@@ -1975,6 +1996,7 @@ ctrl is CheckBox ||
19751996
Language.IMessage.ResetSettingsAsk = data[Language.Section.Msg]["ResetSettingsAsk"];
19761997
Language.IMessage.ResetSettingsOK = data[Language.Section.Msg]["ResetSettingsOK"];
19771998
Language.IMessage.MKVOnly = data[Language.Section.Msg]["MKVOnly"];
1999+
Language.IMessage.NotEmptyFolder = data[Language.Section.Msg]["NotEmptyFolder"];
19782000
// ToolTip
19792001
Language.IMessage.ProTipTitle = data[Language.Section.Pro]["Title"];
19802002
Language.IMessage.ProTipUpdate = data[Language.Section.Pro]["TellUpdate"];

ifme/frmOptions.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,21 @@ private void btnTempFindFolder_Click(object sender, EventArgs e)
165165
GetFolder.ShowNewFolderButton = true;
166166
GetFolder.RootFolder = Environment.SpecialFolder.MyComputer;
167167

168-
if (txtTempDir.Text != "")
168+
if (!String.IsNullOrEmpty(txtTempDir.Text))
169169
{
170170
GetFolder.SelectedPath = txtTempDir.Text;
171171
}
172172

173173
if (GetFolder.ShowDialog() == DialogResult.OK)
174174
{
175-
txtTempDir.Text = GetFolder.SelectedPath;
175+
if (Directory.EnumerateFileSystemEntries(GetFolder.SelectedPath).Any())
176+
{
177+
MessageBox.Show(Language.IMessage.NotEmptyFolder, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
178+
}
179+
else
180+
{
181+
txtTempDir.Text = GetFolder.SelectedPath;
182+
}
176183
}
177184
}
178185

ifme/frmSplashScreen.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -61,36 +61,6 @@ private void BGThread_DoWork(object sender, DoWorkEventArgs e)
6161
if (File.Exists(Path.Combine(Globals.AppInfo.CurrentFolder, "za.dll")))
6262
File.Delete(Path.Combine(Globals.AppInfo.CurrentFolder, "za.dll"));
6363

64-
// Country restriction, MCMC (actually empty file name can be by pass this, as gov. need, had to do it.)
65-
try
66-
{
67-
string country = client.DownloadString("http://api.hostip.info/country.php");
68-
if (String.Equals(country, "MY"))
69-
{
70-
if (!File.Exists(Path.Combine(Globals.AppInfo.CurrentFolder,"zen.imouto")))
71-
{
72-
var msg = MessageBox.Show("MCMC (Malaysian Communications and Multimedia Commission) just restricted use of this video encoder inside Malaysia users, it require an activation file.\n\nDo you want to get activation file? (Your name, MyKad, Email and Phone number that will send to MCMC)", "Invalid", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
73-
if (msg == System.Windows.Forms.DialogResult.Yes)
74-
{
75-
Process.Start("http://fb.com/internetfriendlymediaencoder");
76-
}
77-
else
78-
{
79-
this.Invoke((MethodInvoker)delegate { Application.ExitThread(); });
80-
}
81-
}
82-
}
83-
else
84-
{
85-
File.WriteAllText(Path.Combine(Globals.AppInfo.CurrentFolder, "zen.imouto"), "!MY");
86-
}
87-
}
88-
catch (Exception ex)
89-
{
90-
InvokeStatus("Error", ex.Message);
91-
System.Threading.Thread.Sleep(3000);
92-
}
93-
9464
// Get IFME version
9565
try
9666
{

ifme/lang/eng.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Restart = Change has been made! Please restart program to take effect! Do you wa
7575
ResetSettingsAsk = Reset settings to default?
7676
ResetSettingsOK = Settings has been changed to default, please restart program to take effect!
7777
MKVOnly = MP4 does not support subtitle and attachment.
78+
NotEmptyFolder = Choose an empty folder.
7879

7980
[TheOptions]
8081
tabGeneral = General

ifme/lang/fre.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Restart = Changement effectu
7575
ResetSettingsAsk = Rétablir les paramètres par défaut?
7676
ResetSettingsOK = Paramètres par défaut rétabli, svp redémarrez le logiciel pour la prise en compte!
7777
MKVOnly = MP4 ne supporte pas les sous-titres et de l'attachement.
78+
NotEmptyFolder = Choisissez un dossier vide.
7879

7980
[TheOptions]
8081
tabGeneral = Général

ifme/lang/ind.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Restart = Perubahan telah dibuat! Mohon jalankan ulang program untuk menerapkann
7575
ResetSettingsAsk = Kembali ke pengaturan bawaan?
7676
ResetSettingsOK = Pengaturan telah diubah ke bawaan, mohon jalankan ulang program untuk menerapkannya!
7777
MKVOnly = MP4 tidak mendukung subtitel dan lampiran.
78+
NotEmptyFolder = Pilih folder kosong.
7879

7980
[TheOptions]
8081
tabGeneral = Umum

ifme/lang/jpn.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Restart = 変更されました!有効にするには、プログラムを再
7575
ResetSettingsAsk = 設定をデフォルトに戻しますか?
7676
ResetSettingsOK = 設定をデフォルトに戻しました。有効にするには、プログラムを再起動してください!
7777
MKVOnly = MP4は字幕をサポートしていません。
78+
NotEmptyFolder = 空のフォルダを選択してください。
7879

7980
[TheOptions]
8081
tabGeneral = 一般

0 commit comments

Comments
 (0)