diff options
author | Sean Dague | 2007-12-14 17:51:18 +0000 |
---|---|---|
committer | Sean Dague | 2007-12-14 17:51:18 +0000 |
commit | 7d53c736f6f41c236dc8b4cb23b9fbdccce80922 (patch) | |
tree | c357bc91451ccf0ae0ebdd43da328059d26e80cd /OpenSim/Tools/Export/OpenSimExport.cs | |
parent | make a change to make it possible to get access to the DefaultConfig (diff) | |
download | opensim-SC-7d53c736f6f41c236dc8b4cb23b9fbdccce80922.zip opensim-SC-7d53c736f6f41c236dc8b4cb23b9fbdccce80922.tar.gz opensim-SC-7d53c736f6f41c236dc8b4cb23b9fbdccce80922.tar.bz2 opensim-SC-7d53c736f6f41c236dc8b4cb23b9fbdccce80922.tar.xz |
start to pull in config for OpenSim export
Diffstat (limited to 'OpenSim/Tools/Export/OpenSimExport.cs')
-rw-r--r-- | OpenSim/Tools/Export/OpenSimExport.cs | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/OpenSim/Tools/Export/OpenSimExport.cs b/OpenSim/Tools/Export/OpenSimExport.cs index e5146a3..cdafbdb 100644 --- a/OpenSim/Tools/Export/OpenSimExport.cs +++ b/OpenSim/Tools/Export/OpenSimExport.cs | |||
@@ -26,18 +26,71 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim; | ||
30 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using Mono.Addins; | ||
35 | using Mono.Addins.Description; | ||
32 | 36 | ||
33 | namespace OpenSim.Tools.Export | 37 | namespace OpenSim.Tools.Export |
34 | { | 38 | { |
35 | public class OpenSimExport | 39 | public class OpenSimExport |
36 | { | 40 | { |
41 | private IniConfigSource config; | ||
42 | |||
43 | public OpenSimExport(IniConfigSource config) | ||
44 | { | ||
45 | this.config = config; | ||
46 | } | ||
47 | |||
37 | public static void Main(string[] args) | 48 | public static void Main(string[] args) |
38 | { | 49 | { |
39 | ArgvConfigSource configSource = new ArgvConfigSource(args); | 50 | OpenSimExport export = new OpenSimExport(InitConfig(args)); |
51 | |||
40 | System.Console.WriteLine("This application does nothing useful yet"); | 52 | System.Console.WriteLine("This application does nothing useful yet"); |
41 | } | 53 | } |
54 | |||
55 | private static IniConfigSource InitConfig(string[] args) | ||
56 | { | ||
57 | System.Console.WriteLine("Good"); | ||
58 | ArgvConfigSource configSource = new ArgvConfigSource(args); | ||
59 | configSource.AddSwitch("Startup", "inifile"); | ||
60 | |||
61 | // AddinManager.Initialize("."); | ||
62 | // AddinManager.Registry.Update(null); | ||
63 | |||
64 | IConfig startupConfig = configSource.Configs["Startup"]; | ||
65 | string iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); | ||
66 | |||
67 | IniConfigSource config = new IniConfigSource(); | ||
68 | //check for .INI file (either default or name passed in command line) | ||
69 | if (File.Exists(iniFilePath)) | ||
70 | { | ||
71 | config.Merge(new IniConfigSource(iniFilePath)); | ||
72 | config.Merge(configSource); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | iniFilePath = Path.Combine(Util.configDir(), iniFilePath); | ||
77 | if (File.Exists(iniFilePath)) | ||
78 | { | ||
79 | config.Merge(new IniConfigSource(iniFilePath)); | ||
80 | config.Merge(configSource); | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | // no default config files, so set default values, and save it | ||
85 | // SetDefaultConfig(); | ||
86 | config.Merge(OpenSim.OpenSimMain.DefaultConfig()); | ||
87 | config.Merge(configSource); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | // ReadConfigSettings(); | ||
92 | |||
93 | return config; | ||
94 | } | ||
42 | } | 95 | } |
43 | } \ No newline at end of file | 96 | } \ No newline at end of file |