/// <summary> /// 1 = Info<para/> /// 2 = Warning<para/> /// 3 = Error<para/> /// </summary> /// <param name="Text"></param> /// <param name="Type"></param> private void LogText(string Text, Byte Type) { CallBackLog callback = new CallBackLog(LogText); switch (Type) { case 1: if (this.mainform.InvokeRequired) { this.mainform.Invoke(callback, new object[] { Text, Type }); } Log.WriteInfo(Text); break; case 2: if (this.mainform.InvokeRequired) { this.mainform.Invoke(callback, new object[] { Text, Type }); } Log.WriteWarning(Text); break; case 3: if (this.mainform.InvokeRequired) { this.mainform.Invoke(callback, new object[] { Text, Type }); } Log.WriteError(Text); break; default: break; } }
public static void WriteLog(string log, string url = null) { var urlString = url ?? string.Empty; string writeLog = DateTime.Now + ". " + log + urlString; new FileInfo(Environment.CurrentDirectory + "\\data\\").Directory.Create(); File.AppendAllText($@"{Environment.CurrentDirectory}\data\{InstaInfo.Login}-{DateTime.Now:dd.MM.yyyy}-log.txt", writeLog + Environment.NewLine); CallBackLog.CallbackEventHandler(DateTime.Now + ". " + log, url); }
// Initialize the Core :D public static void InitCore(CallBackLog l, CallBackEvent e) { // Can't run this more than once if (inited) return; // We need to be able to Log stuff if (l == null) return; if (e == null) return; Log = l; Event = e; Log(LogType.System, "BoogieBot.dll Initializing..."); // Initialize everything try { if (!File.Exists(Environment.CurrentDirectory + "/" + BoogieCore.BoogieBotConfigFileName)) throw new FileNotFoundException("Configuration file not found.", BoogieCore.BoogieBotConfigFileName); configFile = new IniReader(Environment.CurrentDirectory + "/boogiebot.ini"); // NOTE: Set any OS specific variables so things can be done differently later, ie. Windows or Linux, etc. OperatingSystem os = Environment.OSVersion; switch(os.Platform) { case PlatformID.Win32Windows: Log(LogType.System, "> Operating System: Windows"); break; case PlatformID.Win32NT: Log(LogType.System, "> Operating System: Windows NT"); break; case PlatformID.Unix: Log(LogType.System, "> Operating System: Unix"); break; } Log(LogType.System, "> OS Version: {0}.{1} (Build: {2}) ({3})", os.Version.Major, os.Version.Minor, os.Version.Build, os.ServicePack); // Find WoW's Folder wowPath = BoogieCore.getWowPath(); Log(LogType.System, "> WowPath: {0}", wowPath); // Find WoW's Version wowVersion = BoogieCore.getWoWVersion(); Log(LogType.System, "> WoW Version: World of Warcraft {0}.{1}.{2}.{3} ({4}) Found! Emulating this version.", wowVersion.major, wowVersion.minor, wowVersion.update, wowVersion.build, BoogieCore.WowTypeString); world = new World(); player = new Player(); //areaTable = new AreaTable(); //mapTable = new MapTable(); } catch (Exception ex) { // Bot Start up Failed. Log why, and rethrow the exception. Log(LogType.System, ex.Message); Log(LogType.System, ex.StackTrace); throw new Exception("BoogieBot.dll Init Failure.", ex); } inited = true; Log(LogType.System, "BoogieBot.dll Initialized."); }
/// <summary> /// Add /// </summary> /// <param name="customer"></param> /// <returns></returns> public static bool Add(CallBackLog log) { return(DB.Context.Insert(log) > 0); }
// Initialize the Core :D public static void InitCore(CallBackLog l, CallBackEvent e) { // Can't run this more than once if (inited) { return; } // We need to be able to Log stuff if (l == null) { return; } if (e == null) { return; } Log = l; Event = e; Log(LogType.System, "BoogieBot.dll Initializing..."); // Initialize everything try { if (!File.Exists(Environment.CurrentDirectory + "/" + BoogieCore.BoogieBotConfigFileName)) { throw new FileNotFoundException("Configuration file not found.", BoogieCore.BoogieBotConfigFileName); } configFile = new IniReader(Environment.CurrentDirectory + "/boogiebot.ini"); // NOTE: Set any OS specific variables so things can be done differently later, ie. Windows or Linux, etc. OperatingSystem os = Environment.OSVersion; switch (os.Platform) { case PlatformID.Win32Windows: Log(LogType.System, "> Operating System: Windows"); break; case PlatformID.Win32NT: Log(LogType.System, "> Operating System: Windows NT"); break; case PlatformID.Unix: Log(LogType.System, "> Operating System: Unix"); break; } Log(LogType.System, "> OS Version: {0}.{1} (Build: {2}) ({3})", os.Version.Major, os.Version.Minor, os.Version.Build, os.ServicePack); // Find WoW's Folder wowPath = BoogieCore.getWowPath(); Log(LogType.System, "> WowPath: {0}", wowPath); // Find WoW's Version wowVersion = BoogieCore.getWoWVersion(); Log(LogType.System, "> WoW Version: World of Warcraft {0}.{1}.{2}.{3} ({4}) Found! Emulating this version.", wowVersion.major, wowVersion.minor, wowVersion.update, wowVersion.build, BoogieCore.WowTypeString); world = new World(); player = new Player(); //areaTable = new AreaTable(); //mapTable = new MapTable(); } catch (Exception ex) { // Bot Start up Failed. Log why, and rethrow the exception. Log(LogType.System, ex.Message); Log(LogType.System, ex.StackTrace); throw new Exception("BoogieBot.dll Init Failure.", ex); } inited = true; Log(LogType.System, "BoogieBot.dll Initialized."); }