/// <summary> /// External attachment handle for the Sandbox to load in the SDK library. /// </summary> /// <param name="args"> /// The additional arguments the loader passes. /// </param> /// public static void Init() { if (initialized) { return; } initialized = true; // Initial notification. Logging.Write()(Enumerations.LogLevel.Info, "[-- SDK Bootstrap Loading --]"); // Load Resource Content. //ResourceLoader.Initialize(); Logging.Write()(Enumerations.LogLevel.Info, "[SDK Bootstrap] Resources Initialized."); // Load GameObjects. GameObjects.Initialize(); Logging.Write()(Enumerations.LogLevel.Info, "[SDK Bootstrap] GameObjects Initialized."); // Load Damages. Damage.Initialize(); Logging.Write()(Enumerations.LogLevel.Info, "[SDK Bootstrap] Damage Library Initialized."); // Final notification. Logging.Write()(Enumerations.LogLevel.Info, "[-- SDK Bootstrap Loading --]"); }
public static void Init(string[] args) { if (initialized) { return; } initialized = true; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; // Initial notification. Logging.Write()(LogLevel.Info, "[-- SDK Bootstrap Loading --]"); // Load Resource Content. ResourceLoader.Initialize(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] Resources Initialized."); // Load GameObjects. GameObjects.Initialize(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] GameObjects Initialized."); // Load Damages. Damage.Initialize(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] Damage Library Initialized."); // Final notification. Logging.Write()(LogLevel.Info, "[-- SDK Bootstrap Loading --]"); }
public static void Init(string[] args) { if (initialized) { return; } initialized = true; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; // Initial notification. Logging.Write()(LogLevel.Info, "[-- SDK Bootstrap Loading --]"); // Load Resource Content. ResourceLoader.Initialize(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] Resources Initialized."); // Load GameObjects. GameObjects.Initialize(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] GameObjects Initialized."); // Create L# menu Variables.LeagueSharpMenu = new Menu("LeagueSharp", "LeagueSharp", true).Attach(); MenuCustomizer.Initialize(Variables.LeagueSharpMenu); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] LeagueSharp Menu Created."); // Load the Orbwalker Variables.Orbwalker = new Orbwalker(Variables.LeagueSharpMenu); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] Orbwalker Initialized."); // Load the TargetSelector. Variables.TargetSelector = new TargetSelector(Variables.LeagueSharpMenu); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] TargetSelector Initialized."); // Load the Notifications Notifications.Initialize(Variables.LeagueSharpMenu); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] Notifications Initialized."); // Load the ThemeManager ThemeManager.Initialize(Variables.LeagueSharpMenu); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] ThemeManager Initialized."); // Load Damages. Damage.Initialize(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] Damage Library Initialized."); // Load Language MultiLanguage.LoadTranslation(); Logging.Write()(LogLevel.Info, "[SDK Bootstrap] MultiLanguage Initialized"); // Final notification. Logging.Write()(LogLevel.Info, "[-- SDK Bootstrap Loading --]"); }
/// <summary> /// Initializes the whole SDK. It is safe to call in your code at any point. /// </summary> /// <param name="args">Not currently used or needed.</param> /// <returns>true if SDK is loaded, false if it is not</returns> // [PermissionSet(SecurityAction.Assert, Unrestricted = true)] public static bool Init(string[] args = null) { if (initialized) { return(true); } initialized = true; // Initial notification. // Load Resource Content. ResourceLoader.Initialize(); // Load GameObjects. GameObjects.Initialize(); // Create L# menu Variables.LeagueSharpMenu = new Menu("LeagueSharp", "LeagueSharp", true).Attach(); MenuCustomizer.Initialize(Variables.LeagueSharpMenu); // Load the Orbwalker Variables.Orbwalker = new Orbwalker(Variables.LeagueSharpMenu); // Load the TargetSelector. Variables.TargetSelector = new TargetSelector(Variables.LeagueSharpMenu); // Load the Notifications Notifications.Initialize(Variables.LeagueSharpMenu); // Load the ThemeManager ThemeManager.Initialize(Variables.LeagueSharpMenu); // Load Damages. Damage.Initialize(); // Tell the developer everything succeeded return(initialized); }
public static bool Init(string[] args = null) { if (initialized) { return(true); } initialized = true; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; // Setup logging var config = new LoggingConfiguration(); var fileTarget = new FileTarget { FileName = Constants.LogDirectory + "\\${shortdate}.log", Layout = "${longdate} ${uppercase:${level}} ${message}", ReplaceFileContentsOnEachWrite = true }; config.AddTarget("file", fileTarget); config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget)); var coloredConsoleTarget = new ColoredConsoleTarget { UseDefaultRowHighlightingRules = false, Layout = "${longdate}|${pad:padding=5:inner=${level:uppercase=true}}| ${callsite:className=true:fileName=false:includeSourcePath=false:methodName=false:cleanNamesOfAnonymousDelegates=false:skipFrames=-1}: ${message}", }; coloredConsoleTarget.RowHighlightingRules.Add( new ConsoleRowHighlightingRule() { Condition = "Level == LogLevel.Trace", ForegroundColor = ConsoleOutputColor.DarkGray }); coloredConsoleTarget.RowHighlightingRules.Add( new ConsoleRowHighlightingRule() { Condition = "Level == LogLevel.Debug", ForegroundColor = ConsoleOutputColor.Gray }); coloredConsoleTarget.RowHighlightingRules.Add( new ConsoleRowHighlightingRule() { Condition = "Level == LogLevel.Info", ForegroundColor = ConsoleOutputColor.White }); coloredConsoleTarget.RowHighlightingRules.Add( new ConsoleRowHighlightingRule() { Condition = "Level == LogLevel.Warn", ForegroundColor = ConsoleOutputColor.Yellow }); coloredConsoleTarget.RowHighlightingRules.Add( new ConsoleRowHighlightingRule() { Condition = "Level == LogLevel.Error", ForegroundColor = ConsoleOutputColor.Red }); coloredConsoleTarget.RowHighlightingRules.Add( new ConsoleRowHighlightingRule() { Condition = "Level == LogLevel.Fatal", ForegroundColor = ConsoleOutputColor.Red }); config.AddTarget("coloredConsole", coloredConsoleTarget); config.AddRule(LogLevel.Trace, LogLevel.Fatal, coloredConsoleTarget); LogManager.Configuration = config; var logger = LogManager.GetCurrentClassLogger(); // Log unhandled exceptions AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) => { var exception = eventArgs.ExceptionObject as Exception; // Check if exception came from us if (exception != null && exception.Source.Equals(Assembly.GetExecutingAssembly().FullName)) { // Get the logger from the class that threw the exception and log it LogManager.GetCurrentClassLogger(new StackTrace().GetFrame(1).GetMethod().DeclaringType) .Fatal(exception); } }; // Initial notification. logger.Info("SDKEx Loading"); // Load Resource Content. ResourceLoader.Initialize(); logger.Info("Resources Initialized."); // Load GameObjects. GameObjects.Initialize(); logger.Info("GameObjects Initialized."); // Create L# menu Variables.LeagueSharpMenu = new Menu("LeagueSharp", "LeagueSharp", true).Attach(); MenuCustomizer.Initialize(Variables.LeagueSharpMenu); logger.Info("LeagueSharp Menu Created."); // Load the Orbwalker Variables.Orbwalker = new Orbwalker(Variables.LeagueSharpMenu); logger.Info("Orbwalker Initialized."); // Load the TargetSelector. Variables.TargetSelector = new TargetSelector(Variables.LeagueSharpMenu); logger.Info("TargetSelector Initialized."); // Load the Notifications Notifications.Initialize(Variables.LeagueSharpMenu); logger.Info("Notifications Initialized."); // Load the ThemeManager ThemeManager.Initialize(Variables.LeagueSharpMenu); logger.Info("ThemeManager Initialized."); // Load Damages. Damage.Initialize(); logger.Info("Damage Library Initialized."); // Load Language MultiLanguage.LoadTranslation(); logger.Info("Translations Initialized."); // Final notification. logger.Info($"SDKEx Version {Assembly.GetExecutingAssembly().GetName().Version} Loaded!"); // Tell the developer everything succeeded return(initialized); }