Fumetsu
Fumetsu
CC#
Created by Fumetsu on 4/28/2025 in #help
✅ Good way to access methods from other classes?
I mean, I found a work around by having the Spark class send the command to the Command class instead of the MainForm, since the Spark class is the one that instantiates all of the classes anyways. Not exactly how I'd prefer it but it works. Sorry for being hard to work it, I'm abit out of my depth and I should definetely go out of my way to learn abit more. Thanks for all of the information you provided though! I'm sure it will prove rather useful
17 replies
CC#
Created by Fumetsu on 4/28/2025 in #help
✅ Good way to access methods from other classes?
Yeah you're probably right
17 replies
CC#
Created by Fumetsu on 4/28/2025 in #help
✅ Good way to access methods from other classes?
Oh, my apologies
17 replies
CC#
Created by Fumetsu on 4/28/2025 in #help
✅ Good way to access methods from other classes?
Sorry if that's too much to read or incomprehensible, I do have a Github if you'd prefer to have a look at that
17 replies
CC#
Created by Fumetsu on 4/28/2025 in #help
✅ Good way to access methods from other classes?
Okay so, every class is under the same namespace, which allows them to use this class that specifies all the instanced classes, so all classes access the same classes without instancing new ones
public class Classes
{
public static MainForm MainForm = new MainForm();
public static Spark Spark = new Spark();
public static Recognition Recognition = new Recognition();
public static Twitch Twitch = new Twitch();
public static Command Command = new Command();
public static OBS OBS = new OBS();
}
public class Classes
{
public static MainForm MainForm = new MainForm();
public static Spark Spark = new Spark();
public static Recognition Recognition = new Recognition();
public static Twitch Twitch = new Twitch();
public static Command Command = new Command();
public static OBS OBS = new OBS();
}
I currently have the MainForm under a different namespace, as for some reason putting it in the same namespace as my other classes breaks my code, idk why exactly maybe I need to look into it sometime. This class is under the MainForm namespace to give the MainForm access to all the classes, but this instances the other classes again. Now don't get me wrong I am way out of my depth here so idrk what I'm talking about, but I believe this means that the classes that the MainForm and other classes access are basically different classes. When my app loads I typically have the Spark class handle everything, which has worked fine, one thing it did is load a bunch of commands from the Command class into a list. If I have any other class run the RunCommand method from my Command class it works perfectly fine (RunCommand only runs code if the provided command is found in the commandList) but when the RunCommand method is accessed from the MainForm, it doesn't work. I used a foreach loop to print the values of the commandList in the Commands class, and if ran from any other class it prints all the commands I added, but if ran from the MainForm it prints nothing, as if no commands were added
17 replies
CC#
Created by Fumetsu on 4/28/2025 in #help
✅ Good way to access methods from other classes?
Maybe I'm misunderstanding, but to access methods/variables from another file I have to instance it, which is typically done by using something like classFile specifiedName = new classFile(); right? This has worked for me until I've needed the MainForm to access a specific method. I have a method in my Command class file that runs a command, if said command is found in a list, which commands are added to when the application starts. Problem is, since MainForm creates a new instance of the class file, I believe that Command list is never built, so the command never runs. I've tried running commands from every other class file and it works, but only from the MainForm does running the command never work, I'll show my code abit more in a sec
17 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
You guys were of much help, thanks to you I managed to get my problem solved! Thanks for helping!
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Ohhhh okay, sorry about that
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Ahh okay thank you. Using that it made progress, I just have to adjust some other stuff now
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Ahhh sorry I'm not well versed in this stuff, how would I go about that?
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Ahhh okay thank you very much. I'll try using STJ and see how it fares
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Ohhh okay, that's great actually because there's more tutorials on the default lol. Thanks for that information
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Is there a good reason not to use Newtonsoft? I heard it was faster than the default JsonSerializer
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Oh the second > is just gone in the message for some reason
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ Newtonsoft.Json JsonSerializationException
Btw here is the the string that clientJson prints [{"Client_ID":"SECRET","Client_Secret":"SECRET","Refresh_Token":"%null%","Access_Token":"%null%"}]
21 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ System.IO.IOException Being Thrown
That's true actually, because clearly I need alot of help lol
39 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ System.IO.IOException Being Thrown
When I get the time I'll make sure to go through my code and make it more user friendly
39 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ System.IO.IOException Being Thrown
Yeah I think I get what you're saying. Currently I have no plans for working with anyone else, but I think it would be better for me to prepare now rather than later
39 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ System.IO.IOException Being Thrown
Ahhh okay yeah that makes sense
39 replies
CC#
Created by Fumetsu on 4/24/2025 in #help
✅ System.IO.IOException Being Thrown
Yeahh I kinda just throw alot of stuff together to see if it works first, then I try and come back later to refine it
39 replies