当前位置: 首页>>代码示例>>C#>>正文


C# IServerApplicationPaths类代码示例

本文整理汇总了C#中IServerApplicationPaths的典型用法代码示例。如果您正苦于以下问题:C# IServerApplicationPaths类的具体用法?C# IServerApplicationPaths怎么用?C# IServerApplicationPaths使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IServerApplicationPaths类属于命名空间,在下文中一共展示了IServerApplicationPaths类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SqliteUserRepository

        public SqliteUserRepository(ILogManager logManager, IServerApplicationPaths appPaths, IJsonSerializer jsonSerializer, IDbConnector dbConnector, IMemoryStreamProvider memoryStreamProvider) : base(logManager, dbConnector)
        {
            _jsonSerializer = jsonSerializer;
            _memoryStreamProvider = memoryStreamProvider;

            DbFilePath = Path.Combine(appPaths.DataPath, "users.db");
        }
开发者ID:t-andre,项目名称:Emby,代码行数:7,代码来源:SqliteUserRepository.cs

示例2: BifService

 public BifService(IServerApplicationPaths appPaths, ILibraryManager libraryManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem)
 {
     _appPaths = appPaths;
     _libraryManager = libraryManager;
     _mediaEncoder = mediaEncoder;
     _fileSystem = fileSystem;
 }
开发者ID:bigjohn322,项目名称:MediaBrowser,代码行数:7,代码来源:BifService.cs

示例3: AddMediaPath

        /// <summary>
        /// Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="virtualFolderName">Name of the virtual folder.</param>
        /// <param name="path">The path.</param>
        /// <param name="user">The user.</param>
        /// <param name="appPaths">The app paths.</param>
        /// <exception cref="System.ArgumentException">The path is not valid.</exception>
        /// <exception cref="System.IO.DirectoryNotFoundException">The path does not exist.</exception>
        public static void AddMediaPath(IFileSystem fileSystem, string virtualFolderName, string path, User user, IServerApplicationPaths appPaths)
        {
            if (!Directory.Exists(path))
            {
                throw new DirectoryNotFoundException("The path does not exist.");
            }

            // Strip off trailing slash, but not on drives
            path = path.TrimEnd(Path.DirectorySeparatorChar);
            if (path.EndsWith(":", StringComparison.OrdinalIgnoreCase))
            {
                path += Path.DirectorySeparatorChar;
            }

            var rootFolderPath = user != null ? user.RootFolderPath : appPaths.DefaultUserViewsPath;
            var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);

            ValidateNewMediaPath(fileSystem, rootFolderPath, path, appPaths);

            var shortcutFilename = Path.GetFileNameWithoutExtension(path);

            var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);

            while (File.Exists(lnk))
            {
                shortcutFilename += "1";
                lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
            }

            fileSystem.CreateShortcut(lnk, path);
        }
开发者ID:RomanDengin,项目名称:MediaBrowser,代码行数:41,代码来源:LibraryHelpers.cs

示例4: ImageProcessor

        public ImageProcessor(ILogger logger, IServerApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer)
        {
            _logger = logger;
            _fileSystem = fileSystem;
            _jsonSerializer = jsonSerializer;
            _appPaths = appPaths;

            _saveImageSizeTimer = new Timer(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite);

            Dictionary<Guid, ImageSize> sizeDictionary;

            try
            {
                sizeDictionary = jsonSerializer.DeserializeFromFile<Dictionary<Guid, ImageSize>>(ImageSizeFile) ?? 
                    new Dictionary<Guid, ImageSize>();
            }
            catch (FileNotFoundException)
            {
                // No biggie
                sizeDictionary = new Dictionary<Guid, ImageSize>();
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error parsing image size cache file", ex);

                sizeDictionary = new Dictionary<Guid, ImageSize>();
            }

            _cachedImagedSizes = new ConcurrentDictionary<Guid, ImageSize>(sizeDictionary);
        }
