Beispiel #1
0
        public ActivationForm()
        {
            InitializeComponent();
            int status;

            // status = LexActivator.SetProductFile ("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
            status = LexActivator.SetProductData("PASTE_CONTENT_OF_PRODUCT.DAT_FILE");
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                this.statusLabel.Text = "Error setting product file: " + status.ToString();
                return;
            }
            status = LexActivator.SetProductId("PASTE_PRODUCT_ID", LexActivator.PermissionFlags.LA_USER);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                this.statusLabel.Text = "Error setting product id: " + status.ToString();
                return;
            }
            // Setting license callback is recommended for floating licenses
            // status = LexActivator.SetLicenseCallback(LicenseCallback);
            // if (status != LexActivator.StatusCodes.LA_OK)
            // {
            // this.statusLabel.Text = "Error setting callback function: " + status.ToString();
            // return;
            // }
            status = LexActivator.IsLicenseGenuine();
            if (status == LexActivator.StatusCodes.LA_OK || status == LexActivator.StatusCodes.LA_EXPIRED || status == LexActivator.StatusCodes.LA_SUSPENDED || status == LexActivator.StatusCodes.LA_GRACE_PERIOD_OVER)
            {
                // uint expiryDate = 0;
                // LexActivator.GetLicenseExpiryDate(ref expiryDate);
                // int daysLeft = (int)(expiryDate - unixTimestamp()) / 86500;
                this.statusLabel.Text         = "License genuinely activated! Activation Status: " + status.ToString();
                this.activateBtn.Text         = "Deactivate";
                this.activateTrialBtn.Enabled = false;
                return;
            }
            status = LexActivator.IsTrialGenuine();
            if (status == LexActivator.StatusCodes.LA_OK)
            {
                uint trialExpiryDate = 0;
                LexActivator.GetTrialExpiryDate(ref trialExpiryDate);
                int daysLeft = (int)(trialExpiryDate - unixTimestamp()) / 86500;
                this.statusLabel.Text         = "Trial period! Days left:" + daysLeft.ToString();
                this.activateTrialBtn.Enabled = false;
            }
            else if (status == LexActivator.StatusCodes.LA_TRIAL_EXPIRED)
            {
                this.statusLabel.Text = "Trial has expired!";
            }
            else
            {
                this.statusLabel.Text = "Trial has not started or has been tampered: " + status.ToString();
            }
        }
