Exemple #1
0
        public void Initialize(InstallModel model)
        {
            CurrentRequestData.CurrentSite = _site = _session.Get <Site>(_site.Id);
            SetupTasks();
            var siteSettings = new SiteSettings
            {
                TimeZone            = model.TimeZone,
                UICulture           = model.UiCulture,
                EnableInlineEditing = true,
                SiteIsLive          = true,
                FormRendererType    = FormRenderingType.Bootstrap3,
            };
            var mediaSettings = new MediaSettings
            {
                ThumbnailImageHeight = 50,
                ThumbnailImageWidth  = 50,
                LargeImageHeight     = 800,
                LargeImageWidth      = 800,
                MediumImageHeight    = 500,
                MediumImageWidth     = 500,
                SmallImageHeight     = 200,
                SmallImageWidth      = 200,
                ResizeQuality        = 90,
            };

            var fileSystemSettings = new FileSystemSettings
            {
                StorageType = typeof(FileSystem).FullName
            };

            _configurationProvider.SaveSettings(siteSettings);
            _configurationProvider.SaveSettings(mediaSettings);
            _configurationProvider.SaveSettings(fileSystemSettings);
        }
Exemple #2
0
        public FileSystemMonitoringService(FileSystemSettings settings, ILogger logger)
        {
            this.settings = settings;
            this.logger   = logger;

            this.ValidateSettings(settings);
        }
Exemple #3
0
 public GetLuceneDirectory(FileSystemSettings fileSystemSettings, IAzureFileSystem azureFileSystem,
                           HttpContextBase context)
 {
     _fileSystemSettings = fileSystemSettings;
     _azureFileSystem    = azureFileSystem;
     _context            = context;
 }
Exemple #4
0
 public MigrateFileBatchRunner(ISession session,
                               ISetBatchJobExecutionStatus setBatchJobJobExecutionStatus, IKernel kernel, FileSystemSettings fileSystemSettings)
     : base(setBatchJobJobExecutionStatus)
 {
     _session     = session;
     _fileSystems =
         TypeHelper.GetAllTypesAssignableFrom <IFileSystem>()
         .Select(type => kernel.Get(type) as IFileSystem)
         .ToList();;
     _fileSystemSettings = fileSystemSettings;
 }
Exemple #5
0
        public FileMigrationService(IKernel kernel, FileSystemSettings fileSystemSettings, ISession session,
                                    ICreateBatch createBatch, UrlHelper urlHelper)
        {
            IEnumerable <IFileSystem> fileSystems = TypeHelper.GetAllConcreteTypesAssignableFrom <IFileSystem>()
                                                    .Select(type => kernel.Get(type) as IFileSystem);

            _allFileSystems =
                fileSystems
                .ToDictionary(system => system.GetType().FullName);
            _fileSystemSettings = fileSystemSettings;
            _session            = session;
            _createBatch        = createBatch;
            _kernel             = kernel;
            _urlHelper          = urlHelper;
        }
        public FileSystemStorageProvider(FileSystemSettings settings)
        {
            var mediaPath = CommonHelper.MapPath("~/Media/", false);
            _storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";
            if (HostingEnvironment.IsHosted) {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
                appPath = appPath + '/';
            if (!appPath.StartsWith("/"))
                appPath = '/' + appPath;

            _publicPath = appPath + "Media/" + settings.DirectoryName + "/";
        }
Exemple #7
0
        static void Main(string[] args)
        {
            FileSystemSettings config = (FileSystemSettings)ConfigurationManager.GetSection("fileSystemSettings");

            if (config != null)
            {
                ReadConfig(config);
            }

            _distributor = new FileDistributorService(_rules, new DirectoryInfo(config.Rules.DefaultDirectory));
            var watcherService = new FileSystemWatcherService(_directories);

            watcherService.FileCreatedEvent += OnFileCreated;

            do
            {
                input = Console.ReadKey(true);
            }while (!((input.Modifiers == ConsoleModifiers.Control) && (input.Key == ConsoleKey.D)));
        }
Exemple #8
0
        private static void Serialization()
        {
            var indented     = Formatting.Indented;
            var settingsJson = new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.All,
            };

            settingsJson.ContractResolver = new DefaultContractResolver {
                NamingStrategy = new CamelCaseNamingStrategy()
            };

            var settings = new FileSystemSettings();

            settings.FileSystems.Add(new FileSystemSettings.Definition("local1", new LocalFileSystem("data")));
            settings.FileSystems.Add(new FileSystemSettings.Definition("zip1", new ZipFileSystem("data/Painting-Contract.zip")));
            settings.CurrentFileSystemKey = "local1";
            var s = JsonConvert.SerializeObject(settings, indented, settingsJson);
            var q = s;
        }
Exemple #9
0
        private static void ReadConfig(FileSystemSettings config)
        {
            _directories = new List <DirectoryElement>(config.Directories.Count);
            _rules       = new List <RuleElement>();

            foreach (DirectoryElement directory in config.Directories)
            {
                _directories.Add(directory);
            }

            foreach (RuleElement rule in config.Rules)
            {
                _rules.Add(rule);
            }

            CultureInfo.DefaultThreadCurrentCulture   = config.Culture;
            CultureInfo.DefaultThreadCurrentUICulture = config.Culture;
            CultureInfo.CurrentUICulture = config.Culture;
            CultureInfo.CurrentCulture   = config.Culture;
        }
Exemple #10
0
        public FileSystemStorageProvider(FileSystemSettings settings)
        {
            var mediaPath = CommonHelper.MapPath("~/Media/", false);

            _storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";

            if (HostingEnvironment.IsHosted)
            {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
            {
                appPath = appPath + '/';
            }
            if (!appPath.StartsWith("/"))
            {
                appPath = '/' + appPath;
            }

            _publicPath = appPath + "Media/" + settings.DirectoryName + "/";
        }
Exemple #11
0
        private void ValidateSettings(FileSystemSettings settings)
        {
            try
            {
                if (settings == null)
                {
                    logger.Error(Resource.NoSettings);
                    throw new ArgumentNullException(Resource.NoSettings);
                }

                ValidateFolders(settings.Folders);
            }
            catch (DirectoryNotFoundException exc)
            {
                logger.Error(exc.Message);
                throw;
            }
            catch (ArgumentNullException exc)
            {
                logger.Error(exc.Message);
                throw;
            }
        }
Exemple #12
0
 public AzureFileSystem(FileSystemSettings fileSystemSettings)
 {
     _fileSystemSettings = fileSystemSettings;
 }
Exemple #13
0
 public FileSystemSettingsModelBinder(IKernel kernel, FileSystemSettings fileSystemSettings) : base(kernel)
 {
     _fileSystemSettings = fileSystemSettings;
 }
 public RedirectToRouteResult FileSystem([IoCModelBinder(typeof(FileSystemSettingsModelBinder))] FileSystemSettings settings)
 {
     _configurationProvider.SaveSettings(settings);
     TempData.SuccessMessages().Add("Settings saved.".AsResource(HttpContext));
     return(RedirectToAction("FileSystem"));
 }
 public FileSystemRemoteClient(FileSystemSettings settings)
 {
     _settings = settings;
 }