Exemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="PlatformManager"/> class.
        /// </summary>
        /// <param name="manager">The ApplicationManager instance for the application.</param>
        private PlatformManager(IApplicationManager manager)
        {
            base.logger = logger;
            Guid guid = logger.EnterMethod();

            ManagerName       = "Platform Manager";
            EventProviderName = GetType().Name;

            RegisterDependency <IApplicationManager>(manager);

            Settings    = new PlatformSettings();
            Directories = new Directories(Settings);

            switch (GetPlatformType())
            {
            case PlatformType.Windows:
                Platform = new Windows.WindowsPlatform();
                break;

            case PlatformType.UNIX:
                Platform = new UNIX.UNIXPlatform();
                break;

            default:
                throw new Exception("Unable to determine platform.  Environment.OSVersion.Platform: " + Environment.OSVersion.Platform.ToString());
            }

            ChangeState(State.Initialized);

            logger.ExitMethod();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Directories"/> class with a blank dictionary.
        /// </summary>
        /// <param name="settings">The application settings.</param>
        public Directories(PlatformSettings settings)
        {
            Settings = settings;

            try
            {
                Root            = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
                Data            = NormalizePath(Path.Combine(Root, Settings.DirectoryData));
                Packages        = NormalizePath(Path.Combine(Root, Settings.DirectoryPackages));
                PackageArchives = NormalizePath(Path.Combine(Root, Settings.DirectoryPackageArchives));
                Plugins         = NormalizePath(Path.Combine(Root, Settings.DirectoryPlugins));
                Temp            = NormalizePath(Path.Combine(Root, Settings.DirectoryTemp));
                Persistence     = NormalizePath(Path.Combine(Root, Settings.DirectoryPersistence));
                Web             = NormalizePath(Path.Combine(Root, Settings.DirectoryWeb));
                Logs            = NormalizePath(Path.Combine(Root, Settings.DirectoryLogs));
            }
            catch (Exception ex)
            {
                throw new DirectoryConfigurationException($"Failed to configure application Directories.  See inner Exception for details.", ex);
            }
        }