コード例 #1
0
        public static ExampleConfig LoadConfig(String assemblyPath, Boolean UseConfigDir)
        {
            ILog   lg = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            string pd = assemblyPath;

            if (UseConfigDir)
            {
                pd = System.IO.Path.Combine(pd, "..", "Config");
            }
            string fn = System.IO.Path.Combine(pd, "Palow.DefaultConfig.xml");

            lg.Debug(String.Format("Using Path:'{0}'", fn));
            ConfigXmlFile cxf = new ConfigXmlFile(fn, true);
            ExampleConfig cfg = cxf.Get <ExampleConfig>();

            return(cfg);
        }
コード例 #2
0
        public static void SaveConfig(String assemblyPath, ExampleConfig cfg, Boolean UseConfigDir)
        {
            ILog   lg = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            string pd = assemblyPath;

            if (UseConfigDir)
            {
                pd = System.IO.Path.Combine(pd, "..", "Config");
                if (!Directory.Exists(pd))
                {
                    Directory.CreateDirectory(pd);
                }
            }
            string fn = System.IO.Path.Combine(pd, "Palow.DefaultConfig.xml");

            lg.Debug(String.Format("Using Path:'{0}'", fn));
            ConfigXmlFile cxf = new ConfigXmlFile(fn, false);

            cxf.Save(cfg);
        }
コード例 #3
0
 public static void SaveConfig(string assemblyPath, ExampleConfig cfg)
 {
     SaveConfig(assemblyPath, cfg, true);
 }