コード例 #1
0
ファイル: Program.cs プロジェクト: jeoffman/JkhSettings
        static void Main(string[] args)
        {
            using(MySettings settings = new MySettings())
            {
                string myValue = settings.GetSetting<string>("MySettingName1", "MySettingValueDefault1");

                settings.PutSetting("MySettingName2", "MySettingValue2");
                settings.PutSetting(MySettings.SomeSettingName, MySettings.SomeSettingDefaultValue);

                string myValue2 = settings.GetSetting<string>("MySettingName2", "MySettingValueDefault2");
                double myValueDouble2 = settings.GetSetting(MySettings.SomeSettingName, MySettings.SomeSettingDefaultValue);

                string secret = "secret password";

                string unencryptedDefault = settings.GetEncryptedSetting(secret, "MyEncryptedSettingName", "MyEncryptedSettingValueDefault");
                settings.PutEncryptedSetting(secret, "MyEncryptedSettingName", "blah blah blah secrets");
                string encryptedText = settings.GetSetting("MyEncryptedSettingName", "MyEncryptedSettingValueDefault");
                string unencryptedText = settings.GetEncryptedSetting(secret, "MyEncryptedSettingName", "MyEncryptedSettingValueDefault");
            }
        }