Hold Java style properties as key-value pairs and allow them to be loaded from or saved to a ".properties" file. The file is stored with character set ISO-8859-1 which extends US-ASCII (the characters 0-127 are the same) and forms the first part of the Unicode character set. Within the application string are Unicode - but all values outside the basic US-ASCII set are escaped.
상속: System.Collections.Hashtable
예제 #1
0
        public void TestUrls()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + UrlsTestFile);

                fileStream = new FileStream(UrlsTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual(properties.Count, 3);

                Assert.AreEqual(properties["http://www.kajabity.com"], "my lovely web site.");
                Assert.AreEqual(properties["my-blog"], "http://www.kajabity.com");
                Assert.AreEqual(properties["my-blog-2"], "{my-blog}");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #2
0
        public void TestLineBreaks()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + LineBreaksTestFile);

                fileStream = new FileStream(LineBreaksTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual(properties.Count, 5);
                Assert.AreEqual(properties["key\nwith\nnewlines"], "value");
                Assert.AreEqual(properties["key-no-newlines"], "Value\nwith\nnewlines.");

                Assert.AreEqual(properties["fruits"], "apple, banana, pear, cantaloupe, watermelon, kiwi, mango");
                Assert.AreEqual(properties["fruits2"], "apple, banana, pear, cantaloupe, watermelon, ");
                Assert.AreEqual(properties["kiwi,"], "mango");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #3
0
        public void TestLineBreakInUnicodeSequence()
        {
            FileStream fileStream = null;

            try
            {
                // Read the test properties file.
                Console.WriteLine("Loading " + LineBreakWithUnicodeFile);
                fileStream = new FileStream(LineBreakWithUnicodeFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);

                Assert.AreEqual(properties["AAAP"], "B");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #4
0
        public void TestUtf8WithBom()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + Utf8WithBomFile);

                fileStream = new FileStream(Utf8WithBomFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();

                properties.Load(fileStream, Encoding.UTF8);

                Assert.AreEqual(
                    "key",
                    properties.Keys.Single());
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
        public void TestBlankFile()
        {
            FileStream fileStream = null;
            try
            {
                Console.WriteLine("Loading " + BlankTestFile);

                fileStream = new FileStream(BlankTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.IsEmpty(properties);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
        public void TestDuplicates()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + DuplicateTestFile);

                fileStream = new FileStream(DuplicateTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual(properties.Count, 1);
                Assert.IsTrue("c".Equals(properties.GetProperty("a")));
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
        public void TestLineBreaks()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + LineBreaksTestFile);

                fileStream = new FileStream(LineBreaksTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                //Assert.Equals( properties.Count, 3 );
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #8
0
        public void TestComments()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + CommentsTestFile);

                fileStream = new FileStream(CommentsTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual(properties.Count, 3);
                Assert.AreEqual(properties["name"], "value");
                Assert.AreEqual(properties["key\nwith\nnewlines"], "value");
                Assert.AreEqual(properties["key-no-newlines"], "Value\nwith\nnewlines.");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
        public void TestEmptyFile()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + EmptyTestFile);

                fileStream = new FileStream(EmptyTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.IsEmpty(properties);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #10
0
 public ExternalToolProperties(string filePath)
 {
     using (var fileStream = new FileStream(filePath, FileMode.Open))
     {
         _properties = new JavaProperties(PropertiesConstants.DEFAULTS);
         _properties.Load(fileStream);
     }
 }
예제 #11
0
        public void JavaPropertyWriter_shouldWriteTimestampIfTrue()
        {
            JavaProperties properties = new JavaProperties();

            using (var stream = new MemoryStream())
            {
                properties.Store(stream, true);

                string actual = Encoding.GetEncoding("iso-8859-1").GetString(stream.ToArray());
                Assert.That(actual, Does.StartWith("#"));
            }
        }
예제 #12
0
        public void JavaPropertyWriter_shouldNotWriteTimestampIfFalse()
        {
            JavaProperties properties = new JavaProperties();

            using (var stream = new MemoryStream())
            {
                properties.Store(stream, false);

                string actual = Encoding.GetEncoding("iso-8859-1").GetString(stream.ToArray());
                Assert.IsEmpty(actual);
            }
        }
예제 #13
0
        public void JavaPropertyWriter_shouldWriteComment()
        {
            String         comment    = "a comment";
            JavaProperties properties = new JavaProperties();

            using (var stream = new MemoryStream())
            {
                properties.Store(stream, comment);

                string actual = Encoding.GetEncoding("iso-8859-1").GetString(stream.ToArray());
                Assert.That(actual, Does.Contain(comment));
            }
        }
예제 #14
0
        public void JavaPropertyWriter_shouldEscapeExtendedCharsInValue()
        {
            JavaProperties properties = new JavaProperties();

            properties.Add("Greeting", "Привет");

            using (var stream = new MemoryStream())
            {
                properties.Store(stream, null);

                string actual = Encoding.GetEncoding("iso-8859-1").GetString(stream.ToArray());
                Assert.That(actual, Does.Contain("Greeting=\\u041F\\u0440\\u0438\\u0432\\u0435\\u0442"));
            }
        }
예제 #15
0
        public void JavaPropertyWriter_shouldEscapeEqualsInKey()
        {
            JavaProperties properties = new JavaProperties();

            properties.Add("=first", "anything");
            properties.Add("sec=ond", "nothing");
            properties.Add("third=", "something");

            using (var stream = new MemoryStream())
            {
                properties.Store(stream, null);

                string actual = Encoding.GetEncoding("iso-8859-1").GetString(stream.ToArray());
                Assert.That(actual, Does.Contain("\\=first=anything"));
                Assert.That(actual, Does.Contain("sec\\=ond=nothing"));
                Assert.That(actual, Does.Contain("third\\==something"));
            }
        }
예제 #16
0
        public void JavaPropertyWriter_shouldEscapeColonInValue()
        {
            JavaProperties properties = new JavaProperties();

            properties.Add("first", ":anything");
            properties.Add("second", "noth:ing");
            properties.Add("third", "something:");

            using (var stream = new MemoryStream())
            {
                properties.Store(stream, null);

                string actual = Encoding.GetEncoding("iso-8859-1").GetString(stream.ToArray());
                Assert.That(actual, Does.Contain("first=\\:anything"));
                Assert.That(actual, Does.Contain("second=noth\\:ing"));
                Assert.That(actual, Does.Contain("third=something\\:"));
            }
        }
예제 #17
0
        public void TestSeparators()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + SeparatorsTestFile);

                fileStream = new FileStream(SeparatorsTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual(properties.Count, 8);

                Assert.AreEqual(properties["a"], "b");
                Assert.AreEqual(properties["c"], "d");

                Assert.AreEqual(properties["e"], "f");
                Assert.AreEqual(properties["gh"], "ij klm");

                Assert.AreEqual(properties["Truth1"], "Beauty 1");
                Assert.AreEqual(properties["Truth3"], "Beauty 3");
                Assert.AreEqual(properties["Truth2"], "Beauty 2");

                Assert.AreEqual(properties["cheeses"], "");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #18
0
        public void TestSpecialCharacters()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + SpecialCharactersTestFile);

                fileStream = new FileStream(SpecialCharactersTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual(properties.Count, 7);
                Assert.AreEqual(properties["key with spaces"], "value with spaces");

                Assert.AreEqual(properties["anotherKey"], "unicode \\u0041='A'");
                Assert.AreEqual(properties["\u0000\u001FUnicode-Key"], "\u0000\t\n\u001F\u4567Unicode Value");

                Assert.AreEqual(properties["# key-not-comment"], " value begins with\tspace.");

                Assert.AreEqual(properties["One"], "Two = Three Four");
                Assert.AreEqual(properties["Five Six"], "Seven Eight");
                Assert.AreEqual(properties["Nine"], "Ten ");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #19
0
        public void TestMissingProperty()
        {
            FileStream fileStream = null;

            try
            {
                Console.WriteLine("Loading " + EmptyTestFile);

                var defaults = new Dictionary <string, string>
                {
                    { "test", "value" }
                };

                fileStream = new FileStream(EmptyTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties(defaults);
                properties.Load(fileStream);
                fileStream.Close();

                Assert.IsEmpty(properties);
                Assert.IsNull(properties.GetProperty("NonExistent"));
                Assert.AreEqual(defaults["test"], properties.GetProperty("test"));

                Assert.IsNull(properties.SetProperty("NonExistant", "a new value"));
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
예제 #20
0
        private void initProps()
        {
            Hashtable hash = new Hashtable();
            hash.Add("Directory", "c:/temp");
            hash.Add("BaseFileName", "logFile");
               // hash.Add("LogFileName", "logFile");
            hash.Add("LogFile", "logFile");
            hash.Add("FileSize", 1000);
            hash.Add("MaxSize", 1000);
            hash.Add("MaxFiles", 100);
            hash.Add("NumFiles", 0);
            hash.Add("LastRollover", DateTime.Now);
            //private HashSet<String> loggerClasses = new HashSet<String>();
            //private HashSet<String> loggerEnabled = new HashSet<String>();
            hash.Add("LEVEL", Logger.LEVEL.INFO.ToString());
            hash.Add("ROLLOVER", Logger.ROLLOVER.TIME.ToString());
            hash.Add("FileCount", 0);
            hash.Add("lastTime", DateTime.Today);
            hash.Add("DateFormat", "{0:s}");
            hash.Add("ErrorFormat", "DATE : {0} - Level : {1} - Message: {2}");
            props = new JavaProperties(hash);

            Update();
        }
        public void TestComments()
        {
            FileStream fileStream = null;
            try
            {
                Console.WriteLine("Loading " + CommentsTestFile);

                fileStream = new FileStream(CommentsTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                //Assert.Equals( properties.Count, 3 );
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
        public void TestDuplicates()
        {
            FileStream fileStream = null;
            try
            {
                Console.WriteLine("Loading " + DuplicateTestFile);

                fileStream = new FileStream(DuplicateTestFile, FileMode.Open);
                JavaProperties properties = new JavaProperties();
                properties.Load(fileStream);
                fileStream.Close();

                Assert.AreEqual( properties.Count, 1 );
                Assert.IsTrue( "c".Equals(properties.GetProperty("a") ) );
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
        public void TestJavaPropertyWriter()
        {
            string filename = JavaTestDataDirectory + "/mixed.properties";
            string outName  = JavaOutputDirectory + "/test-writer.properties";

            FileStream inStream  = null;
            FileStream outStream = null;

            try
            {
                //  Read the mixed properties file.
                Console.WriteLine("Loading " + filename);
                inStream = File.OpenRead(filename);

                JavaProperties properties1 = new JavaProperties();
                properties1.Load(inStream);
                inStream.Close();
                inStream = null;

                // Write it to a new file - using the JavaPropertiesWriter we are testing.
                outStream = File.OpenWrite(outName);
                properties1.Store(outStream, "Testing JavaPropertyWriter");
                outStream.Flush();
                outStream.Close();
                outStream = null;

                //  Now re-read the output file into a second set of properties
                inStream = File.OpenRead(outName);

                JavaProperties properties2 = new JavaProperties();
                properties2.Load(inStream);

                // Now compare the values - find, compare and remove each value in turn.
                foreach (String name in properties2.Keys)
                {
                    String value2 = properties2.GetProperty(name);

                    if (properties1.ContainsKey(name))
                    {
                        String value1 = properties1.GetProperty(name);

                        if (value1 == null)
                        {
                            if (value2 != null)
                            {
                                Assert.Fail("Original value is null, new value is : \"" + value2 + "\"");
                            }
                        }
                        else if (!value1.Equals(value2))
                        {
                            Assert.Fail("Original value is \"" + value1 + "\", new value is : \"" + value2 + "\"");
                        }

                        properties1.Remove(name);
                    }
                    else
                    {
                        Assert.Fail("Missing property: \"" + name + "\" (with value \"" + value2 + "\")");
                    }
                }

                if (properties1.Count > 0)
                {
                    Assert.Fail(properties1.Count + " values missing from output file.");
                }
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (inStream != null)
                {
                    inStream.Close();
                }

                if (outStream != null)
                {
                    outStream.Close();
                }
            }
        }
예제 #24
0
 public ExternalToolProperties(FileStream fileStream)
 {
     _properties = new JavaProperties(PropertiesConstants.DEFAULTS);
     _properties.Load(fileStream);
 }
        public void TestUtf8NonAsciiSymbols()
        {
            FileStream utf8FileStream = null;
            FileStream isoFileStream  = null;

            try
            {
                Console.WriteLine("Loading " + NonAciiSymbolsUtf8TestFile);

                // A file containing non-ASCII characters, which is saved using the utf8 encoding
                utf8FileStream = new FileStream(NonAciiSymbolsUtf8TestFile, FileMode.Open);

                Console.WriteLine("Loading " + NonAsciiSymbolsNativeToAsciiTestFile);

                // A file with the same data as above, but processed with the native2ascii tool from jdk 1.8, and stored in ISO-8859-1. This will work correctly.
                isoFileStream = new FileStream(NonAsciiSymbolsNativeToAsciiTestFile, FileMode.Open);

                // Java properties read from the utf8 file with correct encoding provided
                JavaProperties utf8PropertiesCorrect = new JavaProperties();

                // we explicitly specify the encoding, so that UTF8 characters are read using the UTF8 encoding and the data will be correct
                utf8PropertiesCorrect.Load(utf8FileStream, Encoding.UTF8);

                JavaProperties utf8PropertiesIncorrect = new JavaProperties();
                utf8FileStream.Seek(0, SeekOrigin.Begin);// reset the stream position from the previous loading.
                // we do not set the encoding, so the data will not appear correctly - UTF8 characters will be read usign the default ISO-8859-1 encoding
                // this is to ensure that setting the encoding makes a difference
                utf8PropertiesIncorrect.Load(utf8FileStream);


                JavaProperties isoProperties = new JavaProperties();
                isoProperties.Load(isoFileStream);

                foreach (var key in utf8PropertiesCorrect.Keys)
                {
                    // Asert the correct file is identical to its native2ascii version
                    Assert.AreEqual(utf8PropertiesCorrect[key], isoProperties[key]);

                    if (key.Equals("AsciiText"))
                    {
                        // Assert that not-using the proper encoding will not corrupt pure ASCII data
                        Assert.AreEqual(utf8PropertiesCorrect[key], utf8PropertiesIncorrect[key]);
                        Assert.AreEqual(utf8PropertiesCorrect[key], isoProperties[key]);
                    }
                    else
                    {
                        // Assert that not-using the proper encoding will corrupt data
                        Assert.AreNotEqual(utf8PropertiesIncorrect[key], utf8PropertiesCorrect[key]);
                        Assert.AreNotEqual(utf8PropertiesIncorrect[key], isoProperties[key]);
                    }
                }
                isoFileStream.Close();

                //Assert.IsEmpty(properties);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (utf8FileStream != null)
                {
                    utf8FileStream.Close();
                }
                if (isoFileStream != null)
                {
                    isoFileStream.Close();
                }
            }
        }
        public void TestJavaPropertyWriter()
        {
            const string filename = JavaTestDataDirectory + "mixed.properties";
            const string outName = JavaOutputDirectory + "test-writer.properties";

            FileStream inStream = null;
            FileStream outStream = null;
            try
            {
                //  Read the mixed properties file.
                Console.WriteLine("Loading " + filename);
                inStream = File.OpenRead(filename);

                JavaProperties properties1 = new JavaProperties();
                properties1.Load( inStream );
                inStream.Close();
                inStream = null;

                // Write it to a new file - using the JavaPropertiesWriter we are testing.
                outStream = File.OpenWrite(outName);
                properties1.Store(outStream, "Testing JavaPropertyWriter");
                outStream.Flush();
                outStream.Close();
                outStream = null;

                //  Now re-read the output file into a second set of properties
                inStream = File.OpenRead(outName);

                JavaProperties properties2 = new JavaProperties();
                properties2.Load(inStream);

                // Now compare the values - find, compare and remove each value in turn.
                foreach (String name in properties2.Keys)
                {
                    String value2 = properties2.GetProperty(name);

                    if (properties1.ContainsKey(name))
                    {
                        String value1 = properties1.GetProperty(name);

                        if (value1 == null)
                        {
                            if (value2 != null)
                            {
                                Assert.Fail("Original value is null, new value is : \"" + value2 + "\"");
                            }
                        }
                        else if (!value1.Equals(value2))
                        {
                            Assert.Fail("Original value is \"" + value1 + "\", new value is : \"" + value2 + "\"");
                        }

                        properties1.Remove( name );
                    }
                    else
                    {
                        Assert.Fail("Missing property: \"" + name + "\" (with value \"" + value2 + "\")");
                    }
                }

                if( properties1.Count > 0 )
                {
                    Assert.Fail( properties1.Count + " values missing from output file.");
                }
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (inStream != null)
                {
                    inStream.Close();
                }

                if (outStream != null)
                {
                    outStream.Close();
                }
            }
        }
        public void TestUtf8NonAsciiSymbols()
        {
            FileStream utf8FileStream = null;
            FileStream isoFileStream = null;
            try
            {
                Console.WriteLine("Loading " + NonAciiSymbolsUtf8TestFile);

                // A file containing non-ASCII characters, which is saved using the utf8 encoding
                utf8FileStream = new FileStream(NonAciiSymbolsUtf8TestFile, FileMode.Open);

                Console.WriteLine("Loading " + NonAsciiSymbolsNativeToAsciiTestFile);

                // A file with the same data as above, but processed with the native2ascii tool from jdk 1.8, and stored in ISO-8859-1. This will work correctly.
                isoFileStream = new FileStream(NonAsciiSymbolsNativeToAsciiTestFile, FileMode.Open);

                // Java properties read from the utf8 file with correct encoding provided
                JavaProperties utf8PropertiesCorrect = new JavaProperties();

                // we explicitly specify the encoding, so that UTF8 characters are read using the UTF8 encoding and the data will be correct
                utf8PropertiesCorrect.Load(utf8FileStream, Encoding.UTF8);

                JavaProperties utf8PropertiesIncorrect = new JavaProperties();
                utf8FileStream.Seek(0, SeekOrigin.Begin);// reset the stream position from the previous loading.
                // we do not set the encoding, so the data will not appear correctly - UTF8 characters will be read usign the default ISO-8859-1 encoding
                // this is to ensure that setting the encoding makes a difference
                utf8PropertiesIncorrect.Load(utf8FileStream);

                JavaProperties isoProperties = new JavaProperties();
                isoProperties.Load(isoFileStream);

                foreach (var key in utf8PropertiesCorrect.Keys)
                {
                    // Asert the correct file is identical to its native2ascii version
                    Assert.AreEqual(utf8PropertiesCorrect[key], isoProperties[key]);

                    if (key.Equals("AsciiText"))
                    {
                        // Assert that not-using the proper encoding will not corrupt pure ASCII data
                        Assert.AreEqual(utf8PropertiesCorrect[key], utf8PropertiesIncorrect[key]);
                        Assert.AreEqual(utf8PropertiesCorrect[key], isoProperties[key]);
                    }
                    else
                    {
                        // Assert that not-using the proper encoding will corrupt data
                        Assert.AreNotEqual(utf8PropertiesIncorrect[key], utf8PropertiesCorrect[key]);
                        Assert.AreNotEqual(utf8PropertiesIncorrect[key], isoProperties[key]);
                    }

                }
                isoFileStream.Close();

                //Assert.IsEmpty(properties);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
            finally
            {
                if (utf8FileStream != null)
                {
                    utf8FileStream.Close();
                }
                if (isoFileStream != null)
                {
                    isoFileStream.Close();
                }
            }
        }