Ejemplo n.º 1
0
        private void Client_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            if (e.Error != null || e.Cancelled)
            {
                ShowAlert("Error downloading files.", "Something went wrong while downloading the game files! " + e.Error?.ToString() ?? "(cancelled)");
                ResetDownloader();
            }
            else
            {
                DownloadClient.Dispose();
                RunOnUiThread(() =>
                {
                    StatusText.Text = "Extracting TSO Files...";
                });
                //try zip extract
                string zipPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online.zip");
                Directory.CreateDirectory(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online/"));
                string extractPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online/");

                var thread = new Thread(() =>
                {
                    try
                    {
                        var decomp         = new ZipManager.Decompress(zipPath, extractPath);
                        decomp.OnContinue += Decomp_OnContinue;
                        decomp.UnZip();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        ShowAlert("Error decompressing files.", "The zip downloaded to the device was invalid. Please try again.");
                        ResetDownloader();
                        return;
                    }
                    RunOnUiThread(() =>
                    {
                        var activity2 = new Intent(this, typeof(FSOActivity));
                        StartActivity(activity2);
                    });
                });
                thread.Start();
            }
        }
Ejemplo n.º 2
0
        private void Client_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            if (e.Error != null || e.Cancelled)
            {
                ShowAlert("Error downloading files.", "Something went wrong while downloading the game files! "+e.Error?.ToString()??"(cancelled)");
                ResetDownloader();
            }
            else
            {
                DownloadClient.Dispose();
                RunOnUiThread(() =>
                {
                    StatusText.Text = "Extracting TSO Files...";
                });
                //try zip extract
                string zipPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online.zip");
                Directory.CreateDirectory(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online/"));
                string extractPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online/");

                var thread = new Thread(() =>
                {
                    try
                    {
                        var decomp = new ZipManager.Decompress(zipPath, extractPath);
                        decomp.OnContinue += Decomp_OnContinue;
                        decomp.UnZip();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        ShowAlert("Error decompressing files.", "The zip downloaded to the device was invalid. Please try again.");
                        ResetDownloader();
                        return;
                    }
                    RunOnUiThread(() =>
                    {
                        var activity2 = new Intent(this, typeof(FSOActivity));
                        StartActivity(activity2);
                    });
                });
                thread.Start();
            }
        }