fix certain bugs
This commit is contained in:
parent
28070e1aaa
commit
7df557baa8
|
|
@ -211,8 +211,9 @@ public class GlobalFuncs
|
||||||
GlobalVars.UserConfiguration.DiscordPresence = Convert.ToBoolean(discord);
|
GlobalVars.UserConfiguration.DiscordPresence = Convert.ToBoolean(discord);
|
||||||
GlobalVars.UserConfiguration.MapPathSnip = mapsnip;
|
GlobalVars.UserConfiguration.MapPathSnip = mapsnip;
|
||||||
|
|
||||||
|
string oldMapath = Path.GetDirectoryName(GlobalVars.UserConfiguration.MapPath);
|
||||||
//update the map path if the file doesn't exist and write to config.
|
//update the map path if the file doesn't exist and write to config.
|
||||||
if (File.Exists(mappath))
|
if (oldMapath.Equals(GlobalPaths.MapsDir.Replace(@"\\", @"\")) && File.Exists(mappath))
|
||||||
{
|
{
|
||||||
GlobalVars.UserConfiguration.MapPath = mappath;
|
GlobalVars.UserConfiguration.MapPath = mappath;
|
||||||
}
|
}
|
||||||
|
|
@ -1760,28 +1761,50 @@ public class GlobalFuncs
|
||||||
SizeSuffixes[mag]);
|
SizeSuffixes[mag]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://www.meziantou.net/getting-the-date-of-build-of-a-dotnet-assembly-at-runtime.htm
|
//https://stackoverflow.com/questions/11927116/getting-files-recursively-skip-files-directories-that-cannot-be-read
|
||||||
public static DateTime GetLinkerTimestampUtc(Assembly assembly)
|
public static string[] FindAllFiles(string rootDir)
|
||||||
{
|
{
|
||||||
var location = assembly.Location;
|
var pathsToSearch = new Queue<string>();
|
||||||
return GetLinkerTimestampUtc(location);
|
var foundFiles = new List<string>();
|
||||||
}
|
|
||||||
|
|
||||||
public static DateTime GetLinkerTimestampUtc(string filePath)
|
pathsToSearch.Enqueue(rootDir);
|
||||||
{
|
|
||||||
const int peHeaderOffset = 60;
|
|
||||||
const int linkerTimestampOffset = 8;
|
|
||||||
var bytes = new byte[2048];
|
|
||||||
|
|
||||||
using (var file = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
while (pathsToSearch.Count > 0)
|
||||||
{
|
{
|
||||||
file.Read(bytes, 0, bytes.Length);
|
var dir = pathsToSearch.Dequeue();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var files = Directory.GetFiles(dir);
|
||||||
|
foreach (var file in Directory.GetFiles(dir))
|
||||||
|
{
|
||||||
|
foundFiles.Add(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var subDir in Directory.GetDirectories(dir))
|
||||||
|
{
|
||||||
|
pathsToSearch.Enqueue(subDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception /* TODO: catch correct exception */)
|
||||||
|
{
|
||||||
|
// Swallow. Gulp!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var headerPos = BitConverter.ToInt32(bytes, peHeaderOffset);
|
return foundFiles.ToArray();
|
||||||
var secondsSince1970 = BitConverter.ToInt32(bytes, headerPos + linkerTimestampOffset);
|
}
|
||||||
var dt = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
|
||||||
return dt.AddSeconds(secondsSince1970);
|
//https://stackoverflow.com/questions/66667263/i-want-to-remove-special-characters-from-file-name-without-affecting-extension-i
|
||||||
|
//https://stackoverflow.com/questions/3218910/rename-a-file-in-c-sharp
|
||||||
|
public static void RenameFileWithInvalidChars(string path)
|
||||||
|
{
|
||||||
|
string pathWithoutFilename = Path.GetDirectoryName(path);
|
||||||
|
string fileName = Path.GetFileName(path);
|
||||||
|
fileName = Regex.Replace(fileName, @"[^\w-.'_! ]", "");
|
||||||
|
|
||||||
|
File.Move(path, pathWithoutFilename + "\\" + fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -322,12 +322,7 @@ namespace NovetusLauncher
|
||||||
PortBox.Items.Clear();
|
PortBox.Items.Clear();
|
||||||
break;
|
break;
|
||||||
case TabPage pg4 when pg4 == Tabs.TabPages[TabPageMaps]:
|
case TabPage pg4 when pg4 == Tabs.TabPages[TabPageMaps]:
|
||||||
string mapdir = GlobalPaths.MapsDir;
|
RefreshMaps();
|
||||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
|
||||||
TreeNodeHelper.ListDirectory(Tree, mapdir, fileexts);
|
|
||||||
TreeNodeHelper.CopyNodes(Tree.Nodes, _TreeCache.Nodes);
|
|
||||||
Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes);
|
|
||||||
Tree.Focus();
|
|
||||||
ServerInfo.Text = "";
|
ServerInfo.Text = "";
|
||||||
ClientBox.Items.Clear();
|
ClientBox.Items.Clear();
|
||||||
ServerBox.Items.Clear();
|
ServerBox.Items.Clear();
|
||||||
|
|
@ -903,6 +898,13 @@ namespace NovetusLauncher
|
||||||
Tree.Nodes.Clear();
|
Tree.Nodes.Clear();
|
||||||
_TreeCache.Nodes.Clear();
|
_TreeCache.Nodes.Clear();
|
||||||
string mapdir = GlobalPaths.MapsDir;
|
string mapdir = GlobalPaths.MapsDir;
|
||||||
|
string[] filePaths = GlobalFuncs.FindAllFiles(GlobalPaths.MapsDir);
|
||||||
|
|
||||||
|
foreach (string path in filePaths)
|
||||||
|
{
|
||||||
|
GlobalFuncs.RenameFileWithInvalidChars(path);
|
||||||
|
}
|
||||||
|
|
||||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
||||||
TreeNodeHelper.ListDirectory(Tree, mapdir, fileexts);
|
TreeNodeHelper.ListDirectory(Tree, mapdir, fileexts);
|
||||||
TreeNodeHelper.CopyNodes(Tree.Nodes, _TreeCache.Nodes);
|
TreeNodeHelper.CopyNodes(Tree.Nodes, _TreeCache.Nodes);
|
||||||
|
|
@ -1181,6 +1183,7 @@ namespace NovetusLauncher
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.RenameFileWithInvalidChars(mapname);
|
||||||
GlobalFuncs.FixedFileCopy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true);
|
GlobalFuncs.FixedFileCopy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ namespace NovetusLauncher
|
||||||
case Settings.UIOptions.Style.Compact:
|
case Settings.UIOptions.Style.Compact:
|
||||||
Application.Run(new LauncherFormCompact());
|
Application.Run(new LauncherFormCompact());
|
||||||
break;
|
break;
|
||||||
|
case Settings.UIOptions.Style.Extended:
|
||||||
default:
|
default:
|
||||||
Application.Run(new LauncherFormExtended());
|
Application.Run(new LauncherFormExtended());
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -71,15 +71,14 @@ namespace NovetusURI
|
||||||
{
|
{
|
||||||
switch(GlobalVars.UserConfiguration.LauncherStyle)
|
switch(GlobalVars.UserConfiguration.LauncherStyle)
|
||||||
{
|
{
|
||||||
case Settings.UIOptions.Style.Extended:
|
|
||||||
CharacterCustomizationExtended ccustom = new CharacterCustomizationExtended();
|
|
||||||
ccustom.Show();
|
|
||||||
break;
|
|
||||||
case Settings.UIOptions.Style.Compact:
|
case Settings.UIOptions.Style.Compact:
|
||||||
CharacterCustomizationCompact ccustom2 = new CharacterCustomizationCompact();
|
CharacterCustomizationCompact ccustom2 = new CharacterCustomizationCompact();
|
||||||
ccustom2.Show();
|
ccustom2.Show();
|
||||||
break;
|
break;
|
||||||
|
case Settings.UIOptions.Style.Extended:
|
||||||
default:
|
default:
|
||||||
|
CharacterCustomizationExtended ccustom = new CharacterCustomizationExtended();
|
||||||
|
ccustom.Show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
- Item Creation SDK: If a character customization window is open, it will now close the window and open a new one to update the contents.
|
- Item Creation SDK: If a character customization window is open, it will now close the window and open a new one to update the contents.
|
||||||
- Item Creation SDK: Added the optional ability to replace existing item icons.
|
- Item Creation SDK: Added the optional ability to replace existing item icons.
|
||||||
- Added the XML Content Editor: a Excel-like editor that allows you to edit and add content providers and part colors.
|
- Added the XML Content Editor: a Excel-like editor that allows you to edit and add content providers and part colors.
|
||||||
|
- The Novetus Launcher will now remove any invalid characters from a map's file name.
|
||||||
|
- Fixed an issue with the Launcher where the internal map file path wouldn't automatically change if the directory changed. Portable installations should work properly now.
|
||||||
Added the following T-Shirts:
|
Added the following T-Shirts:
|
||||||
Blue Ring of Fire
|
Blue Ring of Fire
|
||||||
Ring of Fire
|
Ring of Fire
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue