Exemplo n.º 1
0
        public static string[] ShowCfgLines(Config cfg, bool fullAssembly, bool flush)
        {
            string[] x = new string[4096];
            int ix = 0;
            x[ix++] = "";

            string[] v = cfg.ShowVersionLines(fullAssembly);
            for (int i = 0; i < v.Length; i++)
                x[ix++] = v[i];
            if (flush)
            {
                cfg.RetainChanges();
            }

            string[] a = new string[0];
            string[] b = new string[0];
            bool richcontent = (cfg.acq.IncludeConfig || cfg.cmd.Showcfg);
            Configuration config =
              ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            if (config.HasFile)
            {
                x[ix++] = ("Config source: " + config.FilePath);
                if (richcontent)
                {
                    a = cfg.ShowAppCfgLines();
                    for (int i = 0; i < a.Length; i++)
                        x[ix++] = a[i];
                }
            }
            //else
            {
                if (richcontent)
                {
                    x[ix++] = "";
                    x[ix++] = ("Config values from database, command line overrides and system defaults");
                    b = ShowDefCfgLines(cfg);
                    for (int i = 0; i < b.Length; i++)
                        x[ix++] = b[i];
                }
            }

            x[ix++] = "";
            Array.Resize(ref x, ix);
            return x;
        }
Exemplo n.º 2
0
        public static string[] ShowCfgLines(Config cfg, bool fullAssembly, bool flush)
        {
            string[] x = new string[4096];
            int ix = 0;
            x[ix++] = "";

            string[] a = cfg.ShowVersionLines(fullAssembly);
            for (int i = 0; i < a.Length; i++)
                x[ix++] = a[i];
            if (flush)
            {
                cfg.RetainChanges();
            }

            a = new string[0];
            bool richcontent = (cfg.acq.IncludeConfig || cfg.cmd.Showcfg);
            System.Configuration.Configuration config =
              ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            if (config.HasFile)
            {
                x[ix++] = ("Config source: " + config.FilePath);
                if (richcontent)
                    a = cfg.ShowAppCfgLines();
            }
            else
            {
                x[ix++] = ("Config source from internal default values");
                if (richcontent)
                    a = ShowDefCfgLines(cfg);
            }
            if (richcontent)
                for (int i = 0; i < a.Length; i++)
                    x[ix++] = a[i];

            x[ix++] = "";
            Array.Resize(ref x, ix);
            return x;
        }