static int Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: configfile <filename>"); return(-1); } try { InitializeLogging(); // load configuration file ConfigFile cfgFile = new ConfigFile(); String cfgFilename = args[0]; cfgFile.Load(cfgFilename); // retrieve config objects from the Config file Config c1 = cfgFile.LookupConfig("config1"); Config c2 = cfgFile.LookupConfig("config2"); // Display log of XML representation of Config objects Log.Info("Config 1:\n" + c1.ToXML()); Log.Info("Config 2:\n" + c2.ToXML()); // lookup subscription topic from configuration file, including excluded topics try { SubscriptionEntry subEntry = cfgFile.LookupSubscriptionEntry("events"); Log.Info("Subscription pattern: " + subEntry.GetPattern()); while (subEntry.HasNextExcludedPattern()) { Log.Info("Subscription excluded pattern: " + subEntry.NextExcludedPattern()); } } catch (GmsecException e) { Log.Error("Failed to acquire 'events' subscription entry; reason: " + e.ToString()); } // lookup a Message from the configuration file Message message = cfgFile.LookupMessage("msg1"); // Display XML representation of the message Log.Info("Message:\n" + message.ToXML()); // Obtain ConfigFile Iterator to examine all of the various // entries defined in the ConfigFile ConfigFileIterator iter = cfgFile.GetIterator(); // Acquire and display all Config entries while (iter.HasNextConfig()) { ConfigEntry entry = iter.NextConfig(); Log.Info("\nConfig Name: " + entry.GetName() + "\nConfig :\n" + entry.GetConfig().ToXML()); } // Acquire and display all Message entries while (iter.HasNextMessage()) { MessageEntry entry = iter.NextMessage(); Log.Info("\nMessage Name: " + entry.GetName() + "\nMessage :\n" + entry.GetMessage().ToXML()); } // Acquire and display all Message entries while (iter.HasNextSubscription()) { SubscriptionEntry entry = iter.NextSubscription(); Log.Info("\nSubscription Name : " + entry.GetName() + "\nSubscription Topic: " + entry.GetPattern()); while (entry.HasNextExcludedPattern()) { Log.Info("\nExcluded Pattern: " + entry.NextExcludedPattern()); } } while (iter.HasNextCustomElement()) { String element = iter.NextCustomElement(); Log.Info("\nCustom XML Element:\n" + element); } } catch (GmsecException e) { Log.Error(e.ToString()); return(-1); } return(0); }