C# Read/Write Process Memory

So what I want to do here is make a launcher in C# for my game which is made in C++. In my game client I am using definition (e.g #define VERSION 1311) and another definition in the server (e.g #define USER_VERSION 1311). When a client is connected to the server it will send the VERSION number, the server will then check it and compare. If it matches then it's fine and you can login and if not a message pops up that client is outdated. What I want to do is make my game exe to be able to be started only via the launcher, so I took out the VERSION pointer(offset) from my C++ game client like so:

printf("version offset: 0x%p\n", VERSION);

The output pointer(offset) in this case is 0x0000051F.

Here is my C# code:

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;
using System.Text;

namespace DLauncher
{
    public partial class Form1 : Form
    {

        private MemoryEditor mem;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            mem = new MemoryEditor("game.exe");
            int VERSION = mem.ReadInt32(0x0000051F);
            mem.WriteInt32(VERSION, 1337);
            Thread.Sleep(500);
            MessageBox.Show(Convert.ToString(VERSION));
        }

    }

    public class MemoryEditor
    {

        [DllImport("kernel32.dll")]
        static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten);

        [DllImport("Kernel32.dll")]
        static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UInt32 nSize, ref UInt32 lpNumberOfBytesRead);

        [DllImport("kernel32.dll")]
        public static extern IntPtr OpenProcess(
             ProcessAccessFlags processAccess,
             bool bInheritHandle,
             int processId
        );

        [Flags]
        public enum ProcessAccessFlags : uint
        {
            All = 0x001F0FFF,
            Terminate = 0x00000001,
            CreateThread = 0x00000002,
            VirtualMemoryOperation = 0x00000008,
            VirtualMemoryRead = 0x00000010,
            VirtualMemoryWrite = 0x00000020,
            DuplicateHandle = 0x00000040,
            CreateProcess = 0x000000080,
            SetQuota = 0x00000100,
            SetInformation = 0x00000200,
            QueryInformation = 0x00000400,
            QueryLimitedInformation = 0x00001000,
            Synchronize = 0x00100000
        }

        public static IntPtr OpenProcess(Process proc, ProcessAccessFlags flags)
        {
            return OpenProcess(flags, false, proc.Id);
        }

        private readonly IntPtr hand;

        public MemoryEditor(string ProcName)
        {
            hand = IntPtr.Zero;
            string pname = ProcName.Replace(".exe", "");
            Process[] proclist = Process.GetProcesses();
            foreach (Process pr in proclist)
            {

                if (pr.ToString() == "System.Diagnostics.Process (" + pname + ")")
                {
                    hand = OpenProcess(pr,
                        ProcessAccessFlags.VirtualMemoryOperation | ProcessAccessFlags.VirtualMemoryRead |
                        ProcessAccessFlags.VirtualMemoryWrite);
                    break;
                }
            }
        }

        public bool Write(int Address, byte[] data)
        {
            bool success = false;
            Process[] proclist = Process.GetProcesses();
            IntPtr bytesout;
            success = WriteProcessMemory(hand, (IntPtr)Address, data, (UIntPtr)data.Length, out bytesout);
            return success;
        }
        public bool WriteInt32(int Address, int value)
        {
            return Write(Address, BitConverter.GetBytes(value));
        }

        public byte[] Read(int Address, int length)
        {
            byte[] ret = new byte[length];
            uint o = 0;
            ReadProcessMemory(hand, (IntPtr)Address, ret, (UInt32)ret.Length, ref o);
            return ret;
        }
        public int ReadInt32(int Address)
        {
            return BitConverter.ToInt32(Read(Address, 4), 0);
        }
        public float ReadSingle(int Address)
        {
            return BitConverter.ToSingle(Read(Address, 4), 0);
        }
        public string ReadString(int Address, int length, bool isUnicode)
        {
            if (isUnicode)
            {
                UnicodeEncoding enc = new UnicodeEncoding();
                return enc.GetString(Read(Address, length));
            }
            else
            {
                ASCIIEncoding enc = new ASCIIEncoding();
                return enc.GetString(Read(Address, length));
            }
        }
    }
}

So basically the launcher needs to take the VERSION pointer(offset) which is outdated and replace it with "1337" in this case which has to be the correct VERSION set in the server. So the connection will be accepted only if the game exe is started via the launcher, but it doesn't work for some reason.

The output I get from this line of code:

MessageBox.Show(Convert.ToString(VERSION));

Is: 0