Path is the link of the file:
<pre lang="c#">
private void Add_Click(object sender, EventArgs e)
{
int wins =0;
int score =0;
int plays =0;
player = new Player(nameBox.Text, currentImage,score, wins,plays);
player.Write();
}
And the write method
public void Write ()
{
StreamWriter sw = File.AppendText(@".\Player.csv");
string line = this.Name + "," + this.Paths + "," + this.Score + "," + this.wins + "," + this.level + "," + this.plays;
sw.WriteLine(line);
sw.Close();
}
And Add Player method with currentImage parameter
private void AddPlayer_Load(object sender, EventArgs e)
{
System.IO.DirectoryInfo director = new System.IO.DirectoryInfo(@".\imagini\");
try
{
if ((director.Exists))
{
System.IO.FileInfo file = null;
foreach ( System.IO.FileInfo eachfile in director.GetFiles())
{
file = eachfile;
if (file.Extension == ".jpg")
{
lista.Add(file.FullName);
imageLen++;
}
}
pictBox.Image = Image.FromFile(lista[0].ToString());
currentImage = lista[0].ToString();
i = 0;
}