More xml stuff

This commit is contained in:
Bitl 2019-11-11 12:13:54 -07:00
parent e1b84b51e7
commit 72708d2c46
31 changed files with 632 additions and 18 deletions

View File

@ -0,0 +1,17 @@
public class AssetCacheDef
{
public AssetCacheDef(string clas, string[] id, string[] ext, string[] dir, string[] gamedir)
{
Class = clas;
Id = id;
Ext = ext;
Dir = dir;
GameDir = gamedir;
}
public string Class { get; set; }
public string[] Id { get; set; }
public string[] Ext { get; set; }
public string[] Dir { get; set; }
public string[] GameDir { get; set; }
}

View File

@ -19,6 +19,13 @@ class Downloader
fileFilter = filter;
}
public Downloader(string url, string name)
{
fileName = name;
fileURL = url;
fileFilter = "";
}
public void setDownloadOutcome(string text)
{
downloadOutcome = text;
@ -33,7 +40,7 @@ class Downloader
{
downloadOutcomeAddText = additionalText;
string outputfilename = fileName + "." + fileext;
string outputfilename = fileName + fileext;
string fullpath = path + "\\" + outputfilename;
try

View File

@ -19,8 +19,11 @@ public static class GlobalVars
public static readonly string ConfigDir = BasePath + "\\config";
public static readonly string ClientDir = BasePath + "\\clients";
public static readonly string MapsDir = BasePath + "\\maps";
public static readonly string BaseGameDir = "rbxasset://../../../";
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
public static readonly string MapGameDir = BaseGameDir + "maps/";
//customization
public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
public static readonly string hatdir = CustomPlayerDir + "\\hats";
public static readonly string facedir = CustomPlayerDir + "\\faces";
public static readonly string headdir = CustomPlayerDir + "\\heads";
@ -28,22 +31,6 @@ public static class GlobalVars
public static readonly string shirtdir = CustomPlayerDir + "\\shirts";
public static readonly string pantsdir = CustomPlayerDir + "\\pants";
public static readonly string extradir = CustomPlayerDir + "\\custom";
//asset cache
public static readonly string AssetCacheDir = DataPath + "\\assetcache";
public static readonly string AssetCacheDirSky = AssetCacheDir + "\\sky";
public static readonly string AssetCacheDirFonts = AssetCacheDir + "\\fonts";
public static readonly string AssetCacheDirSounds = AssetCacheDir + "\\sounds";
public static readonly string AssetCacheDirTextures = AssetCacheDir + "\\textures";
//game dirs
public static readonly string BaseGameDir = "rbxasset://../../../";
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
public static readonly string MapGameDir = BaseGameDir + "maps/";
public static readonly string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
public static readonly string AssetCacheFontsGameDir = AssetCacheGameDir + "fonts/";
public static readonly string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/";
public static readonly string AssetCacheSoundsGameDir = AssetCacheGameDir + "sounds/";
public static readonly string AssetCacheTexturesGameDir = AssetCacheGameDir + "textures/";
public static readonly string CharCustomGameDir = SharedDataGameDir + "charcustom/";
public static readonly string hatGameDir = CharCustomGameDir + "hats/";
@ -53,6 +40,31 @@ public static class GlobalVars
public static readonly string shirtGameDir = CharCustomGameDir + "shirts/";
public static readonly string pantsGameDir = CharCustomGameDir + "pants/";
public static readonly string extraGameDir = CharCustomGameDir + "custom/";
//asset cache
public static readonly string AssetCacheDir = DataPath + "\\assetcache";
public static readonly string AssetCacheDirSky = AssetCacheDir + "\\sky";
public static readonly string AssetCacheDirFonts = AssetCacheDir + "\\fonts";
public static readonly string AssetCacheDirSounds = AssetCacheDir + "\\sounds";
public static readonly string AssetCacheDirTextures = AssetCacheDir + "\\textures";
public static readonly string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui";
public static readonly string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
public static readonly string AssetCacheFontsGameDir = AssetCacheGameDir + "fonts/";
public static readonly string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/";
public static readonly string AssetCacheSoundsGameDir = AssetCacheGameDir + "sounds/";
public static readonly string AssetCacheTexturesGameDir = AssetCacheGameDir + "textures/";
public static readonly string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/";
//defs
public static AssetCacheDef Fonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { AssetCacheDirFonts, AssetCacheDirTextures }, new string[] { AssetCacheFontsGameDir, AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Sky { get { return new AssetCacheDef("Sky", new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }, new string[] { ".png" }, new string[] { AssetCacheDirSky }, new string[] { AssetCacheSkyGameDir }); } }
public static AssetCacheDef Decal { get { return new AssetCacheDef("Decal", new string[] { "Texture" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Texture { get { return new AssetCacheDef("Texture", new string[] { "Texture" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef HopperBin { get { return new AssetCacheDef("HopperBin", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Tool { get { return new AssetCacheDef("Tool", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Sound { get { return new AssetCacheDef("Sound", new string[] { "SoundId" }, new string[] { ".wav" }, new string[] { AssetCacheDirSounds }, new string[] { AssetCacheSoundsGameDir }); } }
public static AssetCacheDef ImageLabel { get { return new AssetCacheDef("ImageLabel", new string[] { "Image" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
//item defs below
public static string IP = "localhost";
public static string Version = "";

View File

@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
public class RobloxXMLLocalizer
{
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex)
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex]);
}
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex,string outputPath, int inGameDirIndex)
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], outputPath, assetdef.GameDir[inGameDirIndex]);
}
public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir)
{
string oldfile = File.ReadAllText(filepath);
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
XDocument doc = XDocument.Parse(fixedfile);
try
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == itemClassValue
select nodes;
foreach (var item in v)
{
var v2 = from nodes in item.Descendants("Content")
where nodes.Attribute("name").Value == itemIdValue
select nodes;
foreach (var item2 in v2)
{
var v3 = from nodes in item2.Descendants("url")
select nodes;
foreach (var item3 in v3)
{
if (!item3.Value.Contains("rbxasset"))
{
//do whatever with your value
string url = item3.Value;
DownloadFilesFromNode(url, outputPath, fileext);
string[] substrings = url.Split('=');
item3.Value = inGameDir + substrings[1] + fileext;
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
doc.Save(filepath);
}
}
private static void DownloadFilesFromNode(string url, string path, string fileext)
{
if (url.Contains('='))
{
string[] substrings = url.Split('=');
if (!string.IsNullOrWhiteSpace(substrings[1]))
{
Downloader download = new Downloader(url, substrings[1]);
try
{
download.InitDownload(path, fileext);
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
private static string RemoveInvalidXmlChars(string content)
{
return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray());
}
private static string ReplaceHexadecimalSymbols(string txt)
{
string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]";
return Regex.Replace(txt, r, "", RegexOptions.Compiled);
}
}

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NovetusTest_RobloxFileDownloaderAndSorter", "NovetusTest_RobloxFileDownloaderAndSorter\NovetusTest_RobloxFileDownloaderAndSorter.csproj", "{5625D44D-4592-4926-8EFD-76FCC5437971}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5625D44D-4592-4926-8EFD-76FCC5437971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5625D44D-4592-4926-8EFD-76FCC5437971}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5625D44D-4592-4926-8EFD-76FCC5437971}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5625D44D-4592-4926-8EFD-76FCC5437971}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,162 @@
using System;
using System.Net;
using System.Windows.Forms;
using System.IO;
class Downloader
{
private string fileURL;
private string fileName;
private string fileFilter;
private string downloadOutcome;
private string downloadOutcomeAddText;
private static string downloadOutcomeException;
public Downloader(string url, string name, string filter)
{
fileName = name;
fileURL = url;
fileFilter = filter;
}
public Downloader(string url, string name)
{
fileName = name;
fileURL = url;
fileFilter = "";
}
public void setDownloadOutcome(string text)
{
downloadOutcome = text;
}
public string getDownloadOutcome()
{
return downloadOutcome;
}
public void InitDownload(string path, string fileext, string additionalText = "")
{
downloadOutcomeAddText = additionalText;
string outputfilename = fileName + fileext;
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;
}
}
public void InitDownload(string additionalText = "")
{
downloadOutcomeAddText = additionalText;
SaveFileDialog saveFileDialog1 = new SaveFileDialog()
{
FileName = fileName,
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
Filter = fileFilter,
Title = "Save " + fileName
};
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
int read = DownloadFile(fileURL, saveFileDialog1.FileName);
downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException;
}
catch (Exception ex)
{
downloadOutcome = "Error when downloading file: " + ex.Message;
}
}
}
private static int DownloadFile(string remoteFilename, string localFilename)
{
//credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm)
//and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408)
// Function will return the number of bytes processed
// to the caller. Initialize to 0 here.
int bytesProcessed = 0;
// Assign values to these objects here so that they can
// be referenced in the finally block
Stream remoteStream = null;
Stream localStream = null;
WebResponse response = null;
// Use a try/catch/finally block as both the WebRequest and Stream
// classes throw exceptions upon error
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
// Create a request for the specified remote file name
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename);
request.UserAgent = "Roblox/WinINet";
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
if (request != null)
{
// Send the request to the server and retrieve the
// WebResponse object
response = request.GetResponse();
if (response != null)
{
// Once the WebResponse object has been retrieved,
// get the stream object associated with the response's data
remoteStream = response.GetResponseStream();
// Create the local file
localStream = File.Create(localFilename);
// Allocate a 1k buffer
byte[] buffer = new byte[1024];
int bytesRead;
// Simple do/while loop to read from stream until
// no bytes are returned
do
{
// Read data (up to 1k) from the stream
bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
// Write the data to the local file
localStream.Write(buffer, 0, bytesRead);
// Increment total bytes processed
bytesProcessed += bytesRead;
} while (bytesRead > 0);
}
}
}
catch (Exception e)
{
downloadOutcomeException = " Exception detected: " + e.Message;
}
finally
{
// Close the response and streams objects here
// to make sure they're closed even if an exception
// is thrown at some point
if (response != null) response.Close();
if (remoteStream != null) remoteStream.Close();
if (localStream != null) localStream.Close();
}
// Return total bytes processed to caller.
return bytesProcessed;
}
}

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5625D44D-4592-4926-8EFD-76FCC5437971}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NovetusTest_RobloxFileDownloaderAndSorter</RootNamespace>
<AssemblyName>NovetusTest_RobloxFileDownloaderAndSorter</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Downloader.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RobloxXMLLocalizer.cs" />
<Compile Include="TestProgramVars.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NovetusTest_RobloxFileDownloaderAndSorter
{
class Program
{
static void Main(string[] args)
{
string path = GlobalVars.RootPath + "\\Test.rbxl";
string exportpath = GlobalVars.RootPath + "\\Export";
Console.WriteLine("Meshes");
RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Fonts, 0, 0, exportpath, 0);
Console.WriteLine("Finished!");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NovetusTest_RobloxFileDownloaderAndSorter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NovetusTest_RobloxFileDownloaderAndSorter")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5625d44d-4592-4926-8efd-76fcc5437971")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,105 @@
using NovetusTest_RobloxFileDownloaderAndSorter;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
public class RobloxXMLLocalizer
{
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex)
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex]);
}
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex,string outputPath, int inGameDirIndex)
{
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], outputPath, assetdef.GameDir[inGameDirIndex]);
}
public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir)
{
string oldfile = File.ReadAllText(filepath);
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
XDocument doc = XDocument.Parse(fixedfile);
try
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == itemClassValue
select nodes;
foreach (var item in v)
{
var v2 = from nodes in item.Descendants("Content")
where nodes.Attribute("name").Value == itemIdValue
select nodes;
foreach (var item2 in v2)
{
var v3 = from nodes in item2.Descendants("url")
select nodes;
foreach (var item3 in v3)
{
if (!item3.Value.Contains("rbxasset"))
{
//do whatever with your value
string url = item3.Value;
DownloadFilesFromNode(url, outputPath, fileext);
string[] substrings = url.Split('=');
item3.Value = inGameDir + substrings[1] + fileext;
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
doc.Save(filepath);
}
}
private static void DownloadFilesFromNode(string url, string path, string fileext)
{
if (url.Contains('='))
{
string[] substrings = url.Split('=');
if (!string.IsNullOrWhiteSpace(substrings[1]))
{
Downloader download = new Downloader(url, substrings[1]);
try
{
download.InitDownload(path, fileext);
}
catch (Exception ex)
{
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
private static string RemoveInvalidXmlChars(string content)
{
return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray());
}
private static string ReplaceHexadecimalSymbols(string txt)
{
string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]";
return Regex.Replace(txt, r, "", RegexOptions.Compiled);
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace NovetusTest_RobloxFileDownloaderAndSorter
{
public class AssetCacheDef
{
public AssetCacheDef(string clas, string[] id, string[] ext, string[] dir, string[] gamedir)
{
Class = clas;
Id = id;
Ext = ext;
Dir = dir;
GameDir = gamedir;
}
public string Class { get; set; }
public string[] Id { get; set; }
public string[] Ext { get; set; }
public string[] Dir { get; set; }
public string[] GameDir { get; set; }
}
class GlobalVars
{
public static readonly string RootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static readonly string BasePath = RootPath.Replace(@"\", @"\\");
public static readonly string DataPath = BasePath + "\\shareddata";
public static readonly string AssetCacheDir = DataPath + "\\assetcache";
public static readonly string AssetCacheDirSky = AssetCacheDir + "\\sky";
public static readonly string AssetCacheDirFonts = AssetCacheDir + "\\fonts";
public static readonly string AssetCacheDirSounds = AssetCacheDir + "\\sounds";
public static readonly string AssetCacheDirTextures = AssetCacheDir + "\\textures";
public static readonly string BaseGameDir = "rbxasset://../../../";
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
public static readonly string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
public static readonly string AssetCacheFontsGameDir = AssetCacheGameDir + "fonts/";
public static readonly string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/";
public static readonly string AssetCacheSoundsGameDir = AssetCacheGameDir + "sounds/";
public static readonly string AssetCacheTexturesGameDir = AssetCacheGameDir + "textures/";
public static AssetCacheDef Fonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId"}, new string[] { ".mesh", ".png" }, new string[] { AssetCacheDirFonts, AssetCacheDirTextures }, new string[] { AssetCacheFontsGameDir, AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Sky { get { return new AssetCacheDef("Sky", new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }, new string[] { ".png" }, new string[] { AssetCacheDirSky }, new string[] { AssetCacheSkyGameDir }); } }
public static AssetCacheDef Decal { get { return new AssetCacheDef("Decal", new string[] { "Texture" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Texture { get { return new AssetCacheDef("Texture", new string[] { "Texture" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef HopperBin { get { return new AssetCacheDef("HopperBin", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Tool { get { return new AssetCacheDef("Tool", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
public static AssetCacheDef Sound { get { return new AssetCacheDef("Sound", new string[] { "SoundId" }, new string[] { ".wav" }, new string[] { AssetCacheDirSounds }, new string[] { AssetCacheSoundsGameDir }); } }
public static AssetCacheDef ImageLabel { get { return new AssetCacheDef("ImageLabel", new string[] { "Image" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } }
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>