Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void
예제 #1
0
 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;
 }
예제 #2
0
        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;
        }