Skip to content

Commit

Permalink
Fixed price alert + directory checks
Browse files Browse the repository at this point in the history
  • Loading branch information
query-wow committed Jan 28, 2022
1 parent b53e023 commit 07cf2e1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
20 changes: 17 additions & 3 deletions TauriTSMAppDataFetcher/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public MainForm()
serverSelectorCombo.DropDownStyle = ComboBoxStyle.DropDownList;
TrayIcon.MouseDoubleClick += TrayIcon_MouseDoubleClick;

//FetchAppData();
FetchAppData();

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

Expand Down Expand Up @@ -165,6 +165,20 @@ private void FetchAppData()
if (Settings.Default.WoWLocation + "" == "")
return;


string folderPath = Path.Combine(Settings.Default.WoWLocation, "Interface", "AddOns", "TradeSkillMaster_AuctionDB");
try
{
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
}
catch
{
MessageBox.Show($"Unable to create path {folderPath}. Try to run this app as admin.");
return;
}
try
{
string baseUrl = "https://tsm.topsoft4u.com/get-tsm-appdata?realms[tauri]={0}&realms[mistblade]={1}";
Expand Down Expand Up @@ -196,9 +210,9 @@ private void FetchAppData()
wc.DownloadFile(string.Format(calculatedUrl), Path.Combine(Settings.Default.WoWLocation, "Interface", "AddOns", "TradeSkillMaster_AuctionDB", "AppData.lua"));
}
}
catch (Exception)
catch (Exception ex)
{
MessageBox.Show(Path.Combine(Settings.Default.WoWLocation, "Interface", "AddOns", "TradeSkillMaster_AuctionDB") + " folder not found. Please install TSM");
MessageBox.Show(ex.Message);
}
}

Expand Down
22 changes: 21 additions & 1 deletion TauriTSMAppDataFetcher/PriceTracking/PriceTrackerUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,27 @@ public static void PriceTrackerRequest()
lastNotify = DateTime.Now;
}
};
wc.UploadStringAsync(new Uri("https://tsm.topsoft4u.com/check-prices"), "POST", json);

string baseUrl = "https://tsm.topsoft4u.com/check-prices?realms[tauri]={0}&realms[mistblade]={1}";
string calculatedUrl = null;
Servers selectedRealm = (Servers)Settings.Default.SelectedServer;
switch (selectedRealm)
{
case Servers.Both:
MessageBox.Show("You cannot track items for both realms");
return;
case Servers.Tauri:
calculatedUrl = string.Format(baseUrl, 1, 0);
break;
case Servers.Stormforge:
calculatedUrl = string.Format(baseUrl, 0, 1);
break;
default:
break;
}


wc.UploadStringAsync(new Uri(calculatedUrl), "POST", json);
}
}
catch (Exception ex)
Expand Down

0 comments on commit 07cf2e1

Please sign in to comment.