public override bool Populate()
        {
            string filename = PathAndName;
            this.Title = System.IO.Path.GetFileNameWithoutExtension(PathAndName);

            try
            {
                EPocalipse.IFilter.FilterReader ifil = new EPocalipse.IFilter.FilterReader(filename);
                this.All = ifil.ReadToEnd();
                ifil.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("IFilter population failed. Exception : " + ex.Message, ex);
            }
            if (this.All != string.Empty)
            {
                this.Description = base.GetDescriptionFromWordsOnly(WordsOnly);
                return true;
            }
            else
            {
                return false;
            }
        }
Exemple #2
0
        public override bool GetResponse(System.Net.HttpWebResponse webresponse)
        {
            string filename = System.IO.Path.Combine(Preferences.DownloadedTempFilePath, (System.IO.Path.GetFileName(this.Uri.LocalPath)));

            this.Title = System.IO.Path.GetFileNameWithoutExtension(filename);

            //System.IO.Stream filestream = webresponse.GetResponseStream();
            //this.Uri = webresponse.ResponseUri;

            //using (System.IO.BinaryReader reader = new System.IO.BinaryReader(filestream))
            //{
            //    using (System.IO.FileStream iofilestream = new System.IO.FileStream(filename, System.IO.FileMode.Create))
            //    {
            //        int BUFFER_SIZE = 1024;
            //        byte[] buf = new byte[BUFFER_SIZE];
            //        int n = reader.Read(buf, 0, BUFFER_SIZE);
            //        while (n > 0)
            //        {
            //            iofilestream.Write(buf, 0, n);
            //            n = reader.Read(buf, 0, BUFFER_SIZE);
            //        }

            //        this.Uri = webresponse.ResponseUri;
            //        this.Length = iofilestream.Length;
            //        iofilestream.Close();
            //        iofilestream.Dispose();
            //    }
            //    reader.Close();
            //}
            SaveDownloadedFile(webresponse, filename);
            try
            {
                EPocalipse.IFilter.FilterReader ifil = new EPocalipse.IFilter.FilterReader(filename);
                this.All = ifil.ReadToEnd();
                ifil.Close();
                System.IO.File.Delete(filename);    // clean up
            }
            catch (Exception)
            {
//                ProgressEvent(this, new ProgressEventArgs(2, "IFilter failed on " + this.Uri + " " + e.Message + ""));
            }
            if (this.All != string.Empty)
            {
                this.Description = base.GetDescriptionFromWordsOnly(WordsOnly);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
 /// <summary>
 /// [v7] Move the primary IFilter code into a protected method,
 /// to make extension (ie. subclassing) easier
 /// </summary>
 protected void GetResponseCore(System.Net.HttpWebResponse webresponse, string filename)
 {
     this.Title = System.IO.Path.GetFileNameWithoutExtension(filename);
     SaveDownloadedFile(webresponse, filename);
     try
     {
         EPocalipse.IFilter.FilterReader ifil = new EPocalipse.IFilter.FilterReader(filename);
         this.All = ifil.ReadToEnd();
         ifil.Close();
     }
     catch (Exception argex)
     {
         System.Diagnostics.Debug.WriteLine(argex);
     }
 }
 /// <summary>
 /// [v7] Move the primary IFilter code into a protected method, 
 /// to make extension (ie. subclassing) easier
 /// </summary>
 protected void GetResponseCore(System.Net.HttpWebResponse webresponse, string filename)
 {
     this.Title = System.IO.Path.GetFileNameWithoutExtension(filename);
     SaveDownloadedFile(webresponse, filename);
     try
     {
         EPocalipse.IFilter.FilterReader ifil = new EPocalipse.IFilter.FilterReader(filename);
         this.All = ifil.ReadToEnd();
         ifil.Close();
     }
     catch (Exception argex)
     {
         System.Diagnostics.Debug.WriteLine(argex);
     }
 }