aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Updater/Program.cs
blob: df41492d8312467e450b6f0d804cb62580615c08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ShiftOS.Updater
{
    class Program
    {
        static void Main(string[] args)
        {
            if (Directory.Exists("updater-work"))
            {
                //Give the engine time to shutdown before invoking this app.
                Thread.Sleep(5000);
                foreach (var f in Directory.GetFiles("updater-work"))
                {
                    var bytes = File.ReadAllBytes(f);
                    var finf = new FileInfo(f);
                    File.WriteAllBytes(finf.Name, bytes); 
                }
                Directory.Delete("updater-work", true);
            }

            //Restart the actual game.
            System.Diagnostics.Process.Start("ShiftOS.WinForms.exe");
        }
    }
}