Esempio n. 1
0
        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;
        }