Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/updater'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaeBee committed Dec 2, 2017
2 parents 5cd992f + bc839a8 commit e90c4b1
Show file tree
Hide file tree
Showing 15 changed files with 761 additions and 78 deletions.
6 changes: 6 additions & 0 deletions ESOResearchNotifier.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\..\..\Desktop\windows-toast-notifications-master\ToastNotifications\Notification.cs = ..\..\..\..\Desktop\windows-toast-notifications-master\ToastNotifications\Notification.cs
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{ABA321BB-7234-43B4-AF7D-EBB368A8CF45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,6 +22,10 @@ Global
{151E332F-672B-4717-899E-6D82C29B2DA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{151E332F-672B-4717-899E-6D82C29B2DA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{151E332F-672B-4717-899E-6D82C29B2DA6}.Release|Any CPU.Build.0 = Release|Any CPU
{ABA321BB-7234-43B4-AF7D-EBB368A8CF45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABA321BB-7234-43B4-AF7D-EBB368A8CF45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABA321BB-7234-43B4-AF7D-EBB368A8CF45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABA321BB-7234-43B4-AF7D-EBB368A8CF45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
166 changes: 91 additions & 75 deletions ESOResearchNotifier/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs
btnUpdate.Enabled = true;
prgUpdate.Visible = false;
prgUpdate.Enabled = false;
UpdateReady = true;
}

private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
Expand Down Expand Up @@ -446,7 +447,7 @@ private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
if (UpdateReady)
{
// Start Updater here
System.Diagnostics.Process.Start("Updater.exe");
}
}

Expand Down Expand Up @@ -560,107 +561,122 @@ protected override void WndProc(ref Message m)

public partial class Utility
{
public static void SortByTime(ControlCollection data, int l = 0, int r = -1)
public static void SortByTime(ControlCollection data)
{
if (r <= 0)
List<Control> NewData = new List<Control>();
Queue<Control> DataQueue = new Queue<Control>();

foreach (Control DataControl in data)
{
r = data.Count - 1;
if (DataControl is ResearchItem)
{
DataQueue.Enqueue(DataControl);
}
}

int i, j;
Control x;

i = l;
j = r;
Control tempControl = DataQueue.Dequeue();
NewData.Add(tempControl);

x = data[(l + r) / 2]; // find pivot item

if (x is ResearchItem)
while (DataQueue.Count > 0)
{

while (true)
Control TempControl = DataQueue.Dequeue();
int Index = 0;
foreach (Control LowControl in NewData)
{
while (((ResearchItem)data[i]).FinishTime < ((ResearchItem)x).FinishTime)
i++;
while (((ResearchItem)x).FinishTime < ((ResearchItem)data[j]).FinishTime)
j--;
if (i <= j)
if (((ResearchItem)TempControl).FinishTime > ((ResearchItem)LowControl).FinishTime)
{
data = exchange(data, i, j);
i++;
j--;
if (NewData.Count > Index + 1)
{
if (((ResearchItem)TempControl).FinishTime < ((ResearchItem)NewData[Index + 1]).FinishTime)
{
NewData.Insert(Index + 1, TempControl);
break;
}
else if (((ResearchItem)TempControl).FinishTime == ((ResearchItem)NewData[Index + 1]).FinishTime)
{
NewData.Insert(Index + 1, TempControl);
break;
}
}
else
{
NewData.Add(TempControl);
break;
}
}
if (i > j)
else
{
NewData.Insert(Index, TempControl);
break;
}
if (l < j)
{
SortByTime(data, l, j);
}
if (i < r)
{
SortByTime(data, i, r);
}
Index++;
}
}
}

public static void SortByName(ControlCollection data, int l = 0, int r = -1)
{
if (r <= 0)
data.Clear();
foreach (Control SortedData in NewData)
{
r = data.Count - 1;
data.Add(SortedData);
}
}

int i, j;
Control x;

i = l;
j = r;
public static void SortByName(ControlCollection data)
{
List<Control> NewData = new List<Control>();
Queue<Control> DataQueue = new Queue<Control>();

x = data[(l + r) / 2]; // find pivot item
foreach (Control DataControl in data)
{
if (DataControl is ResearchItem)
{
DataQueue.Enqueue(DataControl);
}
}

//MessageBox.Show(((ResearchItem)x).LabelText.CompareTo(((ResearchItem)data[j]).LabelText).ToString());
Control tempControl = DataQueue.Dequeue();
NewData.Add(tempControl);

if (x is ResearchItem)
while (DataQueue.Count > 0)
{

while (true)
Control TempControl = DataQueue.Dequeue();
int Index = 0;
foreach (Control LowControl in NewData)
{
while (((ResearchItem)data[i]).LabelText.CompareTo(((ResearchItem)x).LabelText) < 0)
i++;
while (((ResearchItem)x).LabelText.CompareTo(((ResearchItem)data[j]).LabelText) < 0)
j--;
if (i <= j)
if (((ResearchItem)TempControl).LabelText.CompareTo(((ResearchItem)LowControl).LabelText) > 0)
{
data = exchange(data, i, j);
i++;
j--;
if (NewData.Count > Index + 1)
{
if (((ResearchItem)TempControl).LabelText.CompareTo(((ResearchItem)NewData[Index + 1]).LabelText) < 0)
{
NewData.Insert(Index + 1, TempControl);
break;
}
else if (((ResearchItem)TempControl).LabelText.CompareTo(((ResearchItem)NewData[Index + 1]).LabelText) == 0)
{
NewData.Insert(Index + 1, TempControl);
break;
}
}
else
{
NewData.Add(TempControl);
break;
}
}
if (i > j)
else
{
NewData.Insert(Index, TempControl);
break;
}
if (l < j)
{
SortByName(data, l, j);
}
if (i < r)
{
SortByName(data, i, r);
}
Index++;
}
}
}

private static ControlCollection exchange(ControlCollection data, int m, int n)
{
Control temporary;

temporary = data[m];
data.SetChildIndex(data[m], n);
data.RemoveAt(n);
data.Add(temporary);
data.SetChildIndex(data[data.Count - 1], n);

return data;
data.Clear();
foreach (Control SortedData in NewData)
{
data.Add(SortedData);
}
}
}
}
4 changes: 2 additions & 2 deletions ESOResearchNotifier/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4")]
[assembly: AssemblyFileVersion("1.4")]
[assembly: AssemblyVersion("1.5")]
[assembly: AssemblyFileVersion("1.5")]
2 changes: 1 addition & 1 deletion ESOResearchNotifier/ResearchItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public ResearchItem()

public void Setup()
{
if (TimeLeft.TotalSeconds <= 0)
if (TimeLeft.TotalSeconds <= 0 && !Done)
{
Done = true;
ResearchDone?.Invoke(this, new EventArgs());
Expand Down
6 changes: 6 additions & 0 deletions Updater/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
81 changes: 81 additions & 0 deletions Updater/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e90c4b1

Please sign in to comment.