Skip to content

Commit 041e44b

Browse files
author
Dương Diệu Pháp
committed
Fix bugs: Auto update and ExtraExtensions registry
- Fix bug: checking for update will not start if AutoUpdate key in registry doesn't exist - Fix bug: ExtraExtensions will get default value in the first time of new version running.
1 parent 0132673 commit 041e44b

File tree

11 files changed

+33
-76
lines changed

11 files changed

+33
-76
lines changed

Source/ImageGlass/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void Main(string[] argv)
4242
Application.SetCompatibleTextRenderingDefault(false);
4343

4444
//auto update----------------------------------------------------------------
45-
string s = GlobalSetting.GetConfig("AutoUpdate", DateTime.Now.ToString());
45+
string s = GlobalSetting.GetConfig("AutoUpdate", "1/1/2015 0:0:0");
4646

4747
if (s != "0")
4848
{
@@ -54,12 +54,12 @@ static void Main(string[] argv)
5454
if (DateTime.Now.Subtract(lastUpdate).TotalDays > 7)
5555
{
5656
Process p = new Process();
57-
p.StartInfo.FileName = (Application.StartupPath + "\\").Replace("\\\\", "\\") + "igcmd.exe";
57+
p.StartInfo.FileName = GlobalSetting.StartUpDir + "igcmd.exe";
5858
p.StartInfo.Arguments = "igautoupdate";
5959
p.Start();
6060
}
6161
}
62-
}
62+
}
6363

6464
//get current config
6565
GlobalSetting.IsAllowMultiInstances = bool.Parse(GlobalSetting.GetConfig("IsAllowMultiInstances", "true"));

Source/ImageGlass/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.0.9.20")]
36-
[assembly: AssemblyFileVersion("3.0.9.20")]
35+
[assembly: AssemblyVersion("3.0.9.19")]
36+
[assembly: AssemblyFileVersion("3.0.9.19")]

Source/ImageGlass/frmMain.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,6 @@ private void LoadTheme()
10041004
/// </summary>
10051005
private void LoadConfig()
10061006
{
1007-
GlobalSetting.SetConfig("igVersion", Application.ProductVersion.ToString());
1008-
10091007
//Load language pack-------------------------------------------------------------
10101008
string s = GlobalSetting.GetConfig("Language", "English");
10111009
if (s.ToLower().CompareTo("english") != 0 && File.Exists(s))
@@ -1018,7 +1016,7 @@ private void LoadConfig()
10181016
}
10191017

10201018
//Windows Bound (Position + Size)------------------------------------------------
1021-
Rectangle rc = GlobalSetting.StringToRect(GlobalSetting.GetConfig("WindowsBound", "280,125,750,545"));
1019+
Rectangle rc = GlobalSetting.StringToRect(GlobalSetting.GetConfig("WindowsBound", "280,125,850,550"));
10221020
this.Bounds = rc;
10231021

10241022
//windows state--------------------------------------------------------------
@@ -1032,8 +1030,13 @@ private void LoadConfig()
10321030
this.WindowState = FormWindowState.Maximized;
10331031
}
10341032

1035-
//Load Extra extensions
1036-
GlobalSetting.SupportedExtraExtensions = GlobalSetting.GetConfig("ExtraExtensions", GlobalSetting.SupportedExtraExtensions);
1033+
//check current version for the first time running
1034+
s = GlobalSetting.GetConfig("igVersion", Application.ProductVersion);
1035+
if (s.CompareTo(Application.ProductVersion) == 0) //Old version
1036+
{
1037+
//Load Extra extensions
1038+
GlobalSetting.SupportedExtraExtensions = GlobalSetting.GetConfig("ExtraExtensions", GlobalSetting.SupportedExtraExtensions);
1039+
}
10371040

10381041
//Load theme--------------------------------------------------------------------
10391042
LoadTheme();
@@ -1113,6 +1116,8 @@ private void LoadConfig()
11131116
/// </summary>
11141117
private void SaveConfig()
11151118
{
1119+
GlobalSetting.SetConfig("igVersion", Application.ProductVersion.ToString());
1120+
11161121
if (this.WindowState == FormWindowState.Normal)
11171122
{
11181123
//Windows Bound-------------------------------------------------------------------
Binary file not shown.

Source/ImageGlass/obj/Debug/ImageGlass.csproj.FileListAbsolute.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\ImageGlass
112112
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\ImageGlass.Services.dll
113113
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\ImageGlass.Theme.dll
114114
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\System.Drawing.PSD.dll
115+
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\Svg.dll
115116
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\FreeImageNET.dll
116117
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\TargaImage.dll
117118
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\ImageGlass.ImageBox.pdb
@@ -140,4 +141,3 @@ F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\obj\Debug\ImageGlass
140141
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\obj\Debug\ImageGlass.csproj.GenerateResource.Cache
141142
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\obj\Debug\ImageGlass.exe
142143
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\obj\Debug\ImageGlass.pdb
143-
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Debug\Svg.dll
Binary file not shown.

Source/ImageGlass/obj/Release/ImageGlass.csproj.FileListAbsolute.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGla
4747
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGlass.Theme.dll
4848
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\Ionic.Zip.dll
4949
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\System.Drawing.PSD.dll
50+
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\Svg.dll
51+
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\FreeImageNET.dll
5052
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\TargaImage.dll
5153
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGlass.ImageBox.pdb
5254
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGlass.ImageBox.xml
@@ -61,6 +63,7 @@ F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGla
6163
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGlass.Theme.pdb
6264
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\ImageGlass.FileList.pdb
6365
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\Facebook.xml
66+
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\System.Drawing.PSD.pdb
6467
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\de\ImageGlass.ImageListView.resources.dll
6568
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\bin\Release\tr\ImageGlass.ImageListView.resources.dll
6669
F:\PHAPSOFTWARE\ImageGlass\Git\ImageGlass\Source\ImageGlass\obj\Release\ImageGlass.csprojResolveAssemblyReference.cache

Source/Ultilities/igcmd/Core.cs

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static string Path
4545
}
4646

4747
/// <summary>
48-
/// Đóng gói theme thành *.igtheme
48+
/// Pack theme *.igtheme
4949
/// </summary>
5050
/// <param name="dir">Thư mục chứa tập tin</param>
5151
/// <param name="des">Đường dẫn tập tin *.igtheme</param>
@@ -93,7 +93,7 @@ public static void PackTheme(string src, string des)
9393
}
9494