开发者ID:Tensre,项目名称:MediaBrowser,代码行数:30,代码来源:ImageProcessor.cs

示例5: RenameVirtualFolder

        /// <summary>
        /// Renames the virtual folder.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="newName">The new name.</param>
        /// <param name="user">The user.</param>
        /// <param name="appPaths">The app paths.</param>
        /// <exception cref="System.IO.DirectoryNotFoundException">The media collection does not exist</exception>
        /// <exception cref="System.ArgumentException">There is already a media collection with the name  + newPath + .</exception>
        public static void RenameVirtualFolder(string name, string newName, User user, IServerApplicationPaths appPaths)
        {
            var rootFolderPath = user != null ? user.RootFolderPath : appPaths.DefaultUserViewsPath;

            var currentPath = Path.Combine(rootFolderPath, name);
            var newPath = Path.Combine(rootFolderPath, newName);

            if (!Directory.Exists(currentPath))
            {
                throw new DirectoryNotFoundException("The media collection does not exist");
            }

            if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath))
            {
                throw new ArgumentException("There is already a media collection with the name " + newPath + ".");
            }
            //Only make a two-phase move when changing capitalization
            if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase))
            {
                //Create an unique name
                var temporaryName = Guid.NewGuid().ToString();
                var temporaryPath = Path.Combine(rootFolderPath, temporaryName);
                Directory.Move(currentPath,temporaryPath);
                currentPath = temporaryPath;
            }

            Directory.Move(currentPath, newPath);
        }
开发者ID:0sm0,项目名称:MediaBrowser,代码行数:37,代码来源:LibraryHelpers.cs

示例6: ApiEntryPoint

        /// <summary>
        /// Initializes a new instance of the <see cref="ApiEntryPoint" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="appPaths">The application paths.</param>
        public ApiEntryPoint(ILogger logger, IServerApplicationPaths appPaths)
        {
            Logger = logger;
            AppPaths = appPaths;

            Instance = this;
        }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:12,代码来源:ApiEntryPoint.cs

示例7: AddMediaPath

        /// <summary>
        /// Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="virtualFolderName">Name of the virtual folder.</param>
        /// <param name="path">The path.</param>
        /// <param name="appPaths">The app paths.</param>
        public static void AddMediaPath(IFileSystem fileSystem, string virtualFolderName, string path, IServerApplicationPaths appPaths)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

			if (!fileSystem.DirectoryExists(path))
            {
                throw new DirectoryNotFoundException("The path does not exist.");
            }

            var rootFolderPath = appPaths.DefaultUserViewsPath;
            var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);

            var shortcutFilename = fileSystem.GetFileNameWithoutExtension(path);

            var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);

			while (fileSystem.FileExists(lnk))
            {
                shortcutFilename += "1";
                lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
            }

            fileSystem.CreateShortcut(lnk, path);
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:34,代码来源:LibraryHelpers.cs

示例8: AppThemeManager

 public AppThemeManager(IServerApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer json, ILogger logger)
 {
     _appPaths = appPaths;
     _fileSystem = fileSystem;
     _json = json;
     _logger = logger;
 }
开发者ID:bigjohn322,项目名称:MediaBrowser,代码行数:7,代码来源:AppThemeManager.cs

示例9: BaseStreamingService

 /// <summary>
 /// Initializes a new instance of the <see cref="BaseStreamingService" /> class.
 /// </summary>
 /// <param name="appPaths">The app paths.</param>
 /// <param name="userManager">The user manager.</param>
 /// <param name="libraryManager">The library manager.</param>
 /// <param name="isoManager">The iso manager.</param>
 /// <param name="mediaEncoder">The media encoder.</param>
 protected BaseStreamingService(IServerApplicationPaths appPaths, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder)
 {
     ApplicationPaths = appPaths;
     UserManager = userManager;
     LibraryManager = libraryManager;
     IsoManager = isoManager;
     MediaEncoder = mediaEncoder;
 }
