Skip to content

Commit 77e7fc8

Browse files
committed
Removed twitch extension code
1 parent 259b01f commit 77e7fc8

File tree

8 files changed

+10
-453
lines changed

8 files changed

+10
-453
lines changed

Heroesprofile.Uploader.Common/ILiveProcessor.cs

-11
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@ namespace Heroesprofile.Uploader.Common
66
public interface ILiveProcessor
77
{
88
bool PreMatchPage { get; set; }
9-
bool TwitchExtension { get; set; }
10-
11-
string hpTwitchAPIKey { get; set; }
12-
string hpAPIEmail { get; set; }
13-
string twitchNickname { get; set; }
14-
int hpAPIUserID { get; set; }
15-
16-
179
Task StartProcessing(string battleLobbyPath);
18-
Task UpdateData(string stormSavePath);
19-
20-
Task saveMissingTalentData(string stormReplayPath);
2110
}
2211
}

Heroesprofile.Uploader.Common/LiveProcessor.cs

+2-384
Large diffs are not rendered by default.

Heroesprofile.Uploader.Common/Manager.cs

+4-39
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,9 @@ public class Manager : INotifyPropertyChanged
3939
public event PropertyChangedEventHandler PropertyChanged;
4040

4141

42-
public string hpTwitchAPIKey { get; set; }
43-
public string hpAPIEmail { get; set; }
44-
public string twitchNickname { get; set; }
45-
public int hpAPIUserID { get; set; }
46-
4742
public bool PreMatchPage { get; set; }
4843
public bool PostMatchPage { get; set; }
49-
public bool TwitchExtension { get; set; }
44+
5045

5146
private string _status = "";
5247

