Beispiel #1
0
        // Initialize our class variables with values from LatestPromotions.exe.config. Returns true if all values
        // successfully read and class variables initialized, false otherwise. ConfigurationErrorsException caught
        // and logged in %LOCALAPPDATA%\AcTools\Logs\LatestPromotions-YYYY-MM-DD.log on initialization failure.
        private static bool initAppConfigData()
        {
            bool ret = true; // assume success

            try
            {
                _fromHoursAgo = AcQuery.getAppConfigSetting <int>("FromHoursAgo");
                _outputFile   = AcQuery.getAppConfigSetting <string>("OutputFile").Trim();

                ADSection adSection = ConfigurationManager.GetSection("activeDir") as ADSection;
                if (adSection == null)
                {
                    AcDebug.Log("Error in Program.initAppConfigData creating ADSection");
                    ret = false;
                }
                else
                {
                    _domains    = adSection.Domains;
                    _properties = adSection.Props;
                }

                DepotsSection depotsConfigSection = ConfigurationManager.GetSection("Depots") as DepotsSection;
                if (depotsConfigSection == null)
                {
                    AcDebug.Log("Error in Program.initAppConfigData creating DepotsSection");
                    ret = false;
                }
                else
                {
                    _selDepots = depotsConfigSection.Depots;
                }

                StreamsSection streamsConfigSection = ConfigurationManager.GetSection("Streams") as StreamsSection;
                if (streamsConfigSection == null)
                {
                    AcDebug.Log("Error in Program.initAppConfigData creating StreamsSection");
                    ret = false;
                }
                else
                {
                    _selStreams = streamsConfigSection.Streams;
                }
            }

            catch (ConfigurationErrorsException exc)
            {
                Process       currentProcess = Process.GetCurrentProcess();
                ProcessModule pm             = currentProcess.MainModule;
                AcDebug.Log($"Invalid data in {pm.ModuleName}.config{Environment.NewLine}{exc.Message}");
                ret = false;
            }

            return(ret);
        }
Beispiel #2
0
        static int Main()
        {
            bool           ret = false; // assume failure
            StreamsSection streamsConfigSection = ConfigurationManager.GetSection("Streams") as StreamsSection;

            if (streamsConfigSection == null)
            {
                Console.WriteLine("Error creating StreamsSection");
            }
            else
            {
                _selStreams = streamsConfigSection.Streams;
                Task <bool> pini = promoRightsAsync();
                ret = pini.Result;
            }

            return((ret) ? 0 : 1);
        }
Beispiel #3
0
 public DataModel(MainWindow mainWindow)
 {
     MainWindow = mainWindow;
     ServerList = new ServerList();
     ServerSession = new ServerSession(this);
     ServerStatus = new ServerStatus(this);
     Database = new Database(this);
     QuickSearch = new QuickSearch(this);
     AdvancedSearch = new AdvancedSearch(this);
     DatabaseView = new DatabaseView(this);
     StreamsCollection = new StreamsCollection();
     SavedPlaylists = new SavedPlaylists(this);
     CurrentSong = new CurrentSong(this);
     Playlist = new Playlist(this);
     OutputCollection = new OutputCollection(this);
     CustomDateNormalizer = new DateNormalizer();
     CustomDateNormalizer.ReadFromSettings();
     YearNormalizer = new DateNormalizer(new string[] {"YYYY"});
 }
Beispiel #4
0
 public DataModel(MainWindow mainWindow)
 {
     MainWindow           = mainWindow;
     NetworkLog           = null;
     ServerList           = new ServerList();
     ServerSession        = new ServerSession(this);
     ServerStatus         = new ServerStatus(this);
     Database             = new Database(this);
     QuickSearch          = new QuickSearch(this);
     AdvancedSearch       = new AdvancedSearch(this);
     DatabaseView         = new DatabaseView(this);
     StreamsCollection    = new StreamsCollection();
     SavedPlaylists       = new SavedPlaylists(this);
     CurrentSong          = new CurrentSong(this);
     Playlist             = new Playlist(this);
     OutputCollection     = new OutputCollection(this);
     CustomDateNormalizer = new DateNormalizer();
     CustomDateNormalizer.ReadFromSettings();
     YearNormalizer = new DateNormalizer(new string[] { "YYYY" });
 }