31 namespace OpenSim.
Tools.Configger
35 public static int Main(
string[] args)
37 ArgvConfigSource argvConfig =
new ArgvConfigSource(args);
39 argvConfig.AddSwitch(
"Startup",
"format",
"f");
40 argvConfig.AddSwitch(
"Startup",
"inifile");
42 IConfig startupConfig = argvConfig.Configs[
"Startup"];
44 string format = startupConfig.GetString(
"format",
"ini");
47 IConfigSource s = loader.LoadConfigSettings(startupConfig);
49 if (format ==
"mysql")
51 foreach (IConfig c
in s.Configs)
53 foreach (
string k
in c.GetKeys())
55 string v = c.GetString(k);
57 if (k.StartsWith(
"Include-"))
59 Console.WriteLine(
"insert ignore into config (section, name, value) values ('{0}', '{1}', '{2}');", c.Name, k, v);
63 else if (format ==
"xml")
65 Console.WriteLine(
"<Nini>");
67 foreach (IConfig c
in s.Configs)
71 foreach (
string k
in c.GetKeys())
73 if (k.StartsWith(
"Include-"))
81 Console.WriteLine(
"<Section Name=\"{0}\">", c.Name);
83 foreach (
string k
in c.GetKeys())
85 string v = c.GetString(k);
87 if (k.StartsWith(
"Include-"))
89 Console.WriteLine(
" <Key Name=\"{0}\" Value=\"{1}\" />", k, v);
92 Console.WriteLine(
"</Section>");
95 Console.WriteLine(
"</Nini>");
97 else if (format ==
"ini")
99 foreach (IConfig c
in s.Configs)
103 foreach (
string k
in c.GetKeys())
105 if (k.StartsWith(
"Include-"))
113 Console.WriteLine(
"[{0}]", c.Name);
115 foreach (
string k
in c.GetKeys())
117 string v = c.GetString(k);
119 if (k.StartsWith(
"Include-"))
121 Console.WriteLine(
"{0} = \"{1}\"", k, v);
130 Console.WriteLine(
"Error: unknown format: {0}",
format);