public void MimeMap (string line, string mimeType, string extension)
		{
			var map = new Dictionary<string, string> ();
			var stringReader = new StringReader (line);
			var loader = new MimeMapLoader (map);
			loader.LoadMimeMap (stringReader);

			string matchedMimeType = null;
			map.TryGetValue (extension, out matchedMimeType);

			Assert.AreEqual (mimeType, matchedMimeType);
		}
Example #2
0
        Dictionary <string, string> LoadMimeMapAsync()
        {
            var map = new Dictionary <string, string> ();

            // All recent Macs should have this file; if not we'll just die silently
            if (!File.Exists("/etc/apache2/mime.types"))
            {
                LoggingService.LogError("Apache mime database is missing");
                return(map);
            }

            mimeTimer.BeginTiming();
            try {
                var loader = new MimeMapLoader(map);
                loader.LoadMimeMap("/etc/apache2/mime.types");
            } catch (Exception ex) {
                LoggingService.LogError("Could not load Apache mime database", ex);
            }
            mimeTimer.EndTiming();
            return(map);
        }
Example #3
0
		Dictionary<string, string> LoadMimeMapAsync ()
		{
			var map = new Dictionary<string, string> ();
			// All recent Macs should have this file; if not we'll just die silently
			if (!File.Exists ("/etc/apache2/mime.types")) {
				LoggingService.LogError ("Apache mime database is missing");
				return map;
			}

			mimeTimer.BeginTiming ();
			try {
				var loader = new MimeMapLoader (map);
				loader.LoadMimeMap ("/etc/apache2/mime.types");
			} catch (Exception ex){
				LoggingService.LogError ("Could not load Apache mime database", ex);
			}
			mimeTimer.EndTiming ();
			return map;
		}