Beispiel #2
0
        public ActivationForm()
        {
            InitializeComponent();
            try
            {
                // LexActivator.SetProductFile ("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
                LexActivator.SetProductData("PASTE_CONTENT_OF_PRODUCT.DAT_FILE");
                LexActivator.SetProductId("PASTE_PRODUCT_ID", LexActivator.PermissionFlags.LA_USER);
                // LexActivator.SetLicenseCallback(LicenseCallback);

                int status = LexActivator.IsLicenseGenuine();
                if (status == LexStatusCodes.LA_OK || status == LexStatusCodes.LA_EXPIRED || status == LexStatusCodes.LA_SUSPENDED || status == LexStatusCodes.LA_GRACE_PERIOD_OVER)
                {
                    uint expiryDate = LexActivator.GetLicenseExpiryDate();
                    int  daysLeft   = (int)(expiryDate - unixTimestamp()) / 86400;
                    this.statusLabel.Text         = "License genuinely activated! Activation Status: " + status.ToString();
                    this.activateBtn.Text         = "Deactivate";
                    this.activateTrialBtn.Enabled = false;

                    // Checking for software release update
                    // LexActivator.CheckForReleaseUpdate("windows", "1.0.0", "stable", SoftwareReleaseUpdateCallback);
                    return;
                }
                status = LexActivator.IsTrialGenuine();
                if (status == LexStatusCodes.LA_OK)
                {
                    uint trialExpiryDate = LexActivator.GetTrialExpiryDate();
                    int  daysLeft        = (int)(trialExpiryDate - unixTimestamp()) / 86400;
                    this.statusLabel.Text         = "Trial period! Days left:" + daysLeft.ToString();
                    this.activateTrialBtn.Enabled = false;
                }
                else if (status == LexStatusCodes.LA_TRIAL_EXPIRED)
                {
                    this.statusLabel.Text = "Trial has expired!";
                }
                else
                {
                    this.statusLabel.Text = "Trial has not started or has been tampered: " + status.ToString();
                }
            }
            catch (LexActivatorException ex)
            {
                this.statusLabel.Text = "Error code: " + ex.Code.ToString() + " Error message: " + ex.Message;
            }
        }
        private bool CheckTrialLicense()
        {
            var isTrialGenuine = LexActivator.IsTrialGenuine();

            if (isTrialGenuine == LexActivator.StatusCodes.LA_OK)
            {
                Status = LicenseHelperStatusEnum.HaveTrialLicense;

                //var timeToExpire = expireDate.Subtract(DateTime.Now);
                GetTrialLicenseInfo();
                return(true);
            }
            else if (isTrialGenuine == LexActivator.StatusCodes.LA_TRIAL_EXPIRED)
            {
                Status = LicenseHelperStatusEnum.TrialLicenseExpired;
                return(false);
            }
            else if (isTrialGenuine == LexActivator.StatusCodes.LA_FAIL)
            {
                Status = LicenseHelperStatusEnum.DontHaveLicense;
                return(false);
            }
            else if (isTrialGenuine == LexActivator.StatusCodes.LA_E_TIME)
            {
                Status = LicenseHelperStatusEnum.ComputerClockError;
                return(false);
            }
            else if (isTrialGenuine == LexActivator.StatusCodes.LA_E_TIME_MODIFIED)
            {
                Status = LicenseHelperStatusEnum.ComputerClockCracked;
                return(false);
            }
            else if (isTrialGenuine == LexActivator.StatusCodes.LA_E_PRODUCT_ID)
            {
                Status = LicenseHelperStatusEnum.WrongProductId;
                return(false);
            }
            else
            {
                Status = LicenseHelperStatusEnum.DontHaveLicense;
                return(false);
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            try
            {
                Init();
                LexActivator.SetLicenseCallback(LicenseCallback);
                int status = LexActivator.IsLicenseGenuine();
                if (LexStatusCodes.LA_OK == status)
                {
                    Console.WriteLine("License is genuinely activated!");
                    uint expiryDate = LexActivator.GetLicenseExpiryDate();
                    int  daysLeft   = (int)(expiryDate - DateTimeOffset.Now.ToUnixTimeSeconds()) / 86400;
                    Console.WriteLine("Days left:" + daysLeft);

                    // Checking for software release update
                    // LexActivator.CheckForReleaseUpdate("windows", "1.0.0", "stable", SoftwareReleaseUpdateCallback);
                }
                else if (LexStatusCodes.LA_EXPIRED == status)
                {
                    Console.WriteLine("License is genuinely activated but has expired!");
                }
                else if (LexStatusCodes.LA_GRACE_PERIOD_OVER == status)
                {
                    Console.WriteLine("License is genuinely activated but grace period is over!");
                }
                else if (LexStatusCodes.LA_SUSPENDED == status)
                {
                    Console.WriteLine("License is genuinely activated but has been suspended!");
                }
                else
                {
                    int trialStatus;
                    trialStatus = LexActivator.IsTrialGenuine();
                    if (LexStatusCodes.LA_OK == trialStatus)
                    {
                        uint trialExpiryDate = LexActivator.GetTrialExpiryDate();
                        int  daysLeft        = (int)(trialExpiryDate - DateTimeOffset.Now.ToUnixTimeSeconds()) / 86400;
                        Console.WriteLine("Trial days left: " + daysLeft);
                    }
                    else if (LexStatusCodes.LA_TRIAL_EXPIRED == trialStatus)
                    {
                        Console.WriteLine("Trial has expired!");

                        // Time to buy the product key and activate the app
                        Activate();
                    }
                    else
                    {
                        Console.WriteLine("Either trial has not started or has been tampered!");
                        // Activating the trial
                        trialStatus = LexActivator.ActivateTrial(); // Ideally on a button click inside a dialog
                        if (LexStatusCodes.LA_OK == trialStatus)
                        {
                            uint trialExpiryDate = LexActivator.GetTrialExpiryDate();
                            int  daysLeft        = (int)(trialExpiryDate - DateTimeOffset.Now.ToUnixTimeSeconds()) / 86400;
                            Console.WriteLine("Trial days left: " + daysLeft);
                        }
                        else
                        {
                            // Trial was tampered or has expired
                            Console.WriteLine("Trial activation failed: " + trialStatus);
                        }
                    }
                }
            }
            catch (LexActivatorException ex)
            {
                Console.WriteLine("Error code: " + ex.Code.ToString() + " Error message: " + ex.Message);
            }
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        private void LexLicenseControl_Loaded(object sender, RoutedEventArgs e)
        {
            SpLicenseOk.Visibility               = Visibility.Collapsed;
            SpLicenseNoLicense.Visibility        = Visibility.Collapsed;
            SpLicenseError.Visibility            = Visibility.Collapsed;
            SpLicenseIsSuspended.Visibility      = Visibility.Collapsed;
            SpLicenseExpired.Visibility          = Visibility.Collapsed;
            SpTrialLicenseOk.Visibility          = Visibility.Collapsed;
            SpTrialLicenseIsSuspended.Visibility = Visibility.Collapsed;
            SpTrialLicenseExpired.Visibility     = Visibility.Collapsed;

            var isLicenseGenuine = LexActivator.IsLicenseGenuine();

            if (isLicenseGenuine == LexActivator.StatusCodes.LA_OK)
            {
                SpLicenseOk.Visibility = Visibility.Visible;
            }
            else if (isLicenseGenuine == LexActivator.StatusCodes.LA_EXPIRED)
            {
                SpLicenseExpired.Visibility = Visibility.Visible;
            }
            else if (isLicenseGenuine == LexActivator.StatusCodes.LA_SUSPENDED)
            {
                SpLicenseIsSuspended.Visibility = Visibility.Visible;
            }
            else if (isLicenseGenuine == LexActivator.StatusCodes.LA_GRACE_PERIOD_OVER)
            {
                SpLicenseExpired.Visibility = Visibility.Visible;
            }
            else if (isLicenseGenuine == LexActivator.StatusCodes.LA_FAIL || isLicenseGenuine == LexActivator.StatusCodes.LA_E_PRODUCT_ID || isLicenseGenuine == LexActivator.StatusCodes.LA_E_LICENSE_KEY || isLicenseGenuine == LexActivator.StatusCodes.LA_E_TIME || isLicenseGenuine == LexActivator.StatusCodes.LA_E_TIME_MODIFIED)
            {
                SpLicenseError.Visibility = Visibility.Visible;
                ErrorCode.Text            = ((StatusCodesEnum)isLicenseGenuine).ToString();
            }
            else
            {
                var isTrialGenuine = LexActivator.IsTrialGenuine();
                if (isTrialGenuine == LexActivator.StatusCodes.LA_OK)
                {
                    uint trialExpiryDate    = 0;
                    var  getTrialExpiryDate = LexActivator.GetTrialExpiryDate(ref trialExpiryDate);
                    var  dtDateTime         = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                    dtDateTime = dtDateTime.AddSeconds(trialExpiryDate).ToLocalTime();
                    //LexActivator.Reset();
                    SpTrialLicenseOk.Visibility = Visibility.Visible;
                }
                else if (isTrialGenuine == LexActivator.StatusCodes.LA_TRIAL_EXPIRED)
                {
                    SpTrialLicenseExpired.Visibility = Visibility.Visible;
                }
                else if (isTrialGenuine == LexActivator.StatusCodes.LA_SUSPENDED)
                {
                    SpTrialLicenseIsSuspended.Visibility = Visibility.Visible;
                }
                else
                {
                    SpLicenseNoLicense.Visibility = Visibility.Visible;
                }
                //SpLicenseError.Visibility = Visibility.Visible;
            }
        }
        public MainWindow()
        {
            ExportedData.Init();
            AutoScroll = true;

            Application.Current.DispatcherUnhandledException += (o, args) =>
            {
                Exception ex = (Exception)args.Exception;
                log.Debug("UI exception: ");
                log.Debug(ex);
                //throw ex;
            };

            int status;

            legit = false;

            try
            {
                LexActivator.SetGracePeriodForNetworkError(0);
                LexActivator.SetDayIntervalForServerCheck(1);
            }
            catch (Exception e)
            {
                log.Debug(e);
            }

            status = LexActivator.SetProductFile("Product.dat");
            if (status != LexActivator.LA_OK)
            {
                MessageBox.Show("Corrupted files! Please redownload the software.");
                Environment.Exit(0);
            }

            status = LexActivator.SetVersionGUID("014FF53D-5C6C-5266-7A89-E9601F37F5B1",
                                                 LexActivator.PermissionFlags.LA_USER);
            if (status != LexActivator.LA_OK)
            {
                MessageBox.Show("Corrupted data!");
                Environment.Exit(0);
            }

            LexActivator.ActivateProduct();
            status = LexActivator.IsProductGenuine();
            if (status == LexActivator.LA_OK || status == LexActivator.LA_GP_OVER)
            {
                legit = true;
            }

            status = LexActivator.IsTrialGenuine();
            if (status == LexActivator.LA_OK)
            {
                legit = true;
                uint daysLeft = 0;
                LexActivator.GetTrialDaysLeft(ref daysLeft, LexActivator.TrialType.LA_V_TRIAL);
                MessageBox.Show($"Trial days left: {daysLeft}");
            }

            else if (status == LexActivator.LA_T_EXPIRED && !legit)
            {
                MessageBox.Show("Trial has expired!");
            }

            if (!legit)
            {
                var _loginForm = new LoginForm();
                _loginForm.ShowDialog();
            }

            if (!legit)
            {
                MessageBox.Show("Failed atuh.");
                Environment.Exit(0);
            }

            pSelf            = this;
            ViewModel        = new ViewModel();
            this.DataContext = ViewModel;
            //var bot = new L2Bot(new Injector(23, 123));
            //bot.Engine.Init(bot.PlayerData,
            //    new H5ActionsController(bot.PlayerData,
            //        new Client(new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))));
            //bot.PlayerData.Skills.Add(123, new Skill() {SkillId = 22});

            InitializeComponent();
            //LogHelper.GetLogger($"\\ RONIN .cs").Info($"L2 Ronin BETA {Assembly.GetEntryAssembly().GetName().Version}");
            versionLabel.Text = $"L2 Ronin BETA Release v{Assembly.GetEntryAssembly().GetName().Version}";
            this.Title        = RandomString(10);
            //log.Debug(Title);



            CrackCheckThread = new Thread(delegate()
            {
                while (true)
                {
                    Thread.Sleep(30 * 60 * 1000);
                    LexActivator.ActivateProduct();
                    status = LexActivator.IsProductGenuine();
                    if (status != LexActivator.LA_OK && status != LexActivator.LA_GP_OVER)
                    {
                        Environment.Exit(0);
                    }
                }
            });
            CrackCheckThread.Start();

            Style itemContainerStyle = new Style(typeof(ListBoxItem));

            itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.MouseDoubleClickEvent,
                                                           new MouseButtonEventHandler(ListBox_MouseDoubleClick)));
            BotsList.ItemContainerStyle = itemContainerStyle;

            log.Debug(Assembly.GetEntryAssembly().GetName().Version);
            log.Debug(getOSInfo());
            string OStype = "";

            if (Environment.Is64BitOperatingSystem)
            {
                OStype = "64-Bit, ";
            }
            else
            {
                OStype = "32-Bit, ";
            }
            OStype += Environment.ProcessorCount.ToString() + " Processor";
            log.Debug(OStype);


            var l2rerouterThread = new Thread(Injectora.RerouteL2s);

            l2rerouterThread.SetApartmentState(ApartmentState.STA);
            l2rerouterThread.Start();

            //Hierarchy h = (Hierarchy)LogManager.GetRepository();
            //h.Root.Level = Level.All;
            //h.Root.AddAppender(new TextBoxAppender());
            //h.Configured = true;
        }