示例#1
0
文件: Settings.cs 项目: hnefatl/RBS
        // Loads in the settings from the file, returning success/failure
        public static bool Load()
        {
            try
            {
                Inner = new Dictionary <string, object>();

                using (Shared.TextReader In = new Shared.TextReader(File.OpenRead(Path)))
                {
                    while (true)
                    {
                        string Key   = In.ReadString();
                        string Value = In.ReadString();
                        if (Key == null || Value == null)
                        {
                            break;
                        }

                        Inner.Add(Key, Value);
                    }
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }
示例#2
0
        // Loads in the settings from the file
        public static void Load()
        {
            try
            {
                using (Shared.TextReader In = new Shared.TextReader(File.OpenRead(Path)))
                {
                    // Read a key on one line
                    string Key = In.ReadString();

                    // Set the appropriate variable depending on the key
                    if (Key == "DatabasePath")
                        DatabasePath = In.ReadString();
                    else if (Key == "Port")
                        Port = In.ReadInt32();
                }
            }
            catch { }
        }
示例#3
0
        // Loads in the settings from the file
        public static void Load()
        {
            try
            {
                using (Shared.TextReader In = new Shared.TextReader(File.OpenRead(Path)))
                {
                    // Read a key on one line
                    string Key = In.ReadString();

                    // Set the appropriate variable depending on the key
                    if (Key == "DatabasePath")
                    {
                        DatabasePath = In.ReadString();
                    }
                    else if (Key == "Port")
                    {
                        Port = In.ReadInt32();
                    }
                }
            }
            catch { }
        }