Esempio n. 1
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            BasicHttpBinding b = new BasicHttpBinding();

            b.SendTimeout    = new TimeSpan(0, 0, 10);
            b.ReceiveTimeout = new TimeSpan(0, 0, 10);
            EndpointAddress e = new EndpointAddress(@"http://services.romvault.com/RVService.svc");
            RVServiceClient s = new RVServiceClient(b, e);


            if (string.IsNullOrEmpty(Settings.Username) || string.IsNullOrEmpty(Settings.EMail))
            {
                using (FrmRegistration fReg = new FrmRegistration())
                {
                    fReg.ShowDialog();
                }
            }

            try
            {
                if (!Settings.OptOut)
                {
                    s.SendUser(Settings.Username, Settings.EMail, VNow);
                    s.StartUpV2(Version.Major, Version.Minor, Version.Build);
                }

                ReportError.vMajor = Version.Major;
                ReportError.vMinor = Version.Minor;
                ReportError.vBuild = Version.Build;

                bool v = s.UpdateCheck(Version.Major, Version.Minor, Version.Build);

                if (v)
                {
                    string url = s.GetUpdateLink();
                    MessageBox.Show("There is a new release download now from " + url);
                    //System.Diagnostics.Process.Start(url);
                    //s.Close();
                    //return;
                }

                s.Close();
            }
            catch (Exception ex)
            {
            }

            Compress.SevenZip.SevenZ.TestForZstd();

            ReportError.ErrorForm += ShowErrorForm;
            ReportError.Dialog    += ShowDialog;

            Settings.rvSettings = new Settings();

#if !DEBUG
            Application.ThreadException += ReportError.UnhandledExceptionHandler;
#endif

            FrmSplashScreen progress = new FrmSplashScreen();
            progress.ShowDialog();

            progress.Dispose();

            Application.Run(new FrmMain());

            ReportError.Close();
        }
Esempio n. 2
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            BasicHttpBinding b = new BasicHttpBinding();

            b.SendTimeout    = new TimeSpan(0, 0, 10);
            b.ReceiveTimeout = new TimeSpan(0, 0, 10);
            EndpointAddress e = new EndpointAddress(@"http://services.romvault.com/RVService.svc");
            RVServiceClient s = new RVServiceClient(b, e);

            if (string.IsNullOrEmpty(UISettings.Username) || string.IsNullOrEmpty(UISettings.EMail))
            {
                using (FrmRegistration fReg = new FrmRegistration())
                {
                    fReg.ShowDialog();
                }
            }

            Settings.rvSettings = new Settings();
            Settings.rvSettings = Settings.SetDefaults();

            ReportError.Username   = UISettings.Username;
            ReportError.EMail      = UISettings.EMail;
            ReportError.OptOut     = UISettings.OptOut;
            ReportError.ErrorForm += ShowErrorForm;
            ReportError.Dialog    += ShowDialog;

            try
            {
                if (!UISettings.OptOut)
                {
                    s.SendUserAsync(UISettings.Username, UISettings.EMail, VNow).Wait();
                    s.StartUpV2Async(Version.Major, Version.Minor, Version.Build).Wait();
                }

                ReportError.vMajor = Version.Major;
                ReportError.vMinor = Version.Minor;
                ReportError.vBuild = Version.Build;

                var taskUpdateCheck = s.UpdateCheckAsync(Version.Major, Version.Minor, Version.Build);
                taskUpdateCheck.Wait();
                bool v = taskUpdateCheck.Result;

                if (v)
                {
                    Task <string> taskGetUpdateLink = s.GetUpdateLinkAsync();
                    taskGetUpdateLink.Wait();
                    string url = taskGetUpdateLink.Result;
                    MessageBox.Show("There is a new release download now from " + url);
                    //System.Diagnostics.Process.Start(url);
                    //s.Close();
                    //return;
                }

                var taskCheckDVUser = s.CheckDVUserAsync(Settings.rvSettings.DATUpdateKey);
                taskCheckDVUser.Wait();
                string test = taskCheckDVUser.Result;
                if (test.ToLower() != "ok")
                {
                    Settings.rvSettings.DATUpdateKey = null;
                }

                var taskCheckFCUser = s.CheckFCUserAsync(Settings.rvSettings.FCKey);
                taskCheckFCUser.Wait();
                test = taskCheckFCUser.Result;
                if (test.ToLower() != "ok")
                {
                    Settings.rvSettings.FCKey = null;
                }
                else
                {
                    var taskGetFCUsername = s.GetFCUsernameAsync(Settings.rvSettings.FCKey);
                    taskGetFCUsername.Wait();
                    Settings.FCUsername = taskGetFCUsername.Result;
                }
                s.Close();
            }
            catch
            {
                Settings.rvSettings.DATUpdateKey = null;
                Settings.rvSettings.FCKey        = null;
            }

#if !DEBUG
            Application.ThreadException += ReportError.UnhandledExceptionHandler;
#endif

            FrmSplashScreen progress = new FrmSplashScreen();
            progress.ShowDialog();

            progress.Dispose();

            Application.Run(new FrmMain());

            ReportError.Close();
        }