Пример #1
0
        static Program()
        {
            SettingsStore.Init(
                new JsonSettingsProvider(TestDataFolder),
                new JsonEDSProvider()
                );

            MetaDataStore.Init(new JSONSnapshotProvider());
        }
Пример #2
0
        /// <summary>
        /// Initialize Maime with Options
        /// </summary>
        /// <param name="options">Options used for reparation</param>
        public static void Init(Options.Options options)
        {
            Logger.Common("Maime initializing");
            _options = options;

            // If debugger attached, then locate folders in solution folder.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                _projectPathFolder = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
                _dataFolder        = Path.GetFullPath(Path.Combine(_projectPathFolder, "..\\", "Data"));
            }
            else // Else locate in same folder as .exe file
            {
                _projectPathFolder = AppDomain.CurrentDomain.BaseDirectory;
                _dataFolder        = Path.GetFullPath(Path.Combine(_projectPathFolder, "Data"));
            }

            Logger.Common($"Settings stored at {_projectPathFolder}");
            Logger.Common($"Data folder location {_dataFolder}");

            // ======== Settings ======== //
            Logger.Common("Loading settings");
            SettingsStore.Init(
                new JsonSettingsProvider(_dataFolder),
                new JsonEDSProvider()
                );
            Logger.Common("Settings loaded");

            // ======== Metadata store ======== //
            Logger.Common("Initializing metadata store");
            MetaDataStore.Init(new JSONSnapshotProvider());
            Logger.Common("Metadata store initialized");

            _application = new Application();

            // ======== Fetch Changes ======== //
            Logger.Common("Fetching latest metadata changes");
            _latestChanges = MetaDataStore.GetLatestChanges(SettingsStore.EDSSettings);

            if (_latestChanges.Count == 0)
            {
                Logger.Error("No database(s) or change(s) found. Please create a snapshot and rerun the program.");
                _databaseMetaChange = null;
                return;
            }

            _databaseMetaChange = _latestChanges.Values.First();
            Logger.Common("Finished fetching metadata changes");

            Logger.Common("Maime initialized");
        }
Пример #3
0
        /// <summary>
        /// Initiate static objects
        /// </summary>
        static Program()
        {
            // If debugger attached, then locate folders in solution folder.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                ProjectPathFolder = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
                TestDataFolder    = Path.GetFullPath(Path.Combine(ProjectPathFolder, "..\\", "Data"));
                TestOutputFolder  = Path.GetFullPath(Path.Combine(ProjectPathFolder, "..\\", "Output"));
            }
            else // Else locate in same folder as .exe file
            {
                ProjectPathFolder = AppDomain.CurrentDomain.BaseDirectory;
                TestDataFolder    = Path.GetFullPath(Path.Combine(ProjectPathFolder, "Data"));
                TestOutputFolder  = Path.GetFullPath(Path.Combine(ProjectPathFolder, "Output"));
            }

            SettingsStore.Init(
                new JsonSettingsProvider(TestDataFolder),
                new JsonEDSProvider()
                );

            MetaDataStore.Init(new JSONSnapshotProvider());
        }