public static void LoadProgress() { FileStream MyStream1 = new FileStream("C:\\Users\\" + Environment.UserName + "\\Desktop\\data1.dat", FileMode.OpenOrCreate); BinaryFormatter MyFormatter = new BinaryFormatter(); if (MyStream1.Length != 0) { int zmienna1 = (int)MyFormatter.Deserialize(MyStream1); int zmienna2 = (int)MyFormatter.Deserialize(MyStream1); bool zmienna3 = (bool)MyFormatter.Deserialize(MyStream1); progress.setProgress(zmienna1); progress.setLevel(zmienna2); SetLearnType(zmienna3); } MyStream1.Close(); FileInfo F1 = new FileInfo("C:\\Users\\" + Environment.UserName + "\\Desktop\\data1.dat"); if (File.Exists("C:\\Users\\" + Environment.UserName + "\\Desktop\\data1.dat")) { F1.Delete(); } }