0.470.0.419147

This commit is contained in:
Max
2021-03-19 21:38:13 -05:00
parent 535ffa905c
commit 336792dc83
5 changed files with 32 additions and 78 deletions

View File

@ -1,18 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using RobloxFiles.DataTypes;
namespace RobloxFiles.UnitTest
{
static class Program
{
const string pattern = "\\d+$";
static void PrintTreeImpl(Instance inst, int stack = 0)
{
string padding = "";
@ -24,15 +17,20 @@ namespace RobloxFiles.UnitTest
switch (inst.ClassName)
{
case "Script":
{
extension = ".server.lua";
break;
}
case "LocalScript":
{
extension = ".client.lua";
break;
}
case "ModuleScript":
{
extension = ".lua";
break;
default: break;
}
}
Console.WriteLine($"{padding}{inst.Name}{extension}");
@ -54,57 +52,7 @@ namespace RobloxFiles.UnitTest
Debugger.Break();
}
static void CountAssets(string path)
{
Console.WriteLine("Opening file...");
RobloxFile target = RobloxFile.Open(path);
var workspace = target.FindFirstChildOfClass<Workspace>();
var assets = new HashSet<string>();
if (workspace == null)
{
Console.WriteLine("No workspace found!");
Debugger.Break();
return;
}
foreach (Instance inst in workspace.GetDescendants())
{
var instPath = inst.GetFullName();
var props = inst.Properties;
foreach (var prop in props)
{
var propName = prop.Key;
var content = prop.Value.CastValue<Content>();
if (content != null)
{
string url = content.Url.Trim();
var id = Regex
.Match(url, pattern)?
.Value;
if (id != null && id.Length > 5)
url = "rbxassetid://" + id;
if (url.Length > 0 && !assets.Contains(url))
{
Console.WriteLine($"[{url}] at {instPath}.{propName}");
assets.Add(url);
}
}
}
}
Console.WriteLine("Done! Press any key to continue...");
Console.Read();
}
[STAThread]
static void Main(string[] args)
{
@ -120,8 +68,6 @@ namespace RobloxFiles.UnitTest
RobloxFile bin = RobloxFile.Open(@"Files\Binary.rbxl");
RobloxFile xml = RobloxFile.Open(@"Files\Xml.rbxlx");
Folder attributes = bin.FindFirstChild<Folder>("Attributes", true);
Console.WriteLine("Files opened! Pausing execution for debugger analysis...");
Debugger.Break();