private bool Init(string sourceFolder, out bool hasError, out int statusCode) { lock (balanceLock) { if (isInitted) { hasError = hasErrorInternal; statusCode = statusCodeInternal; return(true); } try { if (File.Exists("LexActivator.dll") == false) { try { File.Copy(Path.Combine(sourceFolder, "LexActivator_86.dll"), "LexActivator.dll", true); } catch (Exception ex) { logger.Error(ex, "LexActivator_86 copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } } var isDebug = false; isDebug = false; #if DEBUG isDebug = true; #endif #if LA_ANY_CPU try { if (File.Exists("LexActivator64.dll") == false) { File.Copy(Path.Combine(sourceFolder, "LexActivator_64.dll"), "LexActivator64.dll", true); } } catch (Exception ex) { logger.Error(ex, "LexActivator_64 copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } if (isDebug == false) { try { File.Copy(Path.Combine(sourceFolder, "msvcp100_64.dll"), "msvcp100.dll", true); } catch (Exception ex) { logger.Error(ex, "msvcp100_64 copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } } if (isDebug == false) { try { File.Copy(Path.Combine(sourceFolder, "msvcr100_64.dll"), "msvcr100.dll", true); } catch (Exception ex) { logger.Error(ex, "msvcr100_64 copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } } #else if (isDebug == false) { try { File.Copy(Path.Combine(sourceFolder, "msvcp100_86.dll"), "msvcp100.dll", true); } catch (Exception ex) { logger.Error(ex, "msvcp100_86 copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } } if (isDebug == false) { try { File.Copy(Path.Combine(sourceFolder, "msvcr100_86.dll"), "msvcr100.dll", true); } catch (Exception ex) { logger.Error(ex, "msvcr100_86 copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } } #endif try { if (File.Exists("Product.dat") == false) { File.Copy(Path.Combine(sourceFolder, "Product.dat"), "Product.dat", true); } } catch (Exception ex) { logger.Error(ex, "Product.dat copy error"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } int setProductFile = 0; try { setProductFile = LexActivator.SetProductFile("Product.dat"); } catch (DllNotFoundException dllNotFoundException) { logger.Error(dllNotFoundException, $"SetProductFile error. Code: {setProductFile}"); logger.Error(dllNotFoundException.ToString()); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } catch (Exception ex) { logger.Error(ex, $"SetProductFile error. Code: {setProductFile}"); hasError = hasErrorInternal; statusCode = statusCodeInternal; return(false); } if (setProductFile != LexActivator.StatusCodes.LA_OK) { logger.Error($"SetProductFile error. Code: {setProductFile}"); hasError = true; statusCode = setProductFile; statusCodeInternal = statusCode; hasErrorInternal = hasError; isInitted = true; return(false); } var setProductId = LexActivator.SetProductId("f4a935cd-21ad-4bd2-8b5b-c929e0275340", LexActivator.PermissionFlags.LA_USER); if (setProductId != LexActivator.StatusCodes.LA_OK) { logger.Error($"SetProductId error. Code: {setProductFile}"); hasError = true; statusCode = setProductId; statusCodeInternal = statusCode; hasErrorInternal = hasError; isInitted = true; return(false); } else { hasError = false; statusCode = setProductId; } //var licenseHelperReset = Reset(out int statusCodeReset); statusCodeInternal = statusCode; hasErrorInternal = hasError; isInitted = true; return(true); } catch (Exception ex) { hasError = true; statusCode = 0; logger.Error(ex); } statusCodeInternal = statusCode; hasErrorInternal = hasError; isInitted = true; return(false); } }
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; }