Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the Theme Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <b>host</b> or <b>config</b> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <b>config</b> is not valid or is incorrect.</exception>
        public void Init(IHostV40 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;
            this.wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki;

            if (!LocalProvidersTools.CheckWritePermissions(GetMasterDirectory()))
            {
                throw new InvalidConfigurationException("Cannot write into the public directory - check permissions");
            }

            string pathFolders = GetPath(GetMasterDirectory(), ThemeDirectory);

            if (!Directory.Exists(pathFolders))
            {
                Directory.CreateDirectory(pathFolders);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets up the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void SetUp(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;

            if (!LocalProvidersTools.CheckWritePermissions(GetDataDirectory(host)))
            {
                throw new InvalidConfigurationException("Cannot write into the public directory - check permissions");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets up the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void SetUp(IHostV50 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;
            var dataDIrectory = GetDataDirectory(host);

            if (!Directory.Exists(dataDIrectory))
            {
                throw new Exception(String.Format("Directory '{0}' does not exist", dataDIrectory));
            }

            if (!LocalProvidersTools.CheckWritePermissions(dataDIrectory))
            {
                throw new InvalidConfigurationException("Cannot write into the public directory - check permissions");
            }
        }