Example #1
0
        public void SettingsGetString()
        {
            var s = new Rhovlyn.Engine.IO.Settings();

            if (s.Load("Content/settings.ini") == false)
            {
                throw new IOException("Settings file could not be loaded");
            }

            var result = "";

            if (s.Get("", "root", ref result))
            {
                if (!result.Equals("node"))
                {
                    throw new IOException("Settings could not read the root node's value properly");
                }
            }
            else
            {
                throw new  IOException("Settings could not read the root node");
            }

            if (s.Get("test", "string", ref result))
            {
                if (!result.Equals("A string"))
                {
                    throw new IOException("Settings could not read the test:string node's value properly");
                }
            }
            else
            {
                throw new  IOException("Settings could not read the test:string node");
            }
        }
Example #2
0
        public void SettingsLoad()
        {
            var s = new Rhovlyn.Engine.IO.Settings();

            if (s.Load("Content/settings.ini") == false)
            {
                throw new IOException("Settings file could not be loaded");
            }
        }
Example #3
0
        public void SettingsGetValues()
        {
            var s = new Rhovlyn.Engine.IO.Settings();

            Parser.Init();
            if (s.Load("Content/settings.ini") == false)
            {
                throw new IOException("Settings file could not be loaded");
            }
            var bout = false;

            if (s.Get <bool>("test", "bool", ref bout))
            {
                if (!bout.Equals(true))
                {
                    throw new IOException("Settings could not read the test:bool node's value properly");
                }
            }
            else
            {
                throw new  IOException("Settings could not read the test:bool node");
            }

            int iout = 0;

            if (s.Get <int>("test", "int", ref iout))
            {
                if (!iout.Equals(1))
                {
                    throw new IOException("Settings could not read the test:int node's value properly");
                }
            }
            else
            {
                throw new  IOException("Settings could not read the test:int node");
            }

            if (s.Get <int>("test", "neg", ref iout))
            {
                if (!iout.Equals(-1))
                {
                    throw new IOException("Settings could not read the test:neg node's value properly");
                }
            }
            else
            {
                throw new  IOException("Settings could not read the test:neg node");
            }
        }
Example #4
0
        public void SettingsGetBadValues()
        {
            var s = new Rhovlyn.Engine.IO.Settings();

            if (!s.Load("Content/settings.ini"))
            {
                throw new IOException("Settings file could not be loaded");
            }

            var bout = false;

            if (s.Get <bool>("test", "badbool", ref bout))
            {
                throw new  IOException("Settings failed to report a bad get for test:badbool");
            }

            int iout = 0;

            if (s.Get <int>("test", "badint", ref iout))
            {
                throw new  IOException("Settings failed to report a bad get for test:badint");
            }
        }