private static FileServer SetupFileServer(Options options, DlnaMediaTypes types, DirectoryInfo[] d) { var ids = new Identifiers( ComparerRepository.Lookup(options.Order), options.DescendingOrder); foreach (var v in options.Views) { try { ids.AddView(v); } catch (RepositoryLookupException) { throw new GetOptException("Invalid view " + v); } } var fs = new FileServer(types, ids, d); if (!string.IsNullOrEmpty(options.FriendlyName)) { fs.FriendlyName = options.FriendlyName; } try { if (options.CacheFile != null) { fs.SetCacheFile(options.CacheFile); } fs.Load(); if (!options.Rescanning) { fs.Rescanning = false; } } catch (Exception) { fs.Dispose(); throw; } return fs; }
private static FileServer ConfiguraServidorDeArquivos(Opcoes opcoes, DlnaMediaTypes tipos, DirectoryInfo[] d) { var ids = new Identifiers(ComparerRepository.Lookup(opcoes.Ordem), opcoes.Ascendente); var fs = new FileServer(tipos, ids, d); try { if (opcoes.ArquivoCache != null) { fs.SetCacheFile(opcoes.ArquivoCache); } fs.Load(); } catch (Exception) { fs.Dispose(); throw; } return fs; }