Ejemplo n.º 1
0
        public static TextFile ReadFile(FilePath fileName)
        {
            TextFile tf = new TextFile();

            tf.Read(fileName);
            return(tf);
        }
Ejemplo n.º 2
0
        public static TextFile ReadFile(FilePath fileName, string encoding)
        {
            TextFile tf = new TextFile();

            tf.Read(fileName, encoding);
            return(tf);
        }
Ejemplo n.º 3
0
        public static TextFile ReadFile(string path, Stream content)
        {
            TextFile tf = new TextFile();

            tf.name = path;
            tf.Read(content, null);
            return(tf);
        }
Ejemplo n.º 4
0
        public void TestRead()
        {
            var    cwd          = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName;
            string tempFilename = Path.Combine(cwd, Path.GetRandomFileName());

            string testText = "hello world!";

            File.WriteAllText(tempFilename, testText);

            var filePath = new MonoDevelop.Core.FilePath(tempFilename);
            var tf       = new Text.TextFile();

            tf.Read(filePath, "UTF8");

            try {
                Assert.AreEqual(tf.Text, testText);
            } finally {
                File.Delete(tempFilename);
            }
        }