Skip to content

Commit

Permalink
mod installation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ComputerElite authored Aug 20, 2021
1 parent 78a2018 commit a41557b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 27 deletions.
4 changes: 1 addition & 3 deletions C#/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public partial class MainWindow : Window
{
public static int MajorV = 1;
public static int MinorV = 16;
public static int PatchV = 3;
public static int PatchV = 4;
public static bool Preview = false;
public static bool log = false;

Expand Down Expand Up @@ -653,7 +653,6 @@ public void StartBMBFUpdate()
{
txtbox.AppendText("\n\n" + globalLanguage.processer.ReturnProcessed(globalLanguage.mainMenu.code.playlistBackup, exe + "\\Backup\\Playlists.json"));
txtbox.ScrollToEnd();
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));

if (!aDBI.adb("pull /sdcard/BMBFData/Playlists/ \"" + exe + "\\Backup\"", txtbox)) return;

Expand All @@ -663,7 +662,6 @@ public void StartBMBFUpdate()
File.WriteAllText(exe + "\\Backup\\Playlists.json", j["Config"].ToString());
txtbox.AppendText("\n\n" + globalLanguage.processer.ReturnProcessed(globalLanguage.mainMenu.code.playlistBackupFinished, exe + "\\Backup\\Playlists.json"));
txtbox.ScrollToEnd();
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
}
catch
{
Expand Down
2 changes: 1 addition & 1 deletion C#/ModObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public List<Mod> MergeModLists(ModList primary, ModList secondary, BMBFC BMBF, i
}
}

if (!d.download.EndsWith(".zip")) tmp[i - removed].downloads[tmp[i - removed].MatchingDownload].forward = true;
if (!d.download.EndsWith(".zip") && !d.download.ToLower().EndsWith(".qmod")) tmp[i - removed].downloads[tmp[i - removed].MatchingDownload].forward = true;
break;
}
gv++;
Expand Down
52 changes: 37 additions & 15 deletions C#/Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public partial class Mods : Window
BMBFC BMBF = new BMBFC();
int C = 0;
int Index = 0;
int major = 0;
int minor = 0;
int patch = 0;

public Mods()
{
Expand Down Expand Up @@ -113,9 +116,9 @@ public void getMods()
}
String[] GameVersion = MainWindow.config.GameVersion.ToString().Replace("\"", "").Split('.');
//String[] GameVersion = "1.13.2".Replace("\"", "").Split('.');
int major = Convert.ToInt32(GameVersion[0]);
int minor = Convert.ToInt32(GameVersion[1]);
int patch = Convert.ToInt32(GameVersion[2]);
major = Convert.ToInt32(GameVersion[0]);
minor = Convert.ToInt32(GameVersion[1]);
patch = Convert.ToInt32(GameVersion[2]);

ModList QB = new ModList();

Expand Down Expand Up @@ -167,7 +170,6 @@ private void updatemodlist(Boolean downloadbmbf = true)
{
if(downloadbmbf)
{
WebClient client = new WebClient();
try
{
BMBF = BMBFUtils.GetBMBFConfig();
Expand All @@ -178,6 +180,19 @@ private void updatemodlist(Boolean downloadbmbf = true)
txtbox.ScrollToEnd();
}
}
for (int ii = 0; ii < AllModList.Count; ii++)
{
foreach (BMBF.Config.Mod m in BMBF.Config.Mods)
{
if (m.Id == AllModList[ii].ModID)
{
AllModList[ii].installed = true;
AllModList[ii].Version = m.Version;
AllModList[ii].GameVersion = m.Version;
break;
}
}
}
ModList.Items.Clear();
foreach (ModObjects.Mod cmod in AllModList)
{
Expand Down Expand Up @@ -366,7 +381,7 @@ public void InstallMod()
DownloadLable.Text = MainWindow.globalLanguage.processer.ReturnProcessed(MainWindow.globalLanguage.mods.code.downloadingMod, AllModList[Index].name);
c.DownloadFileCompleted += new AsyncCompletedEventHandler(finished_download);
c.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
c.DownloadFileAsync(uri, exe + "\\tmp\\" + AllModList[Index].name + C + ".zip");
c.DownloadFileAsync(uri, exe + "\\tmp\\" + AllModList[Index].name + C + "." + System.IO.Path.GetExtension(Download));
}));
}
catch
Expand Down Expand Up @@ -489,7 +504,7 @@ private void finished_download(object sender, AsyncCompletedEventArgs e)
txtbox.AppendText("\n" + MainWindow.globalLanguage.processer.ReturnProcessed(MainWindow.globalLanguage.mods.code.downloadedMod, AllModList[Index].name));
txtbox.ScrollToEnd();
}));
upload(exe + "\\tmp\\" + AllModList[Index].name + C + ".zip");
upload(exe + "\\tmp\\" + AllModList[Index].name + C + "." + System.IO.Path.GetExtension(AllModList[Index].downloads[AllModList[Index].MatchingDownload].download));
}

public void upload(String path)
Expand Down Expand Up @@ -589,18 +604,25 @@ public ModItem(String Name, String Creator, String GameVersion, String ModVersio
} else
{
this.ModVersion = ModVersion;
if(!downloadable)
{
newColor.Color = Colors.Yellow;
}
else if (new Version(ModVersion).CompareTo(new Version(latest)) != -1)
try
{
newColor.Color = Colors.Green;
}
else
if (!downloadable)
{
newColor.Color = Colors.Yellow;
}
else if (new Version(ModVersion).CompareTo(new Version(latest)) != -1)
{
newColor.Color = Colors.Green;
}
else
{
newColor.Color = Colors.Red;
}
} catch
{
newColor.Color = Colors.Red;
newColor.Color = Colors.Yellow;
}

}
this.Color = newColor;
}
Expand Down
9 changes: 1 addition & 8 deletions C#/Support.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,7 @@ public async void StartSupport(String Link)
s.InstallSong(bsr);
this.Close();
}
else if(section.StartsWith("support/resetassets"))
{
BackupPlaylists();
resetassets();
reloadsongsfolder();
RestorePlaylists();
this.Close();
} else if(section.StartsWith("support/quickfix"))
else if(section.StartsWith("support/quickfix"))
{
BackupPlaylists();
resetassets();
Expand Down

0 comments on commit a41557b

Please sign in to comment.