コード例 #1
0
 //
 public void Ini()
 {
     cm = new IniComment();
     cv = new IniConvert();
     ResetDefaultOptions();
     OnDebug += new OnDebugMessage(OnDefaultDebugMessage);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: innix/ini-dot-net
        public static void Main(string[] args)
        {
            // TODO: Inject properties through constructor if available.

            string contents = @"
[Generalz]
Key = qwerty
EnableThing = True

[ABC]
EndPoints = 62.252.201.71:4000,127.0.0.1:4001
ConnectAttemptsPerEndPoint = 5
DelayBetweenConnects = 10
";

            Config cfg = IniConvert.DeserializeObject <Config>(contents);

            Debug.Assert(cfg != null);
            Debug.Assert(cfg.General != null);

            Debug.Assert(cfg.General.EnableThing);
            Debug.Assert(cfg.General.Key == "qwerty");

            foreach (IPEndPoint endPoint in cfg.Abc.EndPoints)
            {
                Console.WriteLine(endPoint);
            }

            Console.WriteLine(cfg.Abc.DelayBetweenConnects);
        }