开发者ID:0sm0,项目名称:MediaBrowser,代码行数:16,代码来源:BaseStreamingService.cs

示例10: ImageCleanupTask

 /// <summary>
 /// Initializes a new instance of the <see cref="ImageCleanupTask" /> class.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="libraryManager">The library manager.</param>
 /// <param name="appPaths">The app paths.</param>
 public ImageCleanupTask(Kernel kernel, ILogger logger, ILibraryManager libraryManager, IServerApplicationPaths appPaths, IItemRepository itemRepo)
 {
     _kernel = kernel;
     _logger = logger;
     _libraryManager = libraryManager;
     _appPaths = appPaths;
     _itemRepo = itemRepo;
 }
开发者ID:snap608,项目名称:MediaBrowser,代码行数:15,代码来源:ImageCleanupTask.cs

示例11: ApiEntryPoint

        /// <summary>
        /// Initializes a new instance of the <see cref="ApiEntryPoint" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="appPaths">The application paths.</param>
        /// <param name="sessionManager">The session manager.</param>
        public ApiEntryPoint(ILogger logger, IServerApplicationPaths appPaths, ISessionManager sessionManager)
        {
            Logger = logger;
            _appPaths = appPaths;
            _sessionManager = sessionManager;

            Instance = this;
        }
开发者ID:jmarsh0507,项目名称:MediaBrowser,代码行数:14,代码来源:ApiEntryPoint.cs

示例12: LiveTvManager

 public LiveTvManager(IServerApplicationPaths appPaths, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor)
 {
     _appPaths = appPaths;
     _fileSystem = fileSystem;
     _logger = logger;
     _itemRepo = itemRepo;
     _imageProcessor = imageProcessor;
 }
开发者ID:kreeturez,项目名称:MediaBrowser,代码行数:8,代码来源:LiveTvManager.cs

示例13: LocalizedStrings

        /// <summary>
        /// Initializes a new instance of the <see cref="LocalizedStrings" /> class.
        /// </summary>
        public LocalizedStrings(IServerApplicationPaths appPaths)
        {
            _appPaths = appPaths;

            foreach (var stringObject in StringFiles)
            {
                AddStringData(LoadFromFile(GetFileName(stringObject),stringObject.GetType()));
            }
        }
开发者ID:bigjohn322,项目名称:MediaBrowser,代码行数:12,代码来源:LocalizedStrings.cs

示例14: ImageManager

        /// <summary>
        /// Initializes a new instance of the <see cref="ImageManager" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="appPaths">The app paths.</param>
        /// <param name="itemRepo">The item repo.</param>
        public ImageManager(ILogger logger, IServerApplicationPaths appPaths, IItemRepository itemRepo)
        {
            _logger = logger;
            _itemRepo = itemRepo;

            ImageSizeCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "image-sizes"));
            ResizedImageCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "resized-images"));
            CroppedImageCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "cropped-images"));
            EnhancedImageCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "enhanced-images"));
        }
开发者ID:JasoonJ,项目名称:MediaBrowser,代码行数:16,代码来源:ImageManager.cs

示例15: ImageProcessor

        public ImageProcessor(ILogger logger, IServerApplicationPaths appPaths)
        {
            _logger = logger;
            _appPaths = appPaths;

            _imageSizeCachePath = Path.Combine(_appPaths.ImageCachePath, "image-sizes");
            _croppedWhitespaceImageCachePath = Path.Combine(_appPaths.ImageCachePath, "cropped-images");
            _enhancedImageCachePath = Path.Combine(_appPaths.ImageCachePath, "enhanced-images");
            _resizedImageCachePath = Path.Combine(_appPaths.ImageCachePath, "resized-images");
        }
开发者ID:Kampari,项目名称:MediaBrowser,代码行数:10,代码来源:ImageProcessor.cs


注:本文中的IServerApplicationPaths类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。