using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace ChangeEnvironment
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = Path.GetFullPath("..\\..\\Libraries\\RENA\\Sound\\fmod");
            StringBuilder temPath = new StringBuilder();
            Process regProcess = new Process();
            //regProcess.StartInfo.FileName = "reg";
            regProcess.StartInfo.FileName = "wmic";

            Console.WriteLine(path);

            try
            {
                //Environment.SetEnvironmentVariable("FMODSDK", path);
                //regProcess.StartInfo.Arguments = String.Format(@"add ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"" /v FMODSDK /d ""{0}"" /f", path);
                regProcess.StartInfo.Arguments = String.Format(@"environment where ""name='FMODSDK' and username='<system>'"" set variablevalue=""{0}""", path);
                regProcess.Start();
                regProcess.WaitForExit();
                Console.WriteLine(String.Format(@"Add ""{0}""", path));
                temPath.AppendLine(path);
                //---------------------------------------------------------------------------------
                path = Path.GetFullPath("..\\..\\Libraries\\bullet");

                //Environment.SetEnvironmentVariable("RW_PATH_INC_BULLET", path);
                //regProcess.StartInfo.Arguments = String.Format(@"add ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"" /v RW_PATH_INC_BULLET /d ""{0}"" /f", path);
                regProcess.StartInfo.Arguments = String.Format(@"environment where ""name='RW_PATH_INC_BULLET' and username='<system>'"" set variablevalue=""{0}""", path);
                regProcess.Start();
                regProcess.WaitForExit();
                temPath.AppendLine(path);
                //---------------------------------------------------------------------------------
                path = Path.GetFullPath("..\\..\\Libraries\\curl-7.16.0\\include");

                //Environment.SetEnvironmentVariable("RW_PATH_INC_CURL", path);
                //regProcess.StartInfo.Arguments = String.Format(@"add ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"" /v RW_PATH_INC_CURL /d ""{0}"" /f", path);
                regProcess.StartInfo.Arguments = String.Format(@"environment where ""name='RW_PATH_INC_CURL' and username='<system>'"" set variablevalue=""{0}""", path);
                regProcess.Start();
                regProcess.WaitForExit();
                temPath.AppendLine(path);
                //---------------------------------------------------------------------------------
                path = Path.GetFullPath("..\\..\\Libraries\\luabind");

                //Environment.SetEnvironmentVariable("RW_PATH_INC_LUABIND", path);
                //regProcess.StartInfo.Arguments = String.Format(@"add ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"" /v RW_PATH_INC_LUABIND /d ""{0}"" /f", path);
                regProcess.StartInfo.Arguments = String.Format(@"environment where ""name='RW_PATH_INC_LUABIND' and username='<system>'"" set variablevalue=""{0}""", path);
                regProcess.Start();
                regProcess.WaitForExit();
                temPath.AppendLine(path);
                //---------------------------------------------------------------------------------
                path = Path.GetFullPath("..\\..\\Libraries\\lua\\src");

                //Environment.SetEnvironmentVariable("RW_PATH_INC_LUA", path);
                //regProcess.StartInfo.Arguments = String.Format(@"add ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"" /v RW_PATH_INC_LUA /d ""{0}"" /f", path);
                regProcess.StartInfo.Arguments = String.Format(@"environment where ""name='RW_PATH_INC_LUA' and username='<system>'"" set variablevalue=""{0}""", path);
                regProcess.Start();
                regProcess.WaitForExit();
                temPath.AppendLine(path);
                //---------------------------------------------------------------------------------
                path = Path.GetFullPath("..\\..\\Libraries\\RENA");

                //Environment.SetEnvironmentVariable("RW_PATH_INC_RENA", path);
                //regProcess.StartInfo.Arguments = String.Format(@"add ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"" /v RW_PATH_INC_RENA /d ""{0}"" /f", path);
                regProcess.StartInfo.Arguments = String.Format(@"environment where ""name='RW_PATH_INC_RENA' and username='<system>'"" set variablevalue=""{0}""", path);
                regProcess.Start();
                regProcess.WaitForExit();
                temPath.AppendLine(path);
                //MessageBox.Show(temPath.ToString());
            }
            catch (System.Exception ex)
            {
                //MessageBox.Show(ex.Message);
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
        }
    }
}
