private void UpdateDataFile()
        {
            string path = currentFile.GetTXTPath();

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            string name = textBox2.Text;

            string[] tags      = richTextBox1.Text.Split(' ');
            string[] writeData = new string[tags.Length + 1];
            writeData[0] = name;
            for (int i = 0; i < tags.Length; i++)
            {
                writeData[i + 1] = tags[i];
            }
            File.WriteAllLines(path, writeData);
            int indexOf = GetIndexOfDataFile(currentFile);

            currentFile.name = name;
            currentFile.tags = tags;
            files[indexOf]   = currentFile;
            try
            {
                currentFileNode.Text = name;
            }
            catch { }
        }
Beispiel #2
0
        public void TestWriteAllLinesWithEncoding()
        {
            var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append("file26.ext").ToString();

            File.WriteAllLines(tempLongPathFilename, new string[] { "file26" }, Encoding.Unicode);
            try
            {
                Assert.AreEqual("file26" + Environment.NewLine, File.ReadAllText(tempLongPathFilename, Encoding.Unicode));
            }
            finally
            {
                File.Delete(tempLongPathFilename);
            }
        }
Beispiel #3
0
 public static void WriteAllLines(string path, IEnumerable <string> contents, Encoding encoding)
 {
     File.WriteAllLines(path, contents, encoding);
 }
Beispiel #4
0
 public static void WriteAllLines(string path, IEnumerable <string> contents)
 {
     File.WriteAllLines(path, contents);
 }
Beispiel #5
0
 public static void WriteAllLines(string path, string[] contents, Encoding encoding)
 {
     File.WriteAllLines(path, contents, encoding);
 }
Beispiel #6
0
 public static void WriteAllLines(string path, string[] contents)
 {
     File.WriteAllLines(path, contents);
 }