9595
/// <summary>
96-
/// Tính năng tự động kiểm tra cập nhật
96+
/// Check for update
9797
/// </summary>
9898
public static void AutoUpdate()
9999
{
@@ -105,9 +105,8 @@ public static void AutoUpdate()
105105
File.Delete(GlobalSetting.StartUpDir + "update.xml");
106106
}
107107

108-
GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.Day.ToString() + "/" +
109-
DateTime.Now.Month.ToString() + "/" +
110-
DateTime.Now.Year.ToString());
108+
//save last update
109+
GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
111110

112111
if (up.CheckForUpdate(Application.StartupPath + "\\ImageGlass.exe") &&
113112
up.Info.VersionType.ToLower() == "stable")
@@ -120,7 +119,7 @@ public static void AutoUpdate()
120119
}
121120

122121
/// <summary>
123-
/// Kiểm tra cập nhật
122+
/// Check for update
124123
/// </summary>
125124
public static void CheckForUpdate()
126125
{
@@ -138,48 +137,12 @@ public static void Upload(string cmd, string filename)
138137
}
139138

140139
/// <summary>
141-
/// Cài đặt theme
140+
/// Install theme
142141
/// </summary>
143142
public static void InstallTheme(string filename)
144143
{
145144
Application.Run(new frmInstallTheme(filename));
146145
}
147-
148-
/// <summary>
149-
/// Đăng ký theo dõi thông tin từ ImageGlass
150-
/// </summary>
151-
public static void Follow()
152-
{
153-
Application.Run(new frmFollow());
154-
}
155-
156-
/// <summary>
157-
/// Tạo mới gói ngôn ngữ
158-
/// </summary>
159-
public static void NewLanguage()
160-
{
161-
162-
}
163-
164-
/// <summary>
165-
/// Chỉnh sửa gói ngôn ngữ
166-
/// </summary>
167-
/// <param name="filename">Đường dẫn của tập tin</param>
168-
public static void EditLanguage(string filename)
169-
{
170-
Process p = new Process();
171-
p.StartInfo.FileName = "notepad.exe";
172-
p.StartInfo.Arguments = "\"" + filename + "\"";
173-
p.Start();
174-
}
175-
176-
/// <summary>
177-
/// Viết review
178-
/// </summary>
179-
public static void Social()
180-
{
181-
Application.Run(new frmReview());
182-
}
183-
146+
184147
}
185148
}

Source/Ultilities/igcmd/Program.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ static void Main(string[] argv)
4343
Application.SetCompatibleTextRenderingDefault(false);
4444
string topcmd = args[0].ToLower().Trim();
4545

46-
if (topcmd == "igsocial")
47-
{
48-
Core.Social();
49-
}
50-
else if (topcmd == "igupdate")//kiem tra phien ban
46+
if (topcmd == "igupdate")//kiem tra phien ban
5147
{
5248
Core.CheckForUpdate();
5349
}
@@ -68,19 +64,6 @@ static void Main(string[] argv)
6864
{
6965
Core.InstallTheme(args[1]);
7066
}
71-
else if (topcmd == "igfollow")//đăng ký theo dõi thông tin ImageGlass
72-
{
73-
Core.Follow();
74-
}
75-
else if (topcmd == "ignewlang")//tạo mới 1 gói ngôn ngữ
76-
{
77-
Core.NewLanguage();
78-
}
79-
else if (topcmd == "igeditlang")//chỉnh sửa gói ngôn ngữ
80-
{
81-
//cmd: igcmd.exe igeditlang "srcFile"
82-
Core.EditLanguage(args[1]);
83-
}
8467
}
8568

8669

Source/Ultilities/igcmd/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("PhapSoftware")]
1212
[assembly: AssemblyProduct("igcmd")]
13-
[assembly: AssemblyCopyright("Copyright © 2013 by Duong Dieu Phap")]
13+
[assembly: AssemblyCopyright("Copyright © 2013 - 2015 by Duong Dieu Phap")]
1414
[assembly: AssemblyTrademark("ImageGlass")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.5.22.0")]
36-
[assembly: AssemblyFileVersion("1.5.22.0")]
35+
[assembly: AssemblyVersion("1.6.9.0")]
36+
[assembly: AssemblyFileVersion("1.6.9.0")]

0 commit comments

Comments
 (0)