diff --git a/Novetus/NovetusCore/StorageAndFunctions/FileManagement.cs b/Novetus/NovetusCore/StorageAndFunctions/FileManagement.cs index 2fbd16d..361603d 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/FileManagement.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/FileManagement.cs @@ -1398,36 +1398,6 @@ public class FileManagement public static void CreateAssetCacheDirectories() { - if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts)) - { - Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts); - } - - if (!Directory.Exists(GlobalPaths.AssetCacheDirSky)) - { - Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky); - } - - if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds)) - { - Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds); - } - - if (!Directory.Exists(GlobalPaths.AssetCacheDirTextures)) - { - Directory.CreateDirectory(GlobalPaths.AssetCacheDirTextures); - } - - if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI)) - { - Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI); - } - - if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts)) - { - Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts); - } - if (!Directory.Exists(GlobalPaths.AssetCacheDirAssets)) { Directory.CreateDirectory(GlobalPaths.AssetCacheDirAssets); diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalPaths.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalPaths.cs index 150eac4..0af4614 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalPaths.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalPaths.cs @@ -64,21 +64,9 @@ public class GlobalPaths #region Asset Dirs public static string AssetCacheDir = DataPath + "\\assetcache"; - public static string AssetCacheDirSky = AssetCacheDir + "\\sky"; - public static string AssetCacheDirFonts = AssetCacheDir + DirFonts; - public static string AssetCacheDirSounds = AssetCacheDir + DirSounds; - public static string AssetCacheDirTextures = AssetCacheDir + DirTextures; - public static string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui"; - public static string AssetCacheDirScripts = AssetCacheDir + DirScripts; public static string AssetCacheDirAssets = AssetCacheDir + "\\assets"; public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/"; - public static string AssetCacheFontsGameDir = AssetCacheGameDir + FontsGameDir; - public static string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/"; - public static string AssetCacheSoundsGameDir = AssetCacheGameDir + SoundsGameDir; - public static string AssetCacheTexturesGameDir = AssetCacheGameDir + TexturesGameDir; - public static string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/"; - public static string AssetCacheScriptsGameDir = AssetCacheGameDir + ScriptsGameDir; public static string AssetCacheAssetsGameDir = AssetCacheGameDir + "assets/"; #endregion diff --git a/Novetus/NovetusCore/StorageAndFunctions/NovetusFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/NovetusFuncs.cs index 83405c9..d0ef660 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/NovetusFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/NovetusFuncs.cs @@ -44,13 +44,13 @@ public class NovetusFuncs return item; } - Downloader download = new Downloader(item, fullname, "", GlobalPaths.AssetCacheDirTextures); + Downloader download = new Downloader(item, fullname, "", GlobalPaths.AssetCacheDirAssets); try { string path = download.GetFullDLPath(); download.InitDownloadNoDialog(path); - return GlobalPaths.AssetCacheTexturesGameDir + download.fileName; + return GlobalPaths.AssetCacheAssetsGameDir + download.fileName; } #if URI || LAUNCHER || CMD || BASICLAUNCHER catch (Exception ex) @@ -83,7 +83,7 @@ public class NovetusFuncs return item; } - Downloader download = new Downloader(item, name + "Temp.rbxm", "", GlobalPaths.AssetCacheDirFonts); + Downloader download = new Downloader(item, name + "Temp.rbxm", "", GlobalPaths.AssetCacheDirAssets); try { @@ -369,162 +369,6 @@ public class AssetCacheDef : AssetCacheDefBasic #region Roblox Type Definitions public struct RobloxDefs { - public static AssetCacheDef Fonts - { - get - { - return new AssetCacheDef("SpecialMesh", - new string[] { "MeshId", "TextureId" }, - new string[] { ".mesh", ".png" }, - new string[] { GlobalPaths.AssetCacheDirFonts, GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheFontsGameDir, GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Sky - { - get - { - return new AssetCacheDef("Sky", - new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirSky }, - new string[] { GlobalPaths.AssetCacheSkyGameDir }); - } - } - - public static AssetCacheDef Decal - { - get - { - return new AssetCacheDef("Decal", - new string[] { "Texture" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Texture - { - get - { - return new AssetCacheDef("Texture", - new string[] { "Texture" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef HopperBin - { - get - { - return new AssetCacheDef("HopperBin", - new string[] { "TextureId" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Tool - { - get - { - return new AssetCacheDef("Tool", - new string[] { "TextureId" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Sound - { - get - { - return new AssetCacheDef("Sound", - new string[] { "SoundId" }, - new string[] { ".wav" }, - new string[] { GlobalPaths.AssetCacheDirSounds }, - new string[] { GlobalPaths.AssetCacheSoundsGameDir }); - } - } - - public static AssetCacheDef ImageLabel - { - get - { - return new AssetCacheDef("ImageLabel", - new string[] { "Image" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Shirt - { - get - { - return new AssetCacheDef("Shirt", - new string[] { "ShirtTemplate" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef ShirtGraphic - { - get - { - return new AssetCacheDef("ShirtGraphic", - new string[] { "Graphic" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Pants - { - get - { - return new AssetCacheDef("Pants", - new string[] { "PantsTemplate" }, - new string[] { ".png" }, - new string[] { GlobalPaths.AssetCacheDirTextures }, - new string[] { GlobalPaths.AssetCacheTexturesGameDir }); - } - } - - public static AssetCacheDef Script - { - get - { - return new AssetCacheDef("Script", - new string[] { "LinkedSource" }, - new string[] { ".lua" }, - new string[] { GlobalPaths.AssetCacheDirScripts }, - new string[] { GlobalPaths.AssetCacheScriptsGameDir }); - } - } - - public static AssetCacheDef LocalScript - { - get - { - return new AssetCacheDef("LocalScript", - new string[] { "LinkedSource" }, - new string[] { ".lua" }, - new string[] { GlobalPaths.AssetCacheDirScripts }, - new string[] { GlobalPaths.AssetCacheScriptsGameDir }); - } - } - //item defs below public static AssetCacheDef ItemHatFonts { diff --git a/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.Designer.cs b/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.Designer.cs index 7674ac8..9adad92 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.Designer.cs @@ -37,8 +37,8 @@ this.AssetLocalization_LocalizePermanentlyBox = new System.Windows.Forms.CheckBox(); this.AssetLocalization_SaveBackups = new System.Windows.Forms.CheckBox(); this.AssetLocalization_AssetTypeText = new System.Windows.Forms.Label(); - this.AssetLocalization_ItemNameText = new System.Windows.Forms.Label(); - this.AssetLocalization_ItemNameBox = new System.Windows.Forms.TextBox(); + this.AssetLocalization_FolderNameText = new System.Windows.Forms.Label(); + this.AssetLocalization_CustomFolderNameBox = new System.Windows.Forms.TextBox(); this.AssetLocalization_AssetTypeBox = new System.Windows.Forms.ComboBox(); this.AssetLocalization_LocalizeButton = new System.Windows.Forms.Button(); this.AssetLocalization_BackgroundWorker = new System.ComponentModel.BackgroundWorker(); @@ -141,22 +141,23 @@ this.AssetLocalization_AssetTypeText.TabIndex = 18; this.AssetLocalization_AssetTypeText.Text = "Asset Type:"; // - // AssetLocalization_ItemNameText + // AssetLocalization_FolderNameText // - this.AssetLocalization_ItemNameText.AutoSize = true; - this.AssetLocalization_ItemNameText.Location = new System.Drawing.Point(12, 93); - this.AssetLocalization_ItemNameText.Name = "AssetLocalization_ItemNameText"; - this.AssetLocalization_ItemNameText.Size = new System.Drawing.Size(115, 13); - this.AssetLocalization_ItemNameText.TabIndex = 15; - this.AssetLocalization_ItemNameText.Text = "Asset Name (Optional):"; + this.AssetLocalization_FolderNameText.AutoSize = true; + this.AssetLocalization_FolderNameText.Location = new System.Drawing.Point(12, 88); + this.AssetLocalization_FolderNameText.Name = "AssetLocalization_FolderNameText"; + this.AssetLocalization_FolderNameText.Size = new System.Drawing.Size(108, 26); + this.AssetLocalization_FolderNameText.TabIndex = 15; + this.AssetLocalization_FolderNameText.Text = "Custom Folder Name \r\n(Optional):"; // - // AssetLocalization_ItemNameBox + // AssetLocalization_CustomFolderNameBox // - this.AssetLocalization_ItemNameBox.Location = new System.Drawing.Point(140, 90); - this.AssetLocalization_ItemNameBox.Name = "AssetLocalization_ItemNameBox"; - this.AssetLocalization_ItemNameBox.Size = new System.Drawing.Size(155, 20); - this.AssetLocalization_ItemNameBox.TabIndex = 14; - this.AssetLocalization_ItemNameBox.TextChanged += new System.EventHandler(this.AssetLocalization_ItemNameBox_TextChanged); + this.AssetLocalization_CustomFolderNameBox.Enabled = false; + this.AssetLocalization_CustomFolderNameBox.Location = new System.Drawing.Point(126, 90); + this.AssetLocalization_CustomFolderNameBox.Name = "AssetLocalization_CustomFolderNameBox"; + this.AssetLocalization_CustomFolderNameBox.Size = new System.Drawing.Size(169, 20); + this.AssetLocalization_CustomFolderNameBox.TabIndex = 14; + this.AssetLocalization_CustomFolderNameBox.TextChanged += new System.EventHandler(this.AssetLocalization_ItemNameBox_TextChanged); // // AssetLocalization_AssetTypeBox // @@ -206,9 +207,9 @@ this.Controls.Add(this.AssetLocalization_SaveBackups); this.Controls.Add(this.URLSelection); this.Controls.Add(this.AssetLocalization_AssetTypeText); - this.Controls.Add(this.AssetLocalization_ItemNameText); + this.Controls.Add(this.AssetLocalization_FolderNameText); this.Controls.Add(this.AssetLocalization_LocalizeButton); - this.Controls.Add(this.AssetLocalization_ItemNameBox); + this.Controls.Add(this.AssetLocalization_CustomFolderNameBox); this.Controls.Add(this.AssetLocalization_AssetTypeBox); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -226,8 +227,8 @@ #endregion private System.Windows.Forms.CheckBox AssetLocalization_SaveBackups; private System.Windows.Forms.Label AssetLocalization_AssetTypeText; - private System.Windows.Forms.Label AssetLocalization_ItemNameText; - private System.Windows.Forms.TextBox AssetLocalization_ItemNameBox; + private System.Windows.Forms.Label AssetLocalization_FolderNameText; + private System.Windows.Forms.TextBox AssetLocalization_CustomFolderNameBox; private System.Windows.Forms.ComboBox AssetLocalization_AssetTypeBox; private System.Windows.Forms.Button AssetLocalization_LocalizeButton; private System.Windows.Forms.ComboBox URLSelection; diff --git a/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs b/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs index 65a039e..69488e5 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs @@ -20,7 +20,7 @@ public partial class AssetFixer : Form private bool isWebSite = false; private RobloxFileType currentType; private string path; - private string name; + private string customFolder; private int errors = 0; private bool hasOverrideWarningOpenedOnce = false; #endregion @@ -197,11 +197,12 @@ public partial class AssetFixer : Form continue; } + //https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url if (line.Contains("http://") || line.Contains("https://")) { //https://stackoverflow.com/questions/10576686/c-sharp-regex-pattern-to-extract-urls-from-given-string-not-full-html-urls-but List links = new List(); - var linkParser = new Regex(@"\b(?:https?://|www\.)\S+\b(?=<| |""|')", RegexOptions.Compiled | RegexOptions.IgnoreCase); + var linkParser = new Regex(@"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=;]*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (Match m in linkParser.Matches(line)) { string link = m.Value; @@ -274,8 +275,9 @@ public partial class AssetFixer : Form File.WriteAllLines(filepath, file); } - public void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, string itemname, bool useURLs = false, string remoteurl = "") + public void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, bool useURLs = false, string remoteurl = "") { + LocalizePermanentlyIfNeeded(); AssetFixer_ProgressLabel.Text = "Loading..."; bool error = false; @@ -327,46 +329,30 @@ public partial class AssetFixer : Form { if (perm) { - GlobalPaths.AssetCacheDir = GlobalPaths.DataPath; - GlobalPaths.AssetCacheDirSky = GlobalPaths.AssetCacheDir + "\\sky"; - GlobalPaths.AssetCacheDirFonts = GlobalPaths.AssetCacheDir + GlobalPaths.DirFonts; - GlobalPaths.AssetCacheDirSounds = GlobalPaths.AssetCacheDir + GlobalPaths.DirSounds; - GlobalPaths.AssetCacheDirTextures = GlobalPaths.AssetCacheDir + GlobalPaths.DirTextures; - GlobalPaths.AssetCacheDirTexturesGUI = GlobalPaths.AssetCacheDirTextures + "\\gui"; - GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts; + if (!string.IsNullOrWhiteSpace(customFolder)) + { + GlobalPaths.AssetCacheDir = GlobalPaths.DataPath + "\\" + customFolder; + GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir + customFolder + "/"; + } + else + { + GlobalPaths.AssetCacheDir = GlobalPaths.DataPath; + GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir; + } + GlobalPaths.AssetCacheDirAssets = GlobalPaths.AssetCacheDir + "\\assets"; - - FileManagement.CreateAssetCacheDirectories(); - - GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir; - GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir; - GlobalPaths.AssetCacheSkyGameDir = GlobalPaths.AssetCacheGameDir + "sky/"; - GlobalPaths.AssetCacheSoundsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.SoundsGameDir; - GlobalPaths.AssetCacheTexturesGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.TexturesGameDir; - GlobalPaths.AssetCacheTexturesGUIGameDir = GlobalPaths.AssetCacheTexturesGameDir + "gui/"; - GlobalPaths.AssetCacheScriptsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.ScriptsGameDir; GlobalPaths.AssetCacheAssetsGameDir = GlobalPaths.AssetCacheGameDir + "assets/"; } else { GlobalPaths.AssetCacheDir = GlobalPaths.DataPath + "\\assetcache"; - GlobalPaths.AssetCacheDirSky = GlobalPaths.AssetCacheDir + "\\sky"; - GlobalPaths.AssetCacheDirFonts = GlobalPaths.AssetCacheDir + GlobalPaths.DirFonts; - GlobalPaths.AssetCacheDirSounds = GlobalPaths.AssetCacheDir + GlobalPaths.DirSounds; - GlobalPaths.AssetCacheDirTextures = GlobalPaths.AssetCacheDir + GlobalPaths.DirTextures; - GlobalPaths.AssetCacheDirTexturesGUI = GlobalPaths.AssetCacheDirTextures + "\\gui"; - GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts; - GlobalPaths.AssetCacheDirAssets = GlobalPaths.AssetCacheDir + "\\assets"; - GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir + "assetcache/"; - GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir; - GlobalPaths.AssetCacheSkyGameDir = GlobalPaths.AssetCacheGameDir + "sky/"; - GlobalPaths.AssetCacheSoundsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.SoundsGameDir; - GlobalPaths.AssetCacheTexturesGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.TexturesGameDir; - GlobalPaths.AssetCacheTexturesGUIGameDir = GlobalPaths.AssetCacheTexturesGameDir + "gui/"; - GlobalPaths.AssetCacheScriptsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.ScriptsGameDir; + + GlobalPaths.AssetCacheDirAssets = GlobalPaths.AssetCacheDir + "\\assets"; GlobalPaths.AssetCacheAssetsGameDir = GlobalPaths.AssetCacheGameDir + "assets/"; } + + FileManagement.CreateAssetCacheDirectories(); } private void AssetLocalization_AssetTypeBox_SelectedIndexChanged(object sender, EventArgs e) @@ -387,7 +373,7 @@ public partial class AssetFixer : Form private void AssetLocalization_ItemNameBox_TextChanged(object sender, EventArgs e) { - name = AssetLocalization_ItemNameBox.Text; + customFolder = AssetLocalization_CustomFolderNameBox.Text; } private void AssetLocalization_SaveBackups_CheckedChanged(object sender, EventArgs e) @@ -416,7 +402,7 @@ public partial class AssetFixer : Form private void AssetLocalization_BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; - LocalizeAsset(currentType, worker, path, name, + LocalizeAsset(currentType, worker, path, AssetLocalization_AssetLinks.Checked ? AssetLocalization_AssetLinks.Checked : false, AssetLocalization_AssetLinks.Checked ? url : ""); } @@ -479,7 +465,16 @@ public partial class AssetFixer : Form private void AssetLocalization_LocalizePermanentlyBox_CheckedChanged(object sender, EventArgs e) { - LocalizePermanentlyIfNeeded(); + if (AssetLocalization_LocalizePermanentlyBox.Checked) + { + AssetLocalization_AssetLinks.Enabled = false; + AssetLocalization_CustomFolderNameBox.Enabled = true; + } + else + { + AssetLocalization_AssetLinks.Enabled = true; + AssetLocalization_CustomFolderNameBox.Enabled = false; + } } private void AssetLocalization_AssetLinks_CheckedChanged(object sender, EventArgs e) @@ -488,13 +483,11 @@ public partial class AssetFixer : Form { AssetLocalization_LocalizeButton.Text = AssetLocalization_LocalizeButton.Text.Replace("Localize", "Fix"); AssetLocalization_LocalizePermanentlyBox.Enabled = false; - SetAssetCachePaths(); } else { AssetLocalization_LocalizeButton.Text = AssetLocalization_LocalizeButton.Text.Replace("Fix", "Localize"); AssetLocalization_LocalizePermanentlyBox.Enabled = true; - LocalizePermanentlyIfNeeded(); } } @@ -502,12 +495,10 @@ public partial class AssetFixer : Form { if (AssetLocalization_LocalizePermanentlyBox.Checked) { - AssetLocalization_AssetLinks.Enabled = false; SetAssetCachePaths(true); } else { - AssetLocalization_AssetLinks.Enabled = true; SetAssetCachePaths(); } } diff --git a/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs b/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs index 1416887..9dd8854 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs @@ -43,8 +43,6 @@ public partial class NovetusSDK : Form #region Form Events private void NovetusSDK_Load(object sender, EventArgs e) { - FileManagement.CreateInitialFileListIfNeededMulti(); - if (!File.Exists(GlobalPaths.DataDir + "\\RSG.exe")) { DisableApp(SDKApps.ScriptGenerator);