sdk updates
This commit is contained in:
parent
aca3472d40
commit
9312e6b0f8
|
|
@ -1697,5 +1697,45 @@ public class GlobalFuncs
|
|||
for (int i = 0; i < bytes.Length; i++) { result += Convert.ToChar(0x55 ^ bytes[i]); }
|
||||
return result;
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/1879395/how-do-i-generate-a-stream-from-a-string
|
||||
public static Stream GenerateStreamFromString(string s)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(s);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/14488796/does-net-provide-an-easy-way-convert-bytes-to-kb-mb-gb-etc
|
||||
private static readonly string[] SizeSuffixes =
|
||||
{ "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
|
||||
public static string SizeSuffix(Int64 value, int decimalPlaces = 1)
|
||||
{
|
||||
if (decimalPlaces < 0) { throw new ArgumentOutOfRangeException("decimalPlaces"); }
|
||||
if (value < 0) { return "-" + SizeSuffix(-value, decimalPlaces); }
|
||||
if (value == 0) { return string.Format("{0:n" + decimalPlaces + "} bytes", 0); }
|
||||
|
||||
// mag is 0 for bytes, 1 for KB, 2, for MB, etc.
|
||||
int mag = (int)Math.Log(value, 1024);
|
||||
|
||||
// 1L << (mag * 10) == 2 ^ (10 * mag)
|
||||
// [i.e. the number of bytes in the unit corresponding to mag]
|
||||
decimal adjustedSize = (decimal)value / (1L << (mag * 10));
|
||||
|
||||
// make adjustment when the value is large enough that
|
||||
// it would round up to 1000 or more
|
||||
if (Math.Round(adjustedSize, decimalPlaces) >= 1000)
|
||||
{
|
||||
mag += 1;
|
||||
adjustedSize /= 1024;
|
||||
}
|
||||
|
||||
return string.Format("{0:n" + decimalPlaces + "} {1}",
|
||||
adjustedSize,
|
||||
SizeSuffixes[mag]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ class Downloader
|
|||
|
||||
public void InitDownload(string path, string fileext, string additionalText, bool removeSpaces = false)
|
||||
{
|
||||
string downloadOutcomeAddText = additionalText;
|
||||
string outputfilename = "";
|
||||
|
||||
if (removeSpaces == true)
|
||||
|
|
@ -70,15 +69,7 @@ class Downloader
|
|||
|
||||
string fullpath = path + "\\" + outputfilename;
|
||||
|
||||
try
|
||||
{
|
||||
int read = DownloadFile(fileURL, fullpath);
|
||||
downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
downloadOutcome = "Error when downloading file: " + ex.Message;
|
||||
}
|
||||
InitDownloadNoDialog(fullpath, additionalText);
|
||||
}
|
||||
|
||||
public void InitDownload(string additionalText = "")
|
||||
|
|
@ -102,7 +93,14 @@ class Downloader
|
|||
try
|
||||
{
|
||||
int read = DownloadFile(fileURL, name);
|
||||
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + read + " bytes written! " + additionalText + downloadOutcomeException;
|
||||
if (string.IsNullOrWhiteSpace(downloadOutcomeException))
|
||||
{
|
||||
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + GlobalFuncs.SizeSuffix(Convert.ToInt64(read), 2) + " written (" + read + " bytes)! " + additionalText;
|
||||
}
|
||||
else
|
||||
{
|
||||
downloadOutcome = "Download of file " + Path.GetFileName(name) + " failed. " + downloadOutcomeException;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -182,7 +180,23 @@ class Downloader
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
downloadOutcomeException = " Exception detected: " + e.Message;
|
||||
if (e is WebException && bytesProcessed == 0)
|
||||
{
|
||||
WebException ex = (WebException)e;
|
||||
HttpWebResponse errorResponse = ex.Response as HttpWebResponse;
|
||||
if (errorResponse.StatusCode == HttpStatusCode.Conflict)
|
||||
{
|
||||
downloadOutcomeException = "Error: Unable to download item. Is it publically available?";
|
||||
}
|
||||
else
|
||||
{
|
||||
downloadOutcomeException = "Exception: " + ex.Message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
downloadOutcomeException = "Exception: " + e.Message;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Windows.Forms;
|
|||
using System.Xml.Linq;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
#endregion
|
||||
|
||||
#region SDKApps
|
||||
|
|
@ -45,89 +46,53 @@ class SDKFuncs
|
|||
}
|
||||
}
|
||||
|
||||
public static void DownloadFromNodes(string filepath, VarStorage.AssetCacheDef assetdef, string name = "", string meshname = "")
|
||||
public static void DownloadFromNodes(XDocument doc, VarStorage.AssetCacheDef assetdef, string name = "", string meshname = "")
|
||||
{
|
||||
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname);
|
||||
DownloadFromNodes(doc, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname);
|
||||
}
|
||||
|
||||
public static void DownloadFromNodes(string filepath, VarStorage.AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
|
||||
public static void DownloadFromNodes(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
|
||||
{
|
||||
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname);
|
||||
DownloadFromNodes(doc, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname);
|
||||
}
|
||||
|
||||
public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "")
|
||||
public static void DownloadFromNodes(XDocument doc, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "")
|
||||
{
|
||||
string oldfile = File.ReadAllText(filepath);
|
||||
string fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
|
||||
XDocument doc = XDocument.Parse(fixedfile);
|
||||
var v = from nodes in doc.Descendants("Item")
|
||||
where nodes.Attribute("class").Value == itemClassValue
|
||||
select nodes;
|
||||
|
||||
try
|
||||
foreach (var item in v)
|
||||
{
|
||||
var v = from nodes in doc.Descendants("Item")
|
||||
where nodes.Attribute("class").Value == itemClassValue
|
||||
select nodes;
|
||||
var v2 = from nodes in item.Descendants("Content")
|
||||
where nodes.Attribute("name").Value == itemIdValue
|
||||
select nodes;
|
||||
|
||||
foreach (var item in v)
|
||||
foreach (var item2 in v2)
|
||||
{
|
||||
var v2 = from nodes in item.Descendants("Content")
|
||||
where nodes.Attribute("name").Value == itemIdValue
|
||||
var v3 = from nodes in item2.Descendants("url")
|
||||
select nodes;
|
||||
|
||||
foreach (var item2 in v2)
|
||||
foreach (var item3 in v3)
|
||||
{
|
||||
var v3 = from nodes in item2.Descendants("url")
|
||||
select nodes;
|
||||
|
||||
foreach (var item3 in v3)
|
||||
if (!item3.Value.Contains("rbxassetid"))
|
||||
{
|
||||
if (!item3.Value.Contains("rbxassetid"))
|
||||
{
|
||||
if (!item3.Value.Contains("rbxasset"))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(meshname))
|
||||
{
|
||||
string url = item3.Value;
|
||||
string newurl = "assetdelivery.roblox.com/v1/asset/?id=";
|
||||
string urlFixed = url.Replace("http://", "https://")
|
||||
.Replace("?version=1&id=", "?id=")
|
||||
.Replace("www.roblox.com/asset/?id=", newurl)
|
||||
.Replace("www.roblox.com/asset?id=", newurl)
|
||||
.Replace("assetgame.roblox.com/asset/?id=", newurl)
|
||||
.Replace("assetgame.roblox.com/asset?id=", newurl)
|
||||
.Replace("roblox.com/asset/?id=", newurl)
|
||||
.Replace("roblox.com/asset?id=", newurl)
|
||||
.Replace("&", "&")
|
||||
.Replace("amp;", "&");
|
||||
string peram = "id=";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
if (urlFixed.Contains(peram))
|
||||
{
|
||||
string IDVal = urlFixed.After(peram);
|
||||
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
|
||||
item3.Value = (inGameDir + IDVal + fileext).Replace(" ", "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
|
||||
item3.Value = inGameDir + name + fileext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item3.Value = inGameDir + meshname;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!item3.Value.Contains("rbxasset"))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(meshname))
|
||||
{
|
||||
string url = item3.Value;
|
||||
string rbxassetid = "rbxassetid://";
|
||||
string urlFixed = "https://assetdelivery.roblox.com/v1/asset/?id=" + url.After(rbxassetid);
|
||||
string newurl = "assetdelivery.roblox.com/v1/asset/?id=";
|
||||
string urlFixed = url.Replace("http://", "https://")
|
||||
.Replace("?version=1&id=", "?id=")
|
||||
.Replace("www.roblox.com/asset/?id=", newurl)
|
||||
.Replace("www.roblox.com/asset?id=", newurl)
|
||||
.Replace("assetgame.roblox.com/asset/?id=", newurl)
|
||||
.Replace("assetgame.roblox.com/asset?id=", newurl)
|
||||
.Replace("roblox.com/asset/?id=", newurl)
|
||||
.Replace("roblox.com/asset?id=", newurl)
|
||||
.Replace("&", "&")
|
||||
.Replace("amp;", "&");
|
||||
string peram = "id=";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
|
@ -136,7 +101,7 @@ class SDKFuncs
|
|||
{
|
||||
string IDVal = urlFixed.After(peram);
|
||||
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
|
||||
item3.Value = inGameDir + IDVal + fileext;
|
||||
item3.Value = (inGameDir + IDVal + fileext).Replace(" ", "");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -151,17 +116,38 @@ class SDKFuncs
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(meshname))
|
||||
{
|
||||
string url = item3.Value;
|
||||
string rbxassetid = "rbxassetid://";
|
||||
string urlFixed = "https://assetdelivery.roblox.com/v1/asset/?id=" + url.After(rbxassetid);
|
||||
string peram = "id=";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
if (urlFixed.Contains(peram))
|
||||
{
|
||||
string IDVal = urlFixed.After(peram);
|
||||
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
|
||||
item3.Value = inGameDir + IDVal + fileext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
|
||||
item3.Value = inGameDir + name + fileext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item3.Value = inGameDir + meshname;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
doc.Save(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: actually download the script assets instead of fixing the scripts lol. fixing the scripts won't work anyways because we don't support https natively.
|
||||
|
|
@ -501,6 +487,17 @@ class SDKFuncs
|
|||
|
||||
public static void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, string itemname, string meshname)
|
||||
{
|
||||
string oldfile = File.ReadAllText(path);
|
||||
string fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)).Replace("#9;", "\t");
|
||||
XDocument doc = null;
|
||||
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { CheckCharacters = false };
|
||||
Stream filestream = GlobalFuncs.GenerateStreamFromString(fixedfile);
|
||||
using (XmlReader xmlReader = XmlReader.Create(filestream, xmlReaderSettings))
|
||||
{
|
||||
xmlReader.MoveToContent();
|
||||
doc = XDocument.Load(xmlReader);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch (type)
|
||||
|
|
@ -512,7 +509,7 @@ class SDKFuncs
|
|||
try
|
||||
{
|
||||
worker.ReportProgress(0);
|
||||
File.Copy(path, path.Replace(".rbxl", " BAK.rbxl"));
|
||||
File.Copy(path, path.Replace(".rbxl", " - BAK.rbxl"));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
@ -525,50 +522,50 @@ class SDKFuncs
|
|||
}
|
||||
//meshes
|
||||
worker.ReportProgress(5);
|
||||
DownloadFromNodes(path, RobloxDefs.Fonts);
|
||||
DownloadFromNodes(path, RobloxDefs.Fonts, 1, 1, 1, 1);
|
||||
DownloadFromNodes(doc, RobloxDefs.Fonts);
|
||||
DownloadFromNodes(doc, RobloxDefs.Fonts, 1, 1, 1, 1);
|
||||
//skybox
|
||||
worker.ReportProgress(10);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 1, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 2, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 3, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 4, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 5, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 1, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 2, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 3, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 4, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 5, 0, 0, 0);
|
||||
//decal
|
||||
worker.ReportProgress(15);
|
||||
DownloadFromNodes(path, RobloxDefs.Decal);
|
||||
DownloadFromNodes(doc, RobloxDefs.Decal);
|
||||
//texture
|
||||
worker.ReportProgress(20);
|
||||
DownloadFromNodes(path, RobloxDefs.Texture);
|
||||
DownloadFromNodes(doc, RobloxDefs.Texture);
|
||||
//tools and hopperbin
|
||||
worker.ReportProgress(25);
|
||||
DownloadFromNodes(path, RobloxDefs.Tool);
|
||||
DownloadFromNodes(doc, RobloxDefs.Tool);
|
||||
worker.ReportProgress(30);
|
||||
DownloadFromNodes(path, RobloxDefs.HopperBin);
|
||||
DownloadFromNodes(doc, RobloxDefs.HopperBin);
|
||||
//sound
|
||||
worker.ReportProgress(40);
|
||||
DownloadFromNodes(path, RobloxDefs.Sound);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sound);
|
||||
worker.ReportProgress(50);
|
||||
DownloadFromNodes(path, RobloxDefs.ImageLabel);
|
||||
DownloadFromNodes(doc, RobloxDefs.ImageLabel);
|
||||
//clothing
|
||||
worker.ReportProgress(60);
|
||||
DownloadFromNodes(path, RobloxDefs.Shirt);
|
||||
DownloadFromNodes(doc, RobloxDefs.Shirt);
|
||||
worker.ReportProgress(65);
|
||||
DownloadFromNodes(path, RobloxDefs.ShirtGraphic);
|
||||
DownloadFromNodes(doc, RobloxDefs.ShirtGraphic);
|
||||
worker.ReportProgress(70);
|
||||
DownloadFromNodes(path, RobloxDefs.Pants);
|
||||
DownloadFromNodes(doc, RobloxDefs.Pants);
|
||||
//scripts
|
||||
worker.ReportProgress(80);
|
||||
DownloadFromNodes(path, RobloxDefs.Script);
|
||||
DownloadFromNodes(doc, RobloxDefs.Script);
|
||||
worker.ReportProgress(90);
|
||||
DownloadFromNodes(path, RobloxDefs.LocalScript);
|
||||
DownloadFromNodes(doc, RobloxDefs.LocalScript);
|
||||
//localize any scripts that are not handled
|
||||
/*
|
||||
worker.ReportProgress(95);
|
||||
RobloxXML.DownloadScriptFromNodes(path, "Script");
|
||||
RobloxXML.DownloadScriptFromNodes(doc, "Script");
|
||||
worker.ReportProgress(97);
|
||||
RobloxXML.DownloadScriptFromNodes(path, "LocalScript");*/
|
||||
RobloxXML.DownloadScriptFromNodes(doc, "LocalScript");*/
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.RBXM:
|
||||
|
|
@ -589,50 +586,50 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//meshes
|
||||
DownloadFromNodes(path, RobloxDefs.Fonts);
|
||||
DownloadFromNodes(path, RobloxDefs.Fonts, 1, 1, 1, 1);
|
||||
DownloadFromNodes(doc, RobloxDefs.Fonts);
|
||||
DownloadFromNodes(doc, RobloxDefs.Fonts, 1, 1, 1, 1);
|
||||
//skybox
|
||||
worker.ReportProgress(10);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 1, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 2, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 3, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 4, 0, 0, 0);
|
||||
DownloadFromNodes(path, RobloxDefs.Sky, 5, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 1, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 2, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 3, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 4, 0, 0, 0);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sky, 5, 0, 0, 0);
|
||||
//decal
|
||||
worker.ReportProgress(15);
|
||||
DownloadFromNodes(path, RobloxDefs.Decal);
|
||||
DownloadFromNodes(doc, RobloxDefs.Decal);
|
||||
//texture
|
||||
worker.ReportProgress(20);
|
||||
DownloadFromNodes(path, RobloxDefs.Texture);
|
||||
DownloadFromNodes(doc, RobloxDefs.Texture);
|
||||
//tools and hopperbin
|
||||
worker.ReportProgress(25);
|
||||
DownloadFromNodes(path, RobloxDefs.Tool);
|
||||
DownloadFromNodes(doc, RobloxDefs.Tool);
|
||||
worker.ReportProgress(30);
|
||||
DownloadFromNodes(path, RobloxDefs.HopperBin);
|
||||
DownloadFromNodes(doc, RobloxDefs.HopperBin);
|
||||
//sound
|
||||
worker.ReportProgress(40);
|
||||
DownloadFromNodes(path, RobloxDefs.Sound);
|
||||
DownloadFromNodes(doc, RobloxDefs.Sound);
|
||||
worker.ReportProgress(50);
|
||||
DownloadFromNodes(path, RobloxDefs.ImageLabel);
|
||||
DownloadFromNodes(doc, RobloxDefs.ImageLabel);
|
||||
//clothing
|
||||
worker.ReportProgress(60);
|
||||
DownloadFromNodes(path, RobloxDefs.Shirt);
|
||||
DownloadFromNodes(doc, RobloxDefs.Shirt);
|
||||
worker.ReportProgress(65);
|
||||
DownloadFromNodes(path, RobloxDefs.ShirtGraphic);
|
||||
DownloadFromNodes(doc, RobloxDefs.ShirtGraphic);
|
||||
worker.ReportProgress(70);
|
||||
DownloadFromNodes(path, RobloxDefs.Pants);
|
||||
DownloadFromNodes(doc, RobloxDefs.Pants);
|
||||
//scripts
|
||||
worker.ReportProgress(80);
|
||||
DownloadFromNodes(path, RobloxDefs.Script);
|
||||
DownloadFromNodes(doc, RobloxDefs.Script);
|
||||
worker.ReportProgress(90);
|
||||
DownloadFromNodes(path, RobloxDefs.LocalScript);
|
||||
DownloadFromNodes(doc, RobloxDefs.LocalScript);
|
||||
//localize any scripts that are not handled
|
||||
/*
|
||||
worker.ReportProgress(95);
|
||||
RobloxXML.DownloadScriptFromNodes(path, "Script");
|
||||
RobloxXML.DownloadScriptFromNodes(doc, "Script");
|
||||
worker.ReportProgress(97);
|
||||
RobloxXML.DownloadScriptFromNodes(path, "LocalScript");*/
|
||||
RobloxXML.DownloadScriptFromNodes(doc, "LocalScript");*/
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.Hat:
|
||||
|
|
@ -653,15 +650,15 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//meshes
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHatFonts, itemname, meshname);
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHatFonts, 1, 1, 1, 1, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHatFonts, itemname, meshname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHatFonts, 1, 1, 1, 1, itemname);
|
||||
worker.ReportProgress(25);
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHatSound);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHatSound);
|
||||
//scripts
|
||||
worker.ReportProgress(50);
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHatScript);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHatScript);
|
||||
worker.ReportProgress(75);
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHatLocalScript);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHatLocalScript);
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.Head:
|
||||
|
|
@ -682,8 +679,8 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//meshes
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHeadFonts, itemname);
|
||||
DownloadFromNodes(path, RobloxDefs.ItemHeadFonts, 1, 1, 1, 1, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHeadFonts, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemHeadFonts, 1, 1, 1, 1, itemname);
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.Face:
|
||||
|
|
@ -704,7 +701,7 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//decal
|
||||
DownloadFromNodes(path, RobloxDefs.ItemFaceTexture, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemFaceTexture, itemname);
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.TShirt:
|
||||
|
|
@ -725,7 +722,7 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//texture
|
||||
DownloadFromNodes(path, RobloxDefs.ItemTShirtTexture, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemTShirtTexture, itemname);
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.Shirt:
|
||||
|
|
@ -746,7 +743,7 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//texture
|
||||
DownloadFromNodes(path, RobloxDefs.ItemShirtTexture, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemShirtTexture, itemname);
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
case RobloxFileType.Pants:
|
||||
|
|
@ -767,7 +764,7 @@ class SDKFuncs
|
|||
worker.ReportProgress(0);
|
||||
}
|
||||
//texture
|
||||
DownloadFromNodes(path, RobloxDefs.ItemPantsTexture, itemname);
|
||||
DownloadFromNodes(doc, RobloxDefs.ItemPantsTexture, itemname);
|
||||
worker.ReportProgress(100);
|
||||
break;
|
||||
/*case RobloxFileType.Script:
|
||||
|
|
@ -800,6 +797,14 @@ class SDKFuncs
|
|||
{
|
||||
MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
XmlWriterSettings xmlWriterSettings = new XmlWriterSettings { CheckCharacters = false, Indent = true };
|
||||
using (XmlWriter xmlReader = XmlWriter.Create(path, xmlWriterSettings))
|
||||
{
|
||||
doc.WriteTo(xmlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
@ -1098,15 +1103,15 @@ class SDKFuncs
|
|||
{
|
||||
if (!GlobalVars.UserConfiguration.DisabledItemMakerHelp)
|
||||
{
|
||||
string helptext = "If you're trying to create a offline item, please use these file extension names when saving your files:\n.rbxm - ROBLOX Model/Item\n.mesh - ROBLOX Mesh\n.png - Texture/Icon\n.wav - Sound";
|
||||
MessageBox.Show(helptext, "Novetus Item SDK", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
string helptext = "If you're trying to create a offline item, please use these file extension names when saving your files:\n.rbxm - ROBLOX Model/Item\n.rbxl - ROBLOX Place\n.mesh - ROBLOX Mesh\n.png - Texture/Icon\n.wav - Sound";
|
||||
MessageBox.Show(helptext, "Novetus Asset SDK", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
Downloader download = new Downloader(fullURL, name, "Roblox Model (*.rbxm)|*.rbxm|Roblox Mesh (*.mesh)|*.mesh|PNG Image (*.png)|*.png|WAV Sound (*.wav)|*.wav");
|
||||
Downloader download = new Downloader(fullURL, name, "Roblox Model (*.rbxm)|*.rbxm|Roblox Place (*.rbxl) |*.rbxl|Roblox Mesh (*.mesh)|*.mesh|PNG Image (*.png)|*.png|WAV Sound (*.wav)|*.wav");
|
||||
|
||||
try
|
||||
{
|
||||
string helptext = "In order for the item to work in Novetus, you'll need to find an icon for your item (it must be a .png file), then name it the same name as your item.\n\nIf you want to create a local (offline) item, you'll have to download the meshes/textures from the links in the rbxm file, then replace the links in the file pointing to where they are using rbxasset://. Look at the directory in the 'shareddata/charcustom' folder that best suits your item type, then look at the rbxm for any one of the items. If you get a corrupted file, change the URL using the drop down box.";
|
||||
string helptext = "In order for the item to work in Novetus, you'll need to find an icon for your item (it must be a .png file), then name it the same name as your item.\n\nIf you want to create a local (offline) item, use the Asset Localizer in the Asset SDK.\n\nIf you get a corrupted file, change the URL using the drop down box.";
|
||||
download.InitDownload((!GlobalVars.UserConfiguration.DisabledItemMakerHelp) ? helptext : "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -1122,12 +1127,6 @@ class SDKFuncs
|
|||
else
|
||||
{
|
||||
Process.Start(fullURL);
|
||||
|
||||
if (!GlobalVars.UserConfiguration.DisabledItemMakerHelp)
|
||||
{
|
||||
string helptext = "In order for the item to work in Novetus, you'll need to find an icon for your item (it must be a .png file), then name it the same name as your item.\n\nIf you want to create a local (offline) item, you'll have to download the meshes/textures from the links in the rbxm file, then replace the links in the file pointing to where they are using rbxasset://. Look at the directory in the 'shareddata/charcustom' folder that best suits your item type, then look at the rbxm for any one of the items. If you get a corrupted file, change the URL using the drop down box.\n\nIf you're trying to create a offline item, please use these file extension names when saving your files:\n.rbxm - ROBLOX Model/Item\n.mesh - ROBLOX Mesh\n.png - Texture/Icon\n.wav - Sound";
|
||||
MessageBox.Show(helptext, "Novetus Asset SDK - Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
|
|
|||
|
|
@ -122,15 +122,15 @@
|
|||
//
|
||||
// AssetDownloaderBatch_Note
|
||||
//
|
||||
this.AssetDownloaderBatch_Note.AutoSize = true;
|
||||
this.AssetDownloaderBatch_Note.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.AssetDownloaderBatch_Note.ForeColor = System.Drawing.Color.Red;
|
||||
this.AssetDownloaderBatch_Note.Location = new System.Drawing.Point(6, 156);
|
||||
this.AssetDownloaderBatch_Note.Location = new System.Drawing.Point(38, 150);
|
||||
this.AssetDownloaderBatch_Note.Name = "AssetDownloaderBatch_Note";
|
||||
this.AssetDownloaderBatch_Note.Size = new System.Drawing.Size(237, 24);
|
||||
this.AssetDownloaderBatch_Note.Size = new System.Drawing.Size(174, 42);
|
||||
this.AssetDownloaderBatch_Note.TabIndex = 23;
|
||||
this.AssetDownloaderBatch_Note.Text = "You must enter in each item as <Name>|<ID>. \r\nExample: RedTopHat|2972302";
|
||||
this.AssetDownloaderBatch_Note.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
this.AssetDownloaderBatch_Note.Text = "You must enter in each item as <Name>|<ID>|<Version>. \r\nExample: RedTopHat|297230" +
|
||||
"2|1";
|
||||
this.AssetDownloaderBatch_Note.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.AssetDownloaderBatch_Note.Visible = false;
|
||||
//
|
||||
// AssetDownloaderBatch_Status
|
||||
|
|
@ -159,11 +159,11 @@
|
|||
// AssetDownloaderBatch_BatchIDBox
|
||||
//
|
||||
this.AssetDownloaderBatch_BatchIDBox.Enabled = false;
|
||||
this.AssetDownloaderBatch_BatchIDBox.Location = new System.Drawing.Point(6, 183);
|
||||
this.AssetDownloaderBatch_BatchIDBox.Location = new System.Drawing.Point(6, 195);
|
||||
this.AssetDownloaderBatch_BatchIDBox.Multiline = true;
|
||||
this.AssetDownloaderBatch_BatchIDBox.Name = "AssetDownloaderBatch_BatchIDBox";
|
||||
this.AssetDownloaderBatch_BatchIDBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.AssetDownloaderBatch_BatchIDBox.Size = new System.Drawing.Size(242, 89);
|
||||
this.AssetDownloaderBatch_BatchIDBox.Size = new System.Drawing.Size(242, 77);
|
||||
this.AssetDownloaderBatch_BatchIDBox.TabIndex = 0;
|
||||
//
|
||||
// AssetDownloader_AssetNameBox
|
||||
|
|
@ -227,8 +227,8 @@
|
|||
//
|
||||
this.AssetDownloader_AssetVersionSelector.Location = new System.Drawing.Point(197, 30);
|
||||
this.AssetDownloader_AssetVersionSelector.Maximum = new decimal(new int[] {
|
||||
99,
|
||||
0,
|
||||
-727379969,
|
||||
232,
|
||||
0,
|
||||
0});
|
||||
this.AssetDownloader_AssetVersionSelector.Name = "AssetDownloader_AssetVersionSelector";
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ public partial class AssetSDK : Form
|
|||
#endregion
|
||||
|
||||
#region Asset Downloader
|
||||
|
||||
private void AssetDownloader_URLSelection_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (AssetDownloader_URLSelection.SelectedIndex)
|
||||
|
|
@ -122,9 +121,9 @@ public partial class AssetSDK : Form
|
|||
{
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog
|
||||
{
|
||||
FileName = ".",
|
||||
FileName = "Choose batch download location.",
|
||||
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
|
||||
Filter = "Roblox Model(*.rbxm) | *.rbxm | Roblox Mesh(*.mesh) | *.mesh | PNG Image(*.png) | *.png | WAV Sound(*.wav) | *.wav",
|
||||
Filter = "Roblox Model (*.rbxm)|*.rbxm|Roblox Place (*.rbxl) |*.rbxl|Roblox Mesh (*.mesh)|*.mesh|PNG Image (*.png)|*.png|WAV Sound (*.wav)|*.wav",
|
||||
DefaultExt = ".rbxm",
|
||||
Title = "Save files downloaded via batch"
|
||||
};
|
||||
|
|
@ -145,7 +144,7 @@ public partial class AssetSDK : Form
|
|||
linesplit[0] + extension,
|
||||
url,
|
||||
linesplit[1],
|
||||
Convert.ToInt32(AssetDownloader_AssetVersionSelector.Value),
|
||||
Convert.ToInt32(linesplit[2]),
|
||||
isWebSite, basepath);
|
||||
}
|
||||
|
||||
|
|
@ -170,6 +169,7 @@ public partial class AssetSDK : Form
|
|||
AssetDownloaderBatch_Note.Visible = true;
|
||||
AssetDownloader_AssetIDBox.Enabled = false;
|
||||
AssetDownloader_AssetNameBox.Enabled = false;
|
||||
AssetDownloader_AssetVersionSelector.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -177,9 +177,18 @@ public partial class AssetSDK : Form
|
|||
AssetDownloaderBatch_Note.Visible = false;
|
||||
AssetDownloader_AssetIDBox.Enabled = true;
|
||||
AssetDownloader_AssetNameBox.Enabled = true;
|
||||
AssetDownloader_AssetVersionSelector.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void URLOverrideBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (hasOverrideWarningOpenedOnce == false)
|
||||
{
|
||||
MessageBox.Show("By using the custom URL setting, you will override any selected entry in the default URL list. Keep this in mind before downloading anything with this option.\n\nAlso, the URL must be a asset url with 'asset/?id=' at the end of it in order for the Asset Downloader to work smoothly.", "Novetus Asset SDK - URL Override Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
hasOverrideWarningOpenedOnce = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Asset Localizer
|
||||
|
|
@ -251,15 +260,6 @@ public partial class AssetSDK : Form
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void URLOverrideBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (hasOverrideWarningOpenedOnce == false)
|
||||
{
|
||||
MessageBox.Show("By using the custom URL setting, you will override any selected entry in the default URL list. Keep this in mind before downloading anything with this option.\n\nAlso, the URL must be a asset url with 'asset/?id=' at the end of it in order for the Asset Downloader to work smoothly.", "Novetus Asset SDK - URL Override Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
hasOverrideWarningOpenedOnce = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mesh Converter
|
||||
|
|
|
|||
Loading…
Reference in New Issue