Beispiel #1
0
 private void method_1(ProfileElement profileElement_0, ProfileElement profileElement_1)
 {
     foreach (PropertyInfo info in profileElement_0.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where <PropertyInfo>(Class214.< > 9__26_0 ?? (Class214.< > 9__26_0 = new Func <PropertyInfo, bool>(Class214.< > 9.method_0))))
     {
         object defaultValue = info.PropertyType.GetDefaultValue();
         DefaultValueAttribute customAttribute = info.GetCustomAttribute <DefaultValueAttribute>();
         if (customAttribute != null)
         {
             defaultValue = customAttribute.Value;
         }
         object obj3 = info.GetValue(profileElement_0);
         object obj4 = info.GetValue(profileElement_1);
         if (((obj4 == null) || obj4.Equals(defaultValue)) && (((obj3 != null) && !obj3.Equals(defaultValue)) && ((obj4 == null) || !obj3.Equals(obj4))))
         {
             info.SetValue(profileElement_1, obj3);
         }
     }
 }
Beispiel #2
0
 private void method_3(ProfileElement profileElement_0)
 {
     if (!string.IsNullOrEmpty(profileElement_0.ReferenceName))
     {
         if (this._refList.ContainsKey(profileElement_0.ReferenceName))
         {
             throw new Exception("Profile already contains a reference element with name " + profileElement_0.ReferenceName + ". Cannot correctly load reference!");
         }
         this._refList.Add(profileElement_0.ReferenceName, profileElement_0);
     }
     if (profileElement_0 is ProfileGroupElement)
     {
         foreach (ProfileElement element in (profileElement_0 as ProfileGroupElement).Children)
         {
             this.method_3(element);
         }
     }
 }
Beispiel #3
0
 private void method_2(ProfileElement profileElement_0)
 {
     if (!string.IsNullOrEmpty(profileElement_0.ReferenceTag))
     {
         ProfileElement element = this.method_0(profileElement_0.ReferenceTag);
         if (element != null)
         {
             profileElement_0.ReferenceElement = element;
             this.method_1(element, profileElement_0);
         }
     }
     if (profileElement_0 is ProfileGroupElement)
     {
         foreach (ProfileElement element2 in (profileElement_0 as ProfileGroupElement).Children)
         {
             this.method_2(element2);
         }
     }
 }
Beispiel #4
0
        public ProfileElement FindReferenceElement(ProfileElement element)
        {
            if (element == null)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(element.ReferenceTag))
            {
                return(element);
            }
            ProfileElement element2 = this.method_0(element.ReferenceTag);

            if (element2 != null)
            {
                this._log.Debug(element + " references " + element2.ReferenceTag);
            }
            if (element2 != null)
            {
                element.ReferenceElement = element2;
            }
            return(element2 ?? element);
        }
Beispiel #5
0
        public static Profile LoadProfile(string path)
        {
            XElement element = XElement.Load(File.OpenRead(path));
            Profile  profile = Triton.Bot.Profiles.XmlSerializerFactory.GetSerializerForCurrentDomain <Profile, ProfileElement>().Deserialize(File.OpenRead(path)) as Profile;

            if ((element == null) || (profile == null))
            {
                throw new Exception("Error while loading profile! Loaded Element was null.");
            }
            foreach (XElement element2 in element.Elements())
            {
                ProfileElement item = LoadElement(profile.Elements, element2);
                if (item != null)
                {
                    profile.Elements.Add(item);
                }
                else
                {
                    ilog_0.Error(string.Concat(new object[] { "Unknown profile element: ", element2, " at line ", element2.LineNumber }));
                }
            }
            return(profile);
        }
            private void MoveNext()
            {
                int num = this.int_0;

                try
                {
                    if (num != 0)
                    {
                        if ((this.functionTag_0.ReferenceName == null) && (this.functionTag_0.ReferenceTag == null))
                        {
                            this.functionTag_0.ilog_0.Info("Cannot execute a Function tag that has no reference name, or tag set. This tag is only meant for easily referencing profile behavior steps in sequence.");
                            BotManager.Stop();
                            goto Label_0128;
                        }
                        this.enumerator_0 = this.functionTag_0.Children.GetEnumerator();
                    }
                    try
                    {
                        TaskAwaiter awaiter;
                        if (num == 0)
                        {
                            awaiter            = this.taskAwaiter_0;
                            this.taskAwaiter_0 = new TaskAwaiter();
                            num        = -1;
                            this.int_0 = -1;
                            goto Label_00AE;
                        }
Label_007C:
                        if (!this.enumerator_0.MoveNext())
                        {
                            goto Label_00F7;
                        }
                        ProfileElement current = this.enumerator_0.Current;
                        current.Reset();
                        awaiter = current.ProfileTagLogic().GetAwaiter();
                        if (!awaiter.IsCompleted)
                        {
                            goto Label_00C1;
                        }
Label_00AE:
                        awaiter.GetResult();
                        awaiter = new TaskAwaiter();
                        goto Label_007C;
Label_00C1:
                        num                = 0;
                        this.int_0         = 0;
                        this.taskAwaiter_0 = awaiter;
                        this.asyncTaskMethodBuilder_0.AwaitUnsafeOnCompleted <TaskAwaiter, FunctionTag.Struct36>(ref awaiter, ref this);
                        return;
                    }
                    finally
                    {
                        if (num < 0)
                        {
                            this.enumerator_0.Dispose();
                        }
                    }
Label_00F7:
                    this.enumerator_0 = new List <ProfileElement> .Enumerator();

                    this.functionTag_0.bool_0 = true;
                }
                catch (Exception exception)
                {
                    this.int_0 = -2;
                    this.asyncTaskMethodBuilder_0.SetException(exception);
                    return;
                }
Label_0128:
                this.int_0 = -2;
                this.asyncTaskMethodBuilder_0.SetResult();
            }
Beispiel #7
0
 private void MoveNext()
 {
     int num = this.int_0;
     try
     {
         if (num != 0)
         {
             this.switchTag_0.method_0();
             this.enumerator_0 = this.switchTag_0.switchArgument_0.Children.GetEnumerator();
         }
         try
         {
             TaskAwaiter awaiter;
             if (num == 0)
             {
                 awaiter = this.taskAwaiter_0;
                 this.taskAwaiter_0 = new TaskAwaiter();
                 num = -1;
                 this.int_0 = -1;
                 goto Label_0084;
             }
         Label_0052:
             if (!this.enumerator_0.MoveNext())
             {
                 goto Label_00CD;
             }
             ProfileElement current = this.enumerator_0.Current;
             current.Reset();
             awaiter = current.ProfileTagLogic().GetAwaiter();
             if (!awaiter.IsCompleted)
             {
                 goto Label_0097;
             }
         Label_0084:
             awaiter.GetResult();
             awaiter = new TaskAwaiter();
             goto Label_0052;
         Label_0097:
             num = 0;
             this.int_0 = 0;
             this.taskAwaiter_0 = awaiter;
             this.asyncTaskMethodBuilder_0.AwaitUnsafeOnCompleted<TaskAwaiter, SwitchTag.Struct41>(ref awaiter, ref this);
             return;
         }
         finally
         {
             if (num < 0)
             {
                 this.enumerator_0.Dispose();
             }
         }
     Label_00CD:
         this.enumerator_0 = new List<ProfileElement>.Enumerator();
         this.switchTag_0.bool_0 = true;
     }
     catch (Exception exception)
     {
         this.int_0 = -2;
         this.asyncTaskMethodBuilder_0.SetException(exception);
         return;
     }
     this.int_0 = -2;
     this.asyncTaskMethodBuilder_0.SetResult();
 }