@@ -109,24 +104,11 @@ public async void Start(IMonitor monitor, ILiveMonitor live_monitor, IAnalyzer a
109104

110105
_monitor.ReplayAdded += async (_, e) => {
111106
await EnsureFileAvailable(e.Data);
112-
if (PreMatchPage || TwitchExtension) {
113-
114-
115-
if (TwitchExtension) {
116-
await EnsureFileAvailable(e.Data);
117-
var tmpPath = Path.GetTempFileName();
118-
await SafeCopy(e.Data, tmpPath, true);
119-
await _liveProcessor.saveMissingTalentData(tmpPath);
120-
}
107+
if (PreMatchPage) {
121108

122109
_live_monitor.StopBattleLobbyWatcher();
123110
_live_monitor.StopStormSaveWatcher();
124-
125111
_live_monitor = new LiveMonitor();
126-
127-
if (PreMatchPage || TwitchExtension) {
128-
StartBattleLobbyWatcherEvent();
129-
}
130112
}
131113

132114
var replay = new ReplayFile(e.Data);
@@ -146,42 +128,25 @@ public async void Start(IMonitor monitor, ILiveMonitor live_monitor, IAnalyzer a
146128
}
147129
private void StartBattleLobbyWatcherEvent()
148130
{
149-
if (PreMatchPage || TwitchExtension) {
131+
if (PreMatchPage) {
150132
_live_monitor.TempBattleLobbyCreated += async (_, e) => {
151133

152134
_live_monitor.StopBattleLobbyWatcher();
153-
_liveProcessor = new LiveProcessor(PreMatchPage, TwitchExtension, hpTwitchAPIKey, hpAPIEmail, twitchNickname, hpAPIUserID);
135+
_liveProcessor = new LiveProcessor(PreMatchPage);
154136

155137
await EnsureFileAvailable(e.Data);
156138
var tmpPath = Path.GetTempFileName();
157139
await SafeCopy(e.Data, tmpPath, true);
158140
await _liveProcessor.StartProcessing(tmpPath);
159141

160142

161-
if (TwitchExtension) {
162-
StartStormSaveWatcherEvent();
163-
}
164143

165144
};
166145

167146
_live_monitor.StartBattleLobby();
168147
}
169148
}
170149

171-
private void StartStormSaveWatcherEvent()
172-
{
173-
if (TwitchExtension) {
174-
_live_monitor.StormSaveCreated += async (_, e) => {
175-
Thread.Sleep(1000);
176-
await EnsureFileAvailable(e.Data);
177-
var tmpPath = Path.GetTempFileName();
178-
await SafeCopy(e.Data, tmpPath, true);
179-
await _liveProcessor.UpdateData(tmpPath);
180-
};
181-
_live_monitor.StartStormSave();
182-
}
183-
}
184-
185150
public void Stop()
186151
{
187152
_monitor.Stop();

Heroesprofile.Uploader.Windows/App.xaml.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
114114

115115
Manager.PreMatchPage = Settings.PreMatchPage;
116116
Manager.PostMatchPage = Settings.PostMatchPage;
117-
Manager.TwitchExtension = Settings.HPTwitchExtension;
118-
Manager.hpTwitchAPIKey = Settings.HPKey;
119-
Manager.hpAPIEmail = Settings.HPAPIEmail;
120-
Manager.twitchNickname = Settings.TwitchNickname;
121-
Manager.hpAPIUserID = Settings.HPAPIUserID;
117+
122118
Manager.DeleteAfterUpload = Settings.DeleteAfterUpload;
123119

124120
ApplyTheme(Settings.Theme);
@@ -140,7 +136,6 @@ private void Application_Startup(object sender, StartupEventArgs e)
140136
}
141137

142138
if (ev.PropertyName == nameof(Settings.HPTwitchExtension)) {
143-
Manager.TwitchExtension = Settings.HPTwitchExtension;
144139
}
145140
};
146141

@@ -152,7 +147,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
152147
mainWindow = new MainWindow();
153148
mainWindow.Show();
154149
}
155-
Manager.Start(new Monitor(), new LiveMonitor(), new Analyzer(), new Common.Uploader(), new LiveProcessor(Manager.PreMatchPage, Manager.TwitchExtension, Manager.hpTwitchAPIKey, Manager.hpAPIEmail, Manager.twitchNickname, Manager.hpAPIUserID));
150+
Manager.Start(new Monitor(), new LiveMonitor(), new Analyzer(), new Common.Uploader(), new LiveProcessor(Manager.PreMatchPage));
156151

157152
#pragma warning disable 162
158153
if (!NoSquirrel) {

Heroesprofile.Uploader.Windows/MainWindow.xaml.cs

-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ public MainWindow()
2222

2323
private void Twitch_Extension_Checkbox_Checked(object sender, RoutedEventArgs e)
2424
{
25-
App.Manager.TwitchExtension = true;
2625
}
2726

2827
private void Twitch_Extension_Checkbox_Unchecked(object sender, RoutedEventArgs e)
2928
{
30-
App.Manager.TwitchExtension = false;
3129
}
3230

3331
private void Window_StateChanged(object sender, EventArgs e)

Heroesprofile.Uploader.Windows/Program.cs

-7
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ public static void Main(string[] args)
3535
Directory.CreateDirectory(App.SettingsDir);
3636
}
3737

38-
// Move files from old locations
39-
if (File.Exists($@"{App.AppDir}\..\replays_v4.xml") && !File.Exists($@"{App.SettingsDir}\replays_v4.xml")) {
40-
File.Move($@"{App.AppDir}\..\replays.replays_v4", $@"{App.SettingsDir}\replays_v4.xml");
41-
}
42-
if (File.Exists($@"{App.AppDir}\..\last.config") && !File.Exists($@"{App.SettingsDir}\last.config")) {
43-
File.Move($@"{App.AppDir}\..\last.config", $@"{App.SettingsDir}\last.config");
44-
}
4538

4639
SingleInstanceManager manager = new SingleInstanceManager();
4740
manager.Run(args);

Heroesprofile.Uploader.Windows/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
// You can specify all the values or you can default the Build and Revision Numbers
5353
// by using the '*' as shown below:
5454
// [assembly: AssemblyVersion("1.0.*")]
55-
[assembly: AssemblyVersion("2.0.9")]
56-
[assembly: AssemblyFileVersion("2.0.9")]
55+
[assembly: AssemblyVersion("2.1.0")]
56+
[assembly: AssemblyFileVersion("2.1.0")]
5757
[assembly: AssemblyInformationalVersion("1.0.0")]

Heroesprofile.Uploader.Windows/SettingsWindow.xaml.cs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace Heroesprofile.Uploader.Windows
1919
/// </summary>
2020
public partial class SettingsWindow : Window
2121
{
22-
private bool showHideButton = true;
2322
public SettingsWindow()
2423
{
2524
InitializeComponent();

0 commit comments

Comments
 (0)