public SplashScreen()
        {
            try
            {
                SingleInstanceMutex = Mutex.OpenExisting("MiSMDRMutex0");
                MessageBox.Show("There is already an instance of MiSMDR running.", "MiSMDR already running", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Process.GetCurrentProcess().Kill();
            }
            catch (Exception ex)
            {
                SingleInstanceMutex = new Mutex(false, "MiSMDRMutex0");

                _firstTime   = true; //Never change this
                _statusCount = 0;

                CheckVersion();

                _forcedDemo  = false; // TURN ON AND OFF DEMO HERE - to force into demo mode every startup
                _popup       = false;
                _trialStatus = false;

                Microsoft.Win32.RegistryKey key;
                key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\MiSMDR");
                string existing_key = (string)key.GetValue("MiSMDRKey");
                key.Close();
                LicenseBreaker    breaker = new LicenseBreaker(existing_key);
                RegisteredDetails details = breaker.BreakKey();

                if ((details.licence_type == "expired-trial") || (details.licence_type == "unregistered") || (details.licence_type == "invalid")) //only show popup for expired trial, invalid or unregistered
                {
                    _popup = true;                                                                                                                //make the registration page popup
                }
                if ((details.licence_type == "trial") || (details.licence_type == "expired-trial"))
                {
                    _trialStatus = true; //make the trial status appear
                }

                if (_forcedDemo)
                {
                    MiConfig.SetDemoMode(_forcedDemo); //always overwrite the config file if this is forced Demo Only
                    _demo = true;
                }
                else
                {
                    _demo = MiConfig.GetDemoMode(); //get the stored demo mode if it is not forced (returns true if there is no config)
                }

                //get the location of the user settings
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
                _configPath = config.FilePath.Remove(config.FilePath.Length - 11); // user.config is 11 characters

                InitializeComponent();
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[]   rijnKey;
            byte[]   rijnIV;
            Encoding byteEncoder = Encoding.UTF8;

            rijnKey = byteEncoder.GetBytes("3b2dyfxd_ob5efyiarcd8fg_ajcde4g1");
            rijnIV  = byteEncoder.GetBytes("z5c6etssdbjdeeg_");
            if (textBox1.Text.Length > 0)
            {
                string encrypted = Encrypter.EncryptIt(textBox1.Text.Trim(), rijnKey, rijnIV);

                RegisteredDetails rgd;
                LicenseBreaker    breaker = new LicenseBreaker(encrypted);
                rgd = breaker.BreakKey();
                MessageBox.Show(rgd.GetMD5());
                string newunencrypted = textBox1.Text.Trim() + "|md5=" + rgd.GetMD5();
                MessageBox.Show(newunencrypted);
                encrypted = Encrypter.EncryptIt(newunencrypted, rijnKey, rijnIV);

                textBox2.Text = encrypted;
            }
            textBox3.Text = Encrypter.DecryptIt(textBox2.Text.Trim(), rijnKey, rijnIV);
        }
Beispiel #3
0
        public Register(bool startup)
        {
            _startup = startup;
            InitializeComponent();

            //when loaded we should check the registry to decide if the text in the screen should change to be the Change License Key page - controlbox show too
            Microsoft.Win32.RegistryKey key;
            key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\MiSMDR");
            string existing_key = (string)key.GetValue("MiSMDRKey");

            key.Close();
            LicenseBreaker breaker = new LicenseBreaker(existing_key);

            details            = breaker.BreakKey();
            tb_name.Text       = details.c_name;
            tb_licencekey.Text = details.key;
            current_key        = details.key;
            if (details.registered == "true")
            {
                if (details.licence_type == "trial")
                {
                    if (startup)
                    {
                        int    diff   = (Convert.ToDateTime(details.orig_expiry) - DateTime.Now).Days + 1;
                        string plural = "";
                        if (diff > 1)
                        {
                            plural = "s";
                        }
                        if (diff <= 30)
                        {
                            SetStatus("This " + details.orig_licence_type + @" license will expire in " + diff + @" day" + plural + ".");
                        }
                        else
                        {
                            SetStatus("This " + details.orig_licence_type + @" license will expire on " + details.expiry);
                        }
                    }
                }
                else
                {
                    //SetStatus("MiSMDR is registered until " + details.expiry);
                    bn_buy.Visible = false;
                }
                bn_register.Text    = "OK";
                bn_register.Enabled = true;
                registerKey         = false;
                this.ControlBox     = true;
                done = true;
            }
            else if (details.registered == "false")
            {
                if (details.licence_type == "expired")
                {
                    //SetStatus("Support for your " + details.orig_licence_type + " license has expired.\n You can continue using MiSMDR but you won't have access newer updates or features.");
                    if (startup)
                    {
                        SetStatus("Support for your " + details.orig_licence_type + " license has expired.\n You can continue using MiSMDR but you won't have access newer updates or features.");
                        done            = false; //only allow closing after timer has ticked down
                        registerKey     = false;
                        bn_exit.Visible = true;
                        //bn_later.Enabled = false;
                        counter = 5;

                        /*int days = (DateTime.Now - Convert.ToDateTime(details.expiry)).Days;
                         * if (days > counter) counter = days;
                         * if (counter > 60) counter = 60;*/
                        SetLater("Later (" + counter.ToString() + ")");
                        laterButtonTimer.Stop();
                        laterButtonTimer.Interval = 1000; // tick every 1 sec
                        laterButtonTimer.Elapsed += new ElapsedEventHandler(laterButtonTimer_Tick);
                        laterButtonTimer.Start();
                        this.ControlBox = true;
                    }
                    else
                    {
                        done = true;
                    }
                }
                else if (details.licence_type == "expired-trial")
                {
                    bn_exit.Visible = true;
                    SetStatus("Your trial license expired on " + details.expiry + ".\n You must purchase a license to continue using MiSMDR.\n Please contact your reseller or visit www.MiSMDR.info");

                    done = false;
                    //bn_later.Enabled = false;
                    bn_register.Enabled = true;
                    registerKey         = true;
                }
                else if (details.licence_type == "invalid")
                {
                    bn_exit.Visible = true;
                    SetStatus(@"Your current MiSMDR license key is in invalid.\par Please enter a new one or contact support at www.MiSMDR.info");

                    done = false;
                    if (!_startup)
                    {
                        bn_later.Enabled = true;
                    }
                    bn_register.Enabled = true;
                    bn_register.Text    = "Register";
                    registerKey         = true;
                }
                else //unregistered
                {
                    bn_exit.Visible = true;
                    SetStatus(@"Your current MiSMDR license key is in invalid.\par Please enter a new one or contact support at www.MiSMDR.info");
                    done = false;
                    bn_register.Enabled = true;
                    bn_register.Text    = "Register";
                    registerKey         = true;
                }
            }
            CheckKey();
        }
Beispiel #4
0
        private void UpdateKey()
        {
            if ((tb_licencekey.Text.Trim() != current_key) && (tb_licencekey.Text.Trim() != String.Empty))
            {
                string orig_key = RemoveAllWhitespace(tb_licencekey.Text);
                tb_licencekey.Text = orig_key;
                bool newkey = false;

                LicenseBreaker breaker = new LicenseBreaker(orig_key);
                details = breaker.BreakKey();

                if (details.registered == "true")
                {
                    lb_registered.Visible = false; //hide until we check the values
                    lb_registered.Text    = "Successfully Registered " + details.licence_type + " version";
                    newkey = true;
                    lb_registered.ForeColor = Color.Black;
                }
                else if (details.registered == "false")
                {
                    if ((details.licence_type == "expired") || (details.licence_type == "expired-trial"))
                    {
                        lb_registered.Text      = "LICENSE EXPIRED on " + details.expiry;
                        lb_registered.ForeColor = Color.Red;
                    }
                    else if (details.licence_type == "invalid")
                    {
                        lb_registered.Text      = "INVALID KEY";
                        lb_registered.ForeColor = Color.Red;
                        newkey = false;
                    }
                    newkey = false;
                }
                else
                {
                    lb_registered.Text      = "INVALID KEY";
                    lb_registered.ForeColor = Color.Red;
                    newkey = false;
                }

                if (newkey)
                {
                    done = true;
                    try
                    {
                        if (details.c_name.Trim() == tb_name.Text.Trim())
                        {
                            Microsoft.Win32.RegistryKey key;
                            key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\MiSMDR");
                            key.SetValue("MiSMDRKey", orig_key);
                            key.Close();

                            if (details.registered == "true")
                            {
                                //SetStatus("MiSMDR is registered until " + details.expiry);
                                lb_registered.Visible = true; //now that we have validated the licence we can display the success message
                                //bn_later.Enabled = false;
                                bn_buy.Enabled   = true;
                                bn_register.Text = "OK";
                                registerKey      = false;
                                this.ControlBox  = true;
                                if (details.licence_type == "trial")
                                {
                                    //SetStatus("Your trial license will expire in " + (Convert.ToDateTime(details.expiry) - DateTime.Now).Days.ToString() + " days unless you register.");
                                }
                                else
                                {
                                    bn_buy.Visible = false;
                                }
                            }
                            else if (details.registered == "false")
                            {
                                //SetStatus("This "+details.licence_type+" license key expired on " + details.expiry);
                            }
                            lb_registered.Visible = true;
                        }
                        else
                        {
                            if (_startup)
                            {
                                done = false;
                            }
                            MessageBox.Show("The owner field does not match license key. Please check your registration details.", "License Key Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    catch (Exception ex)
                    {
                        done = true; //allow user to get out
                        MessageBox.Show("Registration Failed. Unable to access the registry. Please contact [email protected]", "Registry Problem", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                lb_registered.Text = "You must enter a new key";
            }
        }