Legion
Legion
CC#
Created by Legion on 1/5/2024 in #help
Automate creation of XSD during build
Hi, I have a data model in an assembly used to read program configuration. I would like to generate an XSD during build, I can do this using XmlSchema. Howevever, I'm not sure how best to automate this. One way I've done it previously is using a side project in the same solution which i do a debug run from, it loads in the main assembly and dumps the file, but its not a very elegant solution. I cannot use XSD.exe because I develop on both Windows and Linux. Any advice? Thanks :) A generic description of the problem is, I need to: Compile the assembly -> load the assembly -> generate addition files based on the assembly. All in the same build.
1 replies
CC#
Created by Legion on 12/30/2023 in #help
✅ Is there a library for processing FBX or GLTF files?
I essentially need to do 2 things: 1. Generate an orthographic image of a 3D model 2. Generate the normals for the same.. I'm trying to find a way to automate the generation of these images for a 2D game so that we only need to use blender for modelling, rather than rendering. A couple of things i've noticed currently are, MixedReality, and GLTF loader, but i don't know if these are relevant to my needs. What I hope to build is a simple commandline tool that loads a directory of model files and dumps the images. The library I need would let me adjust the angle, resolution etc.
21 replies
CC#
Created by Legion on 12/28/2023 in #help
✅ Does anyone know why Validator.ValidateObject only validates properties and not fields?
And is there a way to make it work with fields?
43 replies
CC#
Created by Legion on 11/27/2023 in #help
✅ embed images in output
hi, I'm looking for a way to embed an image in the output in such a way that it's data is readable. Similar to how you can embed images in html via base64. A lot like including textures in an exe. Thanks
6 replies
CC#
Created by Legion on 11/16/2023 in #help
generating code without source generators
Hi, Godot uses source generators to fill in the gaps between your code and the engine, however if I need source generators of my own, their generated code isnt included in the analysis by godot. In these circumstances, is it acceptable to generate actual source files without the source generators? Or is there a more elegant way around this?
2 replies
CC#
Created by Legion on 10/19/2023 in #help
❔ XML attributes with different name and type, but same type.Name
Hi! Here is a cut down of the problem i'm having:
using System.Xml.Serialization;

namespace test;
class Program
{
private string _xml = @"<Tag Example1=""One"" Example2=""Two"" />";

static void Main(string[] args)
{
var serializer = new XmlSerializer(typeof(Tag));
}
}

public class Tag
{
[XmlAttribute] public TestAttribute1.Example Example1;
[XmlAttribute] public TestAttribute2.Example Example2;
}

public static class TestAttribute1
{
public enum Example
{
One,
Two
}
}

public static class TestAttribute2
{
public enum Example
{
One,
Two
}
}
using System.Xml.Serialization;

namespace test;
class Program
{
private string _xml = @"<Tag Example1=""One"" Example2=""Two"" />";

static void Main(string[] args)
{
var serializer = new XmlSerializer(typeof(Tag));
}
}

public class Tag
{
[XmlAttribute] public TestAttribute1.Example Example1;
[XmlAttribute] public TestAttribute2.Example Example2;
}

public static class TestAttribute1
{
public enum Example
{
One,
Two
}
}

public static class TestAttribute2
{
public enum Example
{
One,
Two
}
}
And this is the error I'm getting:
System.InvalidOperationException: Types 'test.TestAttribute2.Example' and 'test.TestAttribute1.Example' both use the XML type name, 'Example', from namespace ''. Use XML attributes to specify a unique XML name and/or namespace for the type.
System.InvalidOperationException: Types 'test.TestAttribute2.Example' and 'test.TestAttribute1.Example' both use the XML type name, 'Example', from namespace ''. Use XML attributes to specify a unique XML name and/or namespace for the type.
From what I understand, the problem the serializer is having is that it is only able to associate a type by its class name, not the whole name. I'm not quite sure how to approach this, because the nested types may not be under my control. I would have imagined that because its an attribute and not an element, that the conflict shouldn't matter.
20 replies