Ejemplo n.º 1
0
 private static void PreLoadHbProfile()
 {
     if (!string.IsNullOrEmpty(Instance.CurrentProfile.ProfilePath) && Instance.PbBehavior != null)
     {
         var dict = new Dictionary <string, Uri>();
         PbProfile.GetHbprofiles(Instance.CurrentProfile.ProfilePath, Instance.PbBehavior, dict);
         if (dict.Count > 0)
         {
             foreach (var kv in dict)
             {
                 if (!string.IsNullOrEmpty(kv.Key) && File.Exists(kv.Key))
                 {
                     Log("Preloading profile {0}", kv.Key);
                     // unhook event to prevent recursive loop
                     BotEvents.Profile.OnNewOuterProfileLoaded -= Profile_OnNewOuterProfileLoaded;
                     ProfileManager.LoadNew(kv.Key);
                     BotEvents.Profile.OnNewOuterProfileLoaded += Profile_OnNewOuterProfileLoaded;
                     return;
                 }
             }
         }
     }
     if (ProfileManager.CurrentProfile == null)
     {
         BotEvents.Profile.OnNewOuterProfileLoaded -= Profile_OnNewOuterProfileLoaded;
         ProfileManager.LoadEmpty();
         BotEvents.Profile.OnNewOuterProfileLoaded += Profile_OnNewOuterProfileLoaded;
     }
 }
 public static void PreLoadHbProfile()
 {
     if (!string.IsNullOrEmpty(Instance.CurrentProfile.ProfilePath) && Instance.CurrentProfile.Branch != null)
     {
         Dictionary <string, Uri> dict = new Dictionary <string, Uri>();
         PbProfile.GetHbprofiles(Instance.CurrentProfile.ProfilePath, Instance.CurrentProfile.Branch, dict);
         if (dict.Count > 0)
         {
             foreach (var kv in dict)
             {
                 if (!string.IsNullOrEmpty(kv.Key))
                 {
                     ProfileManager.LoadNew(kv.Key);
                     return;
                 }
             }
         }
     }
     if (ProfileManager.CurrentProfile == null)
     {
         ProfileManager.LoadEmpty();
     }
 }