Storing Data on server and using on load c#

0

I am trying to store some data on a server as textfile or even as the class itself and then when the application loads it gets it and I can read and use from it as normal. internally it works just fine, I would like to store the class online so when something is needed to change I can just update the class file and the application will still run without needing to be re-downloaded / updated if you will.

The class is formed like this

 public class Addresses
    {
        public static uint run = 0x00000001;
        public static uint walk = 0x00000002;
        public static uint jump = 0x00000003;
        public static uint sit = 0x00000004;
    }

and when I use one of the options It is called like this

private void checkBox7_CheckedChanged(object sender)
    {
        if (checkBox7.Checked == true)
        {
            game.setmemory(Addresses.run, new byte[] { 0x00, 0x00 });
        }
        else
        {
            game.setmemory(Addresses.run, new byte[] { 0x00, 0x01 });
        }
    }

Again ideally I just want to store the "addresses Class" online either as a text file or even as the class.cs file itself, but if I can save it as a text file and read from it correctly I would prefer to just store it on pastebin. thank you as always for all help and information.

I can not seem to figure out how to save this "AddressesClass.cs" file on a server and use it in my application. I only want that file stored on the server. I right now am using it internally. once I put that file on my server where do I go from there? what do I do to load it into my application? and once it is loaded into the application do just call to it the same as before ?

c#
.net
asked on Stack Overflow Aug 19, 2018 by Noob Coder • edited Aug 20, 2018 by Noob Coder

2 Answers

0

There's really no point in storing something like this on a server but ok:
1. Throw a file at your server that's the value as a byte array
2. Put a = BitConverter.ToUInt32(new WebClient().DownloadBytes("http://yourserver.com/filename")) after the value in your Addresses class
3. goto 1

answered on Stack Overflow Aug 19, 2018 by chrissx • edited Aug 22, 2018 by chrissx
-1

You can load c# code dynamically as described in this thread: execute c# code at runtime from code file But as was mentioned before you must use configuration files for such purpose.

answered on Stack Overflow Aug 20, 2018 by Kirill Osadchuk

User contributions licensed under CC BY-SA 3.0