コード例 #1
0
ファイル: InstallationClass.cs プロジェクト: NFS404/MW-Online
 public static void Update()
 {
     if (File.Exists("MWOUpdater.exe"))
     {
         File.Delete("MWOUpdater.exe");
     }
     InstallationClass.DownloadFile("...", "MWOUpdater.exe");
     new Process()
     {
         StartInfo = new ProcessStartInfo()
         {
             FileName = "MWOUpdater.exe"
         }
     }.Start();
 }
コード例 #2
0
        public Form1()
        {
            try
            {
                InstallationClass.CheckUpdate();
            }
            catch { }
            InitializeComponent();
            if (!File.Exists("scripts\\mwonline.ini"))
            {
                StreamWriter writer = new StreamWriter("scripts\\mwonline.ini");
                writer.Write("ip=37.113.97.234;port=5555;nickname=Player");
                writer.Flush();
                writer.Close();
                writer.Dispose();
            }

            try
            {
                StreamReader reader = new StreamReader("scripts\\mwonline.ini");
                string       r      = reader.ReadToEnd();
                reader.Close();
                reader.Dispose();

                serverBox.Text = r.Split(';')[0].Split('=')[1] + ":" + r.Split(';')[1].Split('=')[1];
                nickBox.Text   = r.Split(';')[2].Split('=')[1];
            }
            catch {
                StreamWriter writer = new StreamWriter("scripts\\mwonline.ini");
                writer.Write("ip=37.113.97.234;port=5555;nickname=Player");
                writer.Flush();
                writer.Close();
                writer.Dispose();

                StreamReader reader = new StreamReader("scripts\\mwonline.ini");
                string       r      = reader.ReadToEnd();
                reader.Close();
                reader.Dispose();

                serverBox.Text = r.Split(';')[0].Split('=')[1] + ":" + r.Split(';')[1].Split('=')[1];
                nickBox.Text   = r.Split(';')[1].Split('=')[1];
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: NFS404/MW-Online
        static void Main(string[] args)
        {
            //Debugger.Launch();
            foreach (var p in Process.GetProcesses())
            {
                if (p.ProcessName == "MWOUpdater")
                {
                    p.Kill();
                }
            }
            Args = args;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            foreach (string i in Args)
            {
                if (i.IndexOf("Update") >= 0)
                {
                    InstallationClass.Update();
                    return;
                }
                if (i.IndexOf("Download") >= 0)
                {
                    Application.Run(new Forms.DownForm());
                    return;
                }
            }
#if !DEBUG
            if (!File.Exists("speed.exe"))
            {
                MessageBox.Show("Place this file into NFS MW folder", "MW-Online Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
#endif
            if (!File.Exists("ru\\MW-Online Launcher.resources.dll") || !File.Exists("en\\MW-Online Launcher.resources.dll"))
            {
                if (!Directory.Exists("en"))
                {
                    Directory.CreateDirectory("en");
                }
                if (!Directory.Exists("az"))
                {
                    Directory.CreateDirectory("az");
                }
                if (!Directory.Exists("ru"))
                {
                    Directory.CreateDirectory("ru");
                }


                InstallationClass.DownloadFile("https://github.com/YaNet-Production/mwo_files/raw/master/g/0.1.1.0/local/en.dll", "en\\MW-Online Launcher.resources.dll");
                InstallationClass.DownloadFile("https://github.com/YaNet-Production/mwo_files/raw/master/g/0.1.1.0/local/ru.dll", "ru\\MW-Online Launcher.resources.dll");
                InstallationClass.DownloadFile("https://github.com/YaNet-Production/mwo_files/raw/master/g/0.1.1.0/local/az.dll", "az\\MW-Online Launcher.resources.dll");
            }
            if (!File.Exists("NFSScriptLoader.exe") || !File.Exists("scripts\\MW_Online.dll") || !File.Exists("scripts\\mwonline.ini"))
            {
                InstallationClass.Start();
                Environment.Exit(0);
                return;
            }
            Application.Run(new Form1());
        }
コード例 #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     Properties.Settings.Default.Language = Thread.CurrentThread.CurrentUICulture.ToString();
     Properties.Settings.Default.Save();
     InstallationClass.CloseAndOpen(this, new Forms.FirstRunForm2());
 }