wip roblox file parser
This commit is contained in:
parent
a83895e6ea
commit
dca02c1220
Binary file not shown.
|
|
@ -19,6 +19,7 @@ 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";
|
||||
//customization
|
||||
public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
|
||||
public static readonly string hatdir = CustomPlayerDir + "\\hats";
|
||||
public static readonly string facedir = CustomPlayerDir + "\\faces";
|
||||
|
|
@ -27,6 +28,12 @@ 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";
|
||||
public static string IP = "localhost";
|
||||
public static string Version = "";
|
||||
public static string SharedArgs = "";
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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_RobloxXMLFileParser", "NovetusTest_RobloxXMLFileParser\NovetusTest_RobloxXMLFileParser.csproj", "{30A2FB06-2B19-45E3-83D1-D7A121BC6567}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{30A2FB06-2B19-45E3-83D1-D7A121BC6567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{30A2FB06-2B19-45E3-83D1-D7A121BC6567}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{30A2FB06-2B19-45E3-83D1-D7A121BC6567}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{30A2FB06-2B19-45E3-83D1-D7A121BC6567}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<?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>{30A2FB06-2B19-45E3-83D1-D7A121BC6567}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NovetusTest_RobloxXMLFileParser</RootNamespace>
|
||||
<AssemblyName>NovetusTest_RobloxXMLFileParser</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.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="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RobloxXMLParser.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>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NovetusTest_RobloxXMLFileParser
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string path = @"G:\Projects\Novetus\Novetus\maps\2012\2012 - Iron Cafe.rbxl";
|
||||
|
||||
Console.WriteLine("Meshes");
|
||||
RobloxXMLParser.SearchNodes(path, "SpecialMesh", "MeshId");
|
||||
|
||||
Console.WriteLine("Mesh Textures");
|
||||
RobloxXMLParser.SearchNodes(path, "SpecialMesh", "TextureId");
|
||||
|
||||
Console.WriteLine("Decals");
|
||||
RobloxXMLParser.SearchNodes(path, "Decal", "Texture");
|
||||
|
||||
Console.WriteLine("SkyboxBk");
|
||||
RobloxXMLParser.SearchNodes(path, "Sky", "SkyboxBk");
|
||||
|
||||
Console.WriteLine("SkyboxDn");
|
||||
RobloxXMLParser.SearchNodes(path, "Sky", "SkyboxDn");
|
||||
|
||||
Console.WriteLine("SkyboxFt");
|
||||
RobloxXMLParser.SearchNodes(path, "Sky", "SkyboxFt");
|
||||
|
||||
Console.WriteLine("SkyboxRt");
|
||||
RobloxXMLParser.SearchNodes(path, "Sky", "SkyboxRt");
|
||||
|
||||
Console.WriteLine("SkyboxUp");
|
||||
RobloxXMLParser.SearchNodes(path, "Sky", "SkyboxUp");
|
||||
|
||||
Console.WriteLine("HopperBins");
|
||||
RobloxXMLParser.SearchNodes(path, "HopperBin", "TextureId");
|
||||
|
||||
Console.WriteLine("Tools");
|
||||
RobloxXMLParser.SearchNodes(path, "Tool", "TextureId");
|
||||
|
||||
Console.WriteLine("Sounds");
|
||||
RobloxXMLParser.SearchNodes(path, "Sound", "SoundId");
|
||||
|
||||
Console.WriteLine(path + " parsed.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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_RobloxXMLFileParser")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NovetusTest_RobloxXMLFileParser")]
|
||||
[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("30a2fb06-2b19-45e3-83d1-d7a121bc6567")]
|
||||
|
||||
// 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")]
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
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.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class RobloxXMLParser
|
||||
{
|
||||
public static void SearchNodes(string path, string itemClassValue, string itemIdValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
string oldfile = File.ReadAllText(path);
|
||||
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
|
||||
Console.WriteLine("Valid: " + CheckValidXmlChars(fixedfile));
|
||||
XDocument doc = XDocument.Parse(fixedfile);
|
||||
|
||||
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
|
||||
if (item3.Value.Contains('='))
|
||||
{
|
||||
string[] substrings = item3.Value.Split('=');
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(substrings[1]))
|
||||
{
|
||||
Console.WriteLine(item3.Value);
|
||||
Console.WriteLine("ID: " + substrings[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public static string RemoveInvalidXmlChars(string content)
|
||||
{
|
||||
return new string(content.Where(ch => System.Xml.XmlConvert.IsXmlChar(ch)).ToArray());
|
||||
}
|
||||
|
||||
static string ReplaceHexadecimalSymbols(string txt)
|
||||
{
|
||||
string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]";
|
||||
return Regex.Replace(txt, r, "", RegexOptions.Compiled);
|
||||
}
|
||||
|
||||
public static bool CheckValidXmlChars(string content)
|
||||
{
|
||||
return content.All(ch => System.Xml.XmlConvert.IsXmlChar(ch));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue