Ejemplo n.º 1
0
        private static void OnStopCast(Obj_AI_Base sender, SpellbookStopCastEventArgs args)
        {
            if (!StopCast)
            {
                return;
            }

            if (!Directory.Exists(ResultPath))
            {
                Directory.CreateDirectory(ResultPath);
            }

            using (var writer = File.CreateText(Path.Combine(ResultPath, MethodBase.GetCurrentMethod().Name + ".txt")))
            {
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.WriteLine("OnStopCast, analysing properties...");
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.Flush();
                writer.Write(" - Sender type: ");
                writer.Flush();
                writer.WriteLine(sender.GetType().Name);
                writer.Write(" - Sender name: ");
                writer.Flush();
                writer.WriteLine(sender.BaseSkinName);
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.WriteLine("Analyzing all public properties of sender");
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.Flush();
                foreach (var propertyInfo in sender.GetType().GetProperties().Where(propertyInfo => propertyInfo.CanRead && propertyInfo.GetGetMethod() != null))
                {
                    writer.Write(" - " + propertyInfo.Name + ": ");
                    writer.Flush();
                    writer.WriteLine(propertyInfo.GetValue(sender, null));
                    writer.Flush();
                }
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.WriteLine("Analyzing all public properties of SpellbookStopCastEventArgs");
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.Flush();
                foreach (var propertyInfo in args.GetType().GetProperties().Where(propertyInfo => propertyInfo.CanRead && propertyInfo.GetGetMethod() != null))
                {
                    writer.Write(" - " + propertyInfo.Name + ": ");
                    writer.Flush();
                    writer.WriteLine(propertyInfo.GetValue(args, null));
                    writer.Flush();
                }
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.WriteLine("Analyzing OnStopCast complete!");
                writer.WriteLine("----------------------------------------------------------------------------------");
                writer.WriteLine();
            }
        }