Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.Reflection;
  3. using System.Windows.Forms;
  4. using System.Drawing;
  5. using System.Threading;
  6. using System.Globalization;
  7. using Styx.Helpers;
  8. using Styx.Plugins.PluginClass;
  9. using TreeSharp;
  10.  
  11. namespace Styx.Bot.Plugins
  12. {
  13. public class IBLoader : BotBase
  14. {
  15. private readonly BotBase _botBase;
  16.  
  17. public IBLoader()
  18. {
  19. try
  20. {
  21. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
  22.  
  23. string path = Logging.ApplicationPath + @"\Bots\AuctionBot\AuctionBot.dll";
  24. Assembly asm = Assembly.LoadFrom(path);
  25.  
  26. foreach(Type t in asm.GetTypes())
  27. {
  28. if(t.IsSubclassOf(typeof(BotBase)) && t.IsClass)
  29. {
  30. var obj = Activator.CreateInstance(t);
  31. _botBase = (BotBase)obj;
  32. }
  33. }
  34. }
  35. catch (System.Threading.ThreadAbortException) { throw; }
  36. catch (Exception e)
  37. {
  38. Logging.Write(Color.DarkRed, "An error occured while loading AuctionBot");
  39. Logging.WriteDebug(e.ToString());
  40. }
  41. }
  42.  
  43. #region Overrides of BotBase
  44.  
  45. public override string Name
  46. {
  47. get { return _botBase.Name; }
  48. }
  49.  
  50. public override Composite Root
  51. {
  52. get { return _botBase.Root; }
  53. }
  54.  
  55. public override PulseFlags PulseFlags
  56. {
  57. get { return _botBase.PulseFlags; }
  58. }
  59.  
  60. public override Form ConfigurationForm { get { return _botBase.ConfigurationForm; } }
  61.  
  62. public override void Initialize()
  63. {
  64. _botBase.Initialize();
  65. }
  66.  
  67. public override bool IsPrimaryType
  68. {
  69. get
  70. {
  71. return _botBase.IsPrimaryType;
  72. }
  73. }
  74.  
  75. public override bool RequirementsMet
  76. {
  77. get
  78. {
  79. return _botBase.RequirementsMet;
  80. }
  81. }
  82.  
  83. public override void Pulse()
  84. {
  85. _botBase.Pulse();
  86. }
  87.  
  88. public override void Start()
  89. {
  90. _botBase.Start();
  91. }
  92.  
  93. public override void Stop()
  94. {
  95. _botBase.Stop();
  96. }
  97.  
  98. #endregion
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement