Esempio n. 1
0
        private void WriteWithFilters()
        {
            StreamReader       FileReader    = null;
            StreamWriter       Writer        = null;
            StringReader       Reader        = null;
            PhysicalTextReader ChainedReader = null;

            try
            {
                FileReader = this.File.OpenText();
                Reader     = new StringReader(FileReader.ReadToEnd());
                FileReader.Close();
                FileReader    = null;
                Writer        = this.File.CreateText();
                ChainedReader = new PhysicalTextReader(Reader);
                Filter FilterReader = this.Filter.GetBaseFilter(ChainedReader);
                while (!false)
                {
                    int Focus = FilterReader.Read();
                    if (!(Focus > -1))
                    {
                        break; // TODO: might not be correct. Was : Exit Do
                    }
                    Writer.Write((Char)Focus);
                }
            }
            finally
            {
                if (FileReader != null)
                {
                    FileReader.Close();
                }
                if (Writer != null)
                {
                    Writer.Close();
                }
                if (ChainedReader != null)
                {
                    ChainedReader.Close();
                }
                if (Reader != null)
                {
                    Reader.Close();
                }
            }
        }
Esempio n. 2
0
        private void WriteWithFilters()
        {
            TextWriter         Writer        = null;
            StringReader       Reader        = null;
            PhysicalTextReader ChainedReader = null;

            try
            {
                Writer        = this.GetWriter();
                Reader        = new StringReader(this.Text.Value);
                ChainedReader = new PhysicalTextReader(Reader);
                Filter FilterReader = this.Filter.GetBaseFilter(ChainedReader);
                while (!false)
                {
                    int Focus = FilterReader.Read();
                    if (!(Focus > -1))
                    {
                        break; // TODO: might not be correct. Was : Exit Do
                    }
                    Writer.Write((Char)Focus);
                }
                this.Properties[this.OutProperty] = Writer.ToString();
            }
            finally
            {
                if (Writer != null)
                {
                    Writer.Close();
                }
                if (ChainedReader != null)
                {
                    ChainedReader.Close();
                }
                if (Reader != null)
                {
                    Reader.Close();
                }
            }
        }