Skip to content
This repository was archived by the owner on Sep 14, 2024. It is now read-only.

Commit 6496923

Browse files
committed
Make a backup of the queue before saving. Closes #22
1 parent 09b7881 commit 6496923

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Av1ador/Entry.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,13 @@ public static void Update(int col, Video video, ListBox list, ListBox vf, ListBo
264264

265265
private static void Save_entries(ListBox list)
266266
{
267+
string queue = "queue.xml";
268+
string backup = queue.Replace(@"xml", "xml.bak");
269+
if (System.IO.File.Exists(backup))
270+
System.IO.File.Delete(backup);
271+
System.IO.File.Move(queue, backup);
267272
var writer = new System.Xml.Serialization.XmlSerializer(typeof(Entry[]));
268-
var wfile = new StreamWriter(@"queue.xml");
273+
var wfile = new StreamWriter(queue);
269274
Entry[] entries = new Entry[list.Items.Count];
270275
for (int i = 0; i < list.Items.Count; i++)
271276
entries[i] = list.Items[i] as Entry;

0 commit comments

Comments
 (0)