/// <summary> /// Handles the opening file event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="GSeries.Filesystem.OpenFileEventArgs"/> instance containing the event data.</param> public override void HandleOpeningFile(IFilesys sender, OpenFileEventArgs args) { UriTemplateMatch match; var succ = TryMatchPath(BasicTemplateString, args.VritualRawPath.PathString, out match); if (succ && args.FileAccess == FileAccess.Read) { Uri reqUri; if (!string.IsNullOrEmpty(match.QueryParameters[OnDemandParamName])) { // It's on-demand read, downloading is postponed to read(). } else { // Otherwise, we download the file now. reqUri = BasicPathMatch2ReqUri(match, null); Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format( "Requesting meta info from Uri {0}", reqUri.ToString())); string xmlString; try { // This can be a while. xmlString = _serverProxy.GetUTF8String(reqUri, System.Threading.Timeout.Infinite); } catch (WebException ex) { Logger.WriteLineIf(LogLevel.Error, _log_props, string.Format( "Exception thrown from server: {0}", ex)); // Handle different types of error accodingly. if (ex is WebException) { if (((HttpWebResponse)((ex as WebException).Response)).StatusCode == HttpStatusCode.NotFound) { // Normal. Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format("Server says requested file/directory doesn't exist.")); return; } else { // Other protocol level errors. throw; } } else { // Non-procotol-level errors. throw; } } } } }
public void HandleOpeningFile(IFilesys sender, OpenFileEventArgs args) { throw new NotImplementedException(); }
void FushareFilesys_OpeningFile(object sender, OpenFileEventArgs e) { GetEventHandler(sender as IFilesys, e).HandleOpeningFile(sender as IFilesys, e); }
public abstract void HandleOpeningFile(IFilesys sender, OpenFileEventArgs args);