using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Windows.Forms;
namespace PDN
{
public class FileIOFuncions
{
static public void sprawdzenie(string _filename)
{
if (File.Exists(_filename) == false)
{
Opcje op = new Opcje();
op.ShowDialog();
};
}
static public void odczyt(string _filename)
{
FileInfo F = new FileInfo(_filename);
StreamReader p = new StreamReader(_filename);
string server = p.ReadLine();
string database = p.ReadLine();
string uid = p.ReadLine();
string password = p.ReadLine();
p.Close();
}
static public void stworz(string _filename)
{
FileStream f1 = new FileStream(_filename,
FileMode.Create, FileAccess.ReadWrite);
Opcje op = new Opcje();
try
{
StreamWriter sw = new StreamWriter(f1);
sw.WriteLine(op.OTB1.Text);
sw.WriteLine(op.OTB2.Text);
sw.WriteLine(op.OTB3.Text);
sw.WriteLine(op.OTB4.Text);
sw.Close();
MessageBox.Show("Utworzono plik konfiguracyjny");
}
catch
{
MessageBox.Show("Błąd przy tworzeniu pliku " + _filename);
}
}
}
}
Proszę o pomoc, gdyż funkcja nie tworzy pliku. nie potrafię znaleźć błędu proszę o szybką pomoc.
Plik jest tworzony, lecz jest pusty ;/