add bz2 support. use compress.bat to compress your maps
This commit is contained in:
parent
c694a9b120
commit
720277e265
|
|
@ -981,6 +981,60 @@ public class ClientManagement
|
|||
}
|
||||
#endif
|
||||
|
||||
#if LAUNCHER
|
||||
//https://stackoverflow.com/questions/30687987/unable-to-decompress-bz2-file-has-orginal-file-using-dotnetzip-library
|
||||
private static string Decompress(bool forceOverwrite)
|
||||
{
|
||||
var outFname = GlobalVars.UserConfiguration.MapPath.Replace(".bz2", "");
|
||||
if (File.Exists(outFname))
|
||||
{
|
||||
if (forceOverwrite)
|
||||
File.Delete(outFname);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
using (Stream fs = File.OpenRead(GlobalVars.UserConfiguration.MapPath),
|
||||
output = File.Create(outFname),
|
||||
decompressor = new Ionic.BZip2.BZip2InputStream(fs))
|
||||
Pump(decompressor, output);
|
||||
|
||||
return outFname;
|
||||
}
|
||||
|
||||
private static void Pump(Stream src, Stream dest)
|
||||
{
|
||||
byte[] buffer = new byte[2048];
|
||||
int n;
|
||||
while ((n = src.Read(buffer, 0, buffer.Length)) > 0)
|
||||
dest.Write(buffer, 0, n);
|
||||
|
||||
}
|
||||
|
||||
private static void DecompressMap(ScriptType type, bool nomap)
|
||||
{
|
||||
if ((type != ScriptType.Client || type != ScriptType.EasterEgg) && !nomap && GlobalVars.UserConfiguration.Map.Contains(".bz2"))
|
||||
{
|
||||
Decompress(true);
|
||||
|
||||
GlobalVars.UserConfiguration.MapPath = GlobalVars.UserConfiguration.MapPath.Replace(".bz2", "");
|
||||
GlobalVars.UserConfiguration.Map = GlobalVars.UserConfiguration.Map.Replace(".bz2", "");
|
||||
GlobalVars.isMapCompressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetDecompressedMap()
|
||||
{
|
||||
if (GlobalVars.isMapCompressed)
|
||||
{
|
||||
Util.FixedFileDelete(GlobalVars.UserConfiguration.MapPath);
|
||||
GlobalVars.UserConfiguration.MapPath = GlobalVars.UserConfiguration.MapPath.Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2");
|
||||
GlobalVars.UserConfiguration.Map = GlobalVars.UserConfiguration.Map.Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2");
|
||||
GlobalVars.isMapCompressed = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if URI
|
||||
public static void LaunchRBXClient(ScriptType type, bool no3d, bool nomap, EventHandler e, Label label)
|
||||
#else
|
||||
|
|
@ -1000,6 +1054,10 @@ public class ClientManagement
|
|||
public static void LaunchRBXClient(string ClientName, ScriptType type, bool no3d, bool nomap, EventHandler e)
|
||||
#endif
|
||||
{
|
||||
#if LAUNCHER
|
||||
DecompressMap(type, nomap);
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
|
|
@ -1324,7 +1382,7 @@ public class ClientManagement
|
|||
#region Script Functions
|
||||
public class ScriptFuncs
|
||||
{
|
||||
#region Script Generator/Signer
|
||||
#region Script Generator/Signer
|
||||
public class Generator
|
||||
{
|
||||
public static void SignGeneratedScript(string scriptFileName, bool newSigFormat = false, bool encodeInBase64 = true)
|
||||
|
|
@ -1509,9 +1567,9 @@ public class ScriptFuncs
|
|||
return ClientManagement.GetGenLuaFileName(ClientName, type);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ClientScript Parser
|
||||
#region ClientScript Parser
|
||||
public class ClientScript
|
||||
{
|
||||
public static string GetArgsFromTag(string code, string tag, string endtag)
|
||||
|
|
@ -1759,6 +1817,6 @@ public class ScriptFuncs
|
|||
return compiled;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ public static class GlobalVars
|
|||
public static string NextCommand = "";
|
||||
public static bool AppClosed = false;
|
||||
public static bool isConsoleOnly = false;
|
||||
public static bool isMapCompressed = false;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class ModManager
|
|||
|
||||
if (globalType == ModType.ModPackage)
|
||||
{
|
||||
MessageBox.Show("Your mod is loading. You will recieve a notification when it is installed. Please keep the launcher open. You can see the installation progress in the Console.", "Novetus - Mod Loading");
|
||||
MessageBox.Show("Your mod is loading. You will recieve a notification when it is installed. Please keep the launcher open. If the Console is open, you can see the installation progress.", "Novetus - Mod Loading");
|
||||
|
||||
int filecount = 0;
|
||||
StringBuilder filelistbuilder = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -436,6 +436,8 @@ namespace NovetusLauncher
|
|||
Parent.Visible = true;
|
||||
}
|
||||
|
||||
ClientManagement.ResetDecompressedMap();
|
||||
|
||||
if (GlobalVars.isConsoleOnly)
|
||||
{
|
||||
CloseEventInternal();
|
||||
|
|
@ -779,7 +781,7 @@ namespace NovetusLauncher
|
|||
Util.RenameFileWithInvalidChars(path);
|
||||
}
|
||||
|
||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx" };
|
||||
string[] fileexts = new string[] { ".rbxl", ".rbxlx", ".bz2" };
|
||||
TreeNodeHelper.ListDirectory(Tree, mapdir, fileexts);
|
||||
TreeNodeHelper.CopyNodes(Tree.Nodes, _TreeCache.Nodes);
|
||||
Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes);
|
||||
|
|
@ -853,9 +855,9 @@ namespace NovetusLauncher
|
|||
if (Tree.SelectedNode == null)
|
||||
return;
|
||||
|
||||
if (File.Exists(GlobalPaths.RootPath + @"\\" + Tree.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt"))
|
||||
if (File.Exists(GlobalPaths.RootPath + @"\\" + Tree.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "").Replace(".bz2", "") + "_desc.txt"))
|
||||
{
|
||||
MapDescBox.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + Tree.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt");
|
||||
MapDescBox.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + Tree.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "").Replace(".bz2", "") + "_desc.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1093,7 +1095,7 @@ namespace NovetusLauncher
|
|||
{
|
||||
using (var ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "Roblox Level (*.rbxl)|*.rbxl|Roblox Level (*.rbxlx)|*.rbxlx";
|
||||
ofd.Filter = "Roblox Level (*.rbxl)|*.rbxl|Roblox Level (*.rbxlx)|*.rbxlx|bzip2 compressed Roblox Level (*.bz2)|*.bz2";
|
||||
ofd.FilterIndex = 1;
|
||||
ofd.Title = "Load Roblox map";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
|
|
|
|||
|
|
@ -547,9 +547,9 @@ namespace NovetusLauncher
|
|||
if (mapsBox.SelectedNode == null)
|
||||
return;
|
||||
|
||||
if (File.Exists(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt"))
|
||||
if (File.Exists(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "").Replace(".bz2", "") + "_desc.txt"))
|
||||
{
|
||||
mapsDescBox.Text = mapsBox.SelectedNode.Text + ": " + File.ReadAllText(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", "").Replace(".bz2", "") + "_desc.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0"/>
|
||||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0"/>
|
||||
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<gcAllowVeryLargeObjects enabled="true"/>
|
||||
<gcAllowVeryLargeObjects enabled="true" />
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
@ECHO OFF
|
||||
|
||||
SET SourceDir=%CD%
|
||||
SET DestDir=%CD%
|
||||
|
||||
for %%f in (*.rbxl) do (
|
||||
if "%%~xf"==".rbxl" (
|
||||
"C:\Program Files\7-Zip\7z.exe" a "%DestDir%\%%f.bz2" "%SourceDir%\%%f"
|
||||
del "%%f"
|
||||
)
|
||||
)
|
||||
Loading…
Reference in New Issue