Beagrep.Daemon.Filter.Open C# (CSharp) Method

Open() public method

public Open ( FileSystemInfo info ) : bool
info System.IO.FileSystemInfo
return bool
        public bool Open(FileSystemInfo info)
        {
            isFinished = false;
            textPool = new ArrayList ();
            hotPool = new ArrayList ();
            text_builder.Length = 0;

            currentInfo = info;

            if (info is FileInfo) {
                // Open a stream for this file.
                currentStream = new FileStream (info.FullName,
                                FileMode.Open,
                                FileAccess.Read,
                                FileShare.Read);

                if (preload) {
                    // Our default assumption is sequential reads.
                    // FIXME: Is this the right thing to do here?
                    FileAdvise.IncreaseReadAhead ((FileStream) currentStream);

                    // Give the OS a hint that we will be reading this
                    // file soon.
                    FileAdvise.PreLoad ((FileStream) currentStream);
                }
            }

            try {
                DoOpen (info);

                if (IsFinished)
                    return true;
                else if (HasError)
                    return false;

                return Open (currentStream, false);
            } catch (Exception e) {
                Log.Warn (e, "Unable to filter {0}:", info.FullName);
                Cleanup (); // clean up temporary files on an exception
                return false;
            }
        }

Same methods

Filter::Open ( Stream stream ) : bool
Filter::Open ( Stream stream, bool store_tempfile ) : bool
Filter::Open ( TextReader reader ) : bool
Filter::Open ( string path ) : bool