aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Stubs/Examples/WriteToFile.cs
blob: 73d8dde6f4f61e12544560c20f3aa982c87d2b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;

private const string FILE_PATH = "D:\\logFile.txt";

public void OnExecute(StubManager stubManager)
{
    //This will overwrite existing file.
    stubManager.WriteToFile(FILE_PATH, "Writing to file...");

    for (int i = 0; i < 10; i++)
    {
        //This will append the contents to the end of the file.
        stubManager.AppendToFile(FILE_PATH, i.ToString() + " Some text...");
    }

    stubManager.AppendToFile(FILE_PATH, "Done");

    stubManager.WriteLine("Done writing to the file.");
}