I just recently got into C# and made a console application to convert model files from binary to xml or the other way around. I’m not the best programmer but I think I got it right.
If anyone else is learning C# and wants to make stuff together I’m glad to do so because I need some more experience in this language.
Paygammy/RBXMLConvert (github.com)
Here’s the very basic source code that I wrote.
using RobloxFiles;
Console.Title = "RBXMLConvert Console Application";
Console.WriteLine("Thank you for using my conversion tool!\nBig credit to MaximumADHD for the API.\n\nPlease input the path to your file.");
string? FilePath = Console.In.ReadLine();
if (File.Exists(FilePath))
{
Console.WriteLine("Processing...");
RobloxFile robloxFile = RobloxFile.Open(FilePath);
switch (robloxFile)
{
case BinaryRobloxFile:
{
Console.WriteLine("Converting from BinaryRobloxFile");
RobloxFile XmlResult = new XmlRobloxFile();
foreach (Instance robloxInstance in robloxFile.GetChildren())
{
robloxInstance.Parent = XmlResult;
}
string SavePath = FilePath.Replace(".rbxm", ".rbxmx");
XmlResult.Save(SavePath);
break;
}
case XmlRobloxFile:
{
Console.WriteLine("Converting from Xml");
RobloxFile BinaryResult = new BinaryRobloxFile();
foreach (Instance robloxInstance in robloxFile.GetChildren())
{
robloxInstance.Parent = BinaryResult;
}
string SavePath = FilePath.Replace(".rbxmx", ".rbxm");
BinaryResult.Save(SavePath);
break;
}
}
}
Overall, I’m just kind of insecure about the code but I am hoping this helps whoever needs it because it sure helped me.