string CompileResource (AppResourceFileInfo arfi, bool local)
		{
			string path = arfi.Info.FullName;
			string rname = Path.GetFileNameWithoutExtension (path) + ".resources";
			if (!local)
				rname = "Resources." + rname;
			
			string resource = Path.Combine (TempDirectory, rname);
			FileStream source = null, destination = null;
			IResourceReader reader = null;
			ResourceWriter writer = null;

			try {
				source = new FileStream (path, FileMode.Open, FileAccess.Read);
				destination = new FileStream (resource, FileMode.Create, FileAccess.Write);
				reader = GetReaderForKind (arfi.Kind, source, path);
				writer = new ResourceWriter (destination);
				foreach (DictionaryEntry de in reader) {
					object val = de.Value;
					if (val is string)
						writer.AddResource ((string)de.Key, (string)val);
					else
						writer.AddResource ((string)de.Key, val);
				}
			} catch (Exception ex) {
				throw new HttpException ("Failed to compile resource file", ex);
			} finally {
				if (reader != null)
					reader.Dispose ();
				if (source != null)
					source.Dispose ();
				if (writer != null)
					writer.Dispose ();
				if (destination != null)
					destination.Dispose ();
			}
			
			return resource;
		}
		string GetResourceFile (AppResourceFileInfo arfi, bool local)
		{
			string resfile;
			if (arfi.Kind == AppResourceFileKind.ResX)
				resfile = CompileResource (arfi, local);
			else
				resfile = arfi.Info.FullName;
			if (!String.IsNullOrEmpty (resfile)) {
				string culture = IsFileCultureValid (resfile);
				List <string> cfiles;
				if (culture != null) {
					if (cultureFiles.ContainsKey (culture))
						cfiles = cultureFiles [culture];
					else {
						cfiles = new List <string> (1);
						cultureFiles [culture] = cfiles;
					}
				} else {
					if (defaultCultureFiles == null)
						defaultCultureFiles = new List <string> ();
					cfiles = defaultCultureFiles;
				}
				
				cfiles.Add (resfile);
			}
				
			return resfile;
		}