fixed some annoying bugs

This commit is contained in:
Bitl 2021-09-25 15:01:42 -07:00
parent f1324f3de9
commit b9f1c64554
3 changed files with 36 additions and 6 deletions

View File

@ -686,6 +686,9 @@ namespace NovetusLauncher
public void SwitchStyles()
{
if (LocalVars.launcherInitState)
return;
switch (StyleSelectorBox.SelectedIndex)
{
case 0:
@ -720,6 +723,8 @@ namespace NovetusLauncher
{
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
ResetMapIfNecessary();
CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
@ -895,6 +900,8 @@ namespace NovetusLauncher
public void RefreshMaps()
{
ResetMapIfNecessary();
Tree.Nodes.Clear();
_TreeCache.Nodes.Clear();
string mapdir = GlobalPaths.MapsDir;
@ -909,6 +916,11 @@ namespace NovetusLauncher
TreeNodeHelper.ListDirectory(Tree, mapdir, fileexts);
TreeNodeHelper.CopyNodes(Tree.Nodes, _TreeCache.Nodes);
Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes);
if (FormStyle == Settings.Style.Stylish)
{
Tree.SelectedNode.BackColor = SystemColors.Highlight;
Tree.SelectedNode.ForeColor = SystemColors.HighlightText;
}
Tree.Focus();
if (FormStyle != Settings.Style.Stylish)
@ -917,6 +929,16 @@ namespace NovetusLauncher
}
}
public void ResetMapIfNecessary()
{
if (!File.Exists(GlobalVars.UserConfiguration.MapPath))
{
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
}
}
public void RestartLauncherAfterSetting(CheckBox box, string title, string subText)
{
RestartLauncherAfterSetting(box.Checked, title, subText);
@ -956,6 +978,9 @@ namespace NovetusLauncher
private void LoadMapDesc()
{
if (Tree.SelectedNode == null)
return;
if (File.Exists(GlobalPaths.RootPath + @"\\" + Tree.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt"))
{
MapDescBox.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + Tree.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt");
@ -1182,7 +1207,6 @@ namespace NovetusLauncher
try
{
GlobalFuncs.RenameFileWithInvalidChars(mapname);
GlobalFuncs.FixedFileCopy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true);
}
catch (Exception ex)
@ -1196,9 +1220,7 @@ namespace NovetusLauncher
if (success)
{
RefreshMaps();
Tree.SelectedNode = TreeNodeHelper.SearchTreeView(mapname, Tree.Nodes);
Tree.Focus();
MessageBox.Show("The map '" + mapname + "' was successfully added to Novetus!" , "Novetus - Map Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("The map '" + mapname + "' was successfully added to Novetus! Look in the 'Custom' folder for it!" , "Novetus - Map Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

View File

@ -61,6 +61,8 @@ namespace NovetusLauncher
launcherFormStylishInterface1.versionLabel.Content = Application.ProductVersion;
launcherFormStylishInterface1.versionNovetusLabel.Content = GlobalVars.ProgramInformation.Version;
ReadConfigValues(true);
if (launcherFormStylishInterface1.playTab != null && launcherFormStylishInterface1.playTab.IsSelected)
{
if (launcherFormStylishInterface1.mapsBox.Nodes.Count == 0)
@ -72,8 +74,6 @@ namespace NovetusLauncher
launcherFormStylishInterface1.ToggleServerOptions();
ReadConfigValues(true);
LocalVars.launcherInitState = false;
CenterToScreen();
}
@ -118,6 +118,8 @@ namespace NovetusLauncher
{
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
launcherFormStylishInterface1.launcherForm.ResetMapIfNecessary();
launcherFormStylishInterface1.minimizeOnLaunchBox.IsChecked = GlobalVars.UserConfiguration.CloseOnLaunch;
launcherFormStylishInterface1.userIDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
launcherFormStylishInterface1.tripcodeLabel.Content = GlobalVars.UserConfiguration.PlayerTripcode.ToString();

View File

@ -99,6 +99,9 @@ namespace NovetusLauncher
public void LoadMapDesc()
{
if (mapsBox.SelectedNode == null)
return;
if (File.Exists(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt"))
{
mapsDescBox.Text = mapsBox.SelectedNode.Text + ": " + File.ReadAllText(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt");
@ -461,6 +464,9 @@ namespace NovetusLauncher
if (!IsLoaded)
return;
if (LocalVars.launcherInitState)
return;
styleBox.Text = styleBox.SelectedItem.ToString();
switch (styleBox.SelectedIndex)