jeudi 13 octobre 2016

Using my strings in a IF ELSE

I'm a really really noob at coding it's my first program and my first time I touch a coding software.

First let me show you what I have :

private void SaveClose_Click(object sender, RoutedEventArgs e)
{
    using (var fs = new FileStream(@"Resources\arguments.txt", FileMode.Truncate))
    {
    }

    if (Windowed.IsChecked == true)
        windowed = true;
    else
        windowed = false;

    string text = File.ReadAllText(@"Resources\arguments.txt");

    string createTextWindowed = "-screen-fullscreen 0" + Environment.NewLine;
    File.WriteAllText(@"Resources\arguments.txt", createTextWindowed);

    string createTextFullscreen = "-screen-fullscreen 1" + Environment.NewLine;
    File.WriteAllText(@"Resources\arguments.txt", createTextFullscreen);


    if (windowed == true)
        createTextWindowed 
    else
        createTextFullscreen
}

Lines 21 and 23 (createTextWindowed and createTextFullscreen) are errors and I want to fix them but I'm a noob so I don't know how to use the strings I've made, I want to make the program write in the txt file "-screen-fullscreen 0" if windowed = true (I think you got it) and 1 if it's false, I tried this but of course it doesn't work :')

Aucun commentaire:

Enregistrer un commentaire