Skip to content

Commit

Permalink
버그 수정, 리팩토링
Browse files Browse the repository at this point in the history
1. \n이 2번 출력되는 문제 해결
2. 모듈을 로드하지 않고 종료할 때, freeLibrary 호출 안함.
3. 불필요 괄호 삭제.
  • Loading branch information
synml committed Jan 23, 2019
1 parent 650d3cd commit 34bb8e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SamFirm/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static Firmware UpdateCheck(string model, string region, string pda, stri
{
Logger.WriteLog("LogicValue: " + firmware.LogicValueHome);
}
Logger.WriteLog("\n");
Logger.WriteLog("");
return firmware;
}

Expand Down
7 changes: 5 additions & 2 deletions SamFirm/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private void InitializeComponent()
this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.groupBox3.Size = new System.Drawing.Size(333, 103);
this.groupBox3.Size = new System.Drawing.Size(333, 107);
this.groupBox3.TabIndex = 17;
this.groupBox3.TabStop = false;
//
Expand Down Expand Up @@ -826,6 +826,7 @@ private void Update_button_Click(object sender, EventArgs e)
return;
}

//백그라운드 작업 등록
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate (object o, DoWorkEventArgs _e)
{
Expand Down Expand Up @@ -864,7 +865,7 @@ private void Update_button_Click(object sender, EventArgs e)
this.version_textbox.Invoke(invoker2);
if (invoker3 == null)
{
invoker3 = () => this.size_textbox.Text = ((long.Parse(this.FW.Size) / 0x400L) / 0x400L) + " MB";
invoker3 = () => this.size_textbox.Text = (long.Parse(this.FW.Size) / 0x400L / 0x400L) + " MB";
}
this.size_textbox.Invoke(invoker3);
}
Expand Down Expand Up @@ -894,6 +895,8 @@ private void Update_button_Click(object sender, EventArgs e)
Logger.WriteLog(exception.ToString());
}
};

//백그라운드 작업 실행
worker.RunWorkerAsync();
}

Expand Down
9 changes: 6 additions & 3 deletions SamFirm/Imports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ internal class Imports
private static extern bool FreeLibrary(IntPtr hModule);
public static void FreeModule()
{
if (!FreeLibrary(mod))
if (mod != IntPtr.Zero)
{
Logger.WriteLog("Error: Unable to free library");
if (!FreeLibrary(mod))
{
Logger.WriteLog("Error: Unable to free library");
}
mod = IntPtr.Zero;
}
mod = IntPtr.Zero;
}

//권한을 얻는 메소드
Expand Down

0 comments on commit 34bb8e6

Please sign in to comment.