nut
nut
CC#
Created by nut on 3/30/2024 in #help
Getting all types that implement a custom attribute
hey, is using Assembly.GetTypes() and iterating them really the best way to get all types that implement a custom attribute? i was thinking i could just have a static enumerable in the attribute class like so:
class ExampleAttribute : System.Attribute
{
private static readonly List<ExampleAttribute> implementingTypes = new();

public ExampleAttribute()
{
implementingTypes.Add(this);
}

public static List<ExampleAttribute> ImplementingTypes => implementingTypes;
}
class ExampleAttribute : System.Attribute
{
private static readonly List<ExampleAttribute> implementingTypes = new();

public ExampleAttribute()
{
implementingTypes.Add(this);
}

public static List<ExampleAttribute> ImplementingTypes => implementingTypes;
}
14 replies
CC#
Created by nut on 1/22/2024 in #help
asp.net ssl certificate?
how can i set up blazor (asp.net 7) to use my ssl certificate? its issued by an authority, paid and all
13 replies
CC#
Created by nut on 11/22/2023 in #help
JoltPhysicsSharp access violation
Hi, I'm trying to use JoltPhysicsSharp in my project, and I started with the HelloWorld.cs example provided, and it works fine, but when I try to call CreateAndAddBody again, it gives me an access violation
11 replies
CC#
Created by nut on 11/21/2023 in #help
object reference not set to instance of object on a static method call
so im trying to use an opengl binding package (Veldrid.OpenGLBinding) but, when i call any of the methods, it says "Object reference not set to an instance of an object". I'm guessing I'm not using it right but it has absolutely zero documentation so I'm lost
66 replies
CC#
Created by nut on 9/6/2023 in #help
❔ generic class in generic method
im trying to have this method:
public void AddPrefab<T, C>(C args) where T : Prefab<C> where C : PrefabArgs
{
T.Create(this, args);
}
public void AddPrefab<T, C>(C args) where T : Prefab<C> where C : PrefabArgs
{
T.Create(this, args);
}
where each thing that inherits Prefab has a PrefabArgs generic type thing, like, a Prefab "player" could be Player<PlayerPrefabArgs>, and you can call this method like
AddPrefab<Player>(new PlayerPrefabArgs());
AddPrefab<Player>(new PlayerPrefabArgs());
but the problem im having is this just isnt working how id like it to, i have to do
AddPrefab<Player, PlayerPrefabArgs>(...);
AddPrefab<Player, PlayerPrefabArgs>(...);
like it doesnt know how to infer the type or something
15 replies
CC#
Created by nut on 7/9/2023 in #help
❔ entry point in dll instead of application
hi, how can i put an entry point that runs from a linked dll instead of the application? id like for my game engine to have an entry point within it, and all the user side has to do is inherit a class
9 replies
CC#
Created by nut on 6/13/2023 in #help
❔ template function cant convert despite constraint
22 replies
CC#
Created by nut on 12/26/2022 in #help
what is this code snippet doing?
ive got this code snippet from a library im trying to update, and i have no idea what its doing:
private MouseButtons m_Set;

public ButtonSet()
{
m_Set = MouseButtons.None;
}

public void Add(MouseButtons element)
{
m_Set |= element;
}

public void Remove(MouseButtons element)
{
m_Set &= ~element;
}

public bool Contains(MouseButtons element)
{
return (m_Set & element) != MouseButtons.None;
}
private MouseButtons m_Set;

public ButtonSet()
{
m_Set = MouseButtons.None;
}

public void Add(MouseButtons element)
{
m_Set |= element;
}

public void Remove(MouseButtons element)
{
m_Set &= ~element;
}

public bool Contains(MouseButtons element)
{
return (m_Set & element) != MouseButtons.None;
}
10 replies
CC#
Created by nut on 12/18/2022 in #help
❔ edit - how do i map the output of EnumerateAudioEndPoints to the wave device numbers?
when i have an endpoint notification callback registered, and try to dispose any sort of waveout or wavein on the callback, the program completely hangs. ive tried to explain the issue in words but nobody has helped me so i isolated the issue into a winforms project with no other code:
8 replies
CC#
Created by nut on 12/16/2022 in #help
Can someone please help me understand this StackOverflow answer?
I'm working with NAudio and am trying to get the full device name of a wavein device, but the device name is cut off at 32 characters. DirectSound lets me get the full name of the OUTPUT devices, but it doesnt even map properly. This stackoverflow post has the answer but im not smart enough to understand it https://stackoverflow.com/questions/1449162/get-the-full-name-of-a-wavein-device
18 replies
CC#
Created by nut on 12/13/2022 in #help
Settings.Default not saving
8 replies
CC#
Created by nut on 12/12/2022 in #help
Select Hotkey Component Winforms
How can i have a sort of "select hotkey" component that lets the user press a key and captures the Keys enum value?
3 replies