コード例 #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
ファイル: Settings.cs プロジェクト: hnefatl/Prototype1
        // 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 { }
        }