Beispiel #1
0
 public Conversation(Memory memory, ChatbotConfig config, [Named("plugin")] Logger log, PlaceholderHandler ph)
 {
     this.memory              = memory;
     currentMoodValue         = .5f;
     negativeWordMatchPattern = new Regex(string.Join("|", config.NegativeWords), RegexOptions.Compiled | RegexOptions.IgnoreCase);
     positiveWordMatchPattern = new Regex(string.Join("|", config.PositiveWords), RegexOptions.Compiled | RegexOptions.IgnoreCase);
     this.log           = log;
     random             = new Random();
     placeholderHandler = ph;
 }
        // ReSharper disable once MemberCanBePrivate.Global
        public void Patch()
        {
            _placeholderHandler = new PlaceholderHandler();
            _injectionManager   = new InjectionManager();

            MappingManager.LoadMappingFile("C:/Users/Andrew/Documents/Annex/Annex/config/mapping.json");
            Console.WriteLine(MappingManager.Classes.Count);

            osu_exe = ModuleDefMD.Load(@"E:\osu!\osu!.exe");
            api_dll = ModuleDefMD.Load(@"C:\Users\Andrew\Documents\Annex\Annex\Annex.dll");

            CopyClasses();
            Console.WriteLine("Replacing placeholder classes with actual classes...");
            _placeholderHandler.ReplacePlaceholders();
            Console.WriteLine("Injecting code...");
            _injectionManager.InjectCode();

            WriteFile();
        }
Beispiel #3
0
        public virtual IDictionary <string, object> ToJson()
        {
            var options = new Dictionary <string, object>(Events);

            if (Filter.HasValue())
            {
                options["filter"] = SanitizeSelector(Filter);
            }

            if (Disabled.HasValue())
            {
                options["disabled"] = SanitizeSelector(Disabled);
            }

            if (Handler.HasValue())
            {
                options["handler"] = SanitizeSelector(Handler);
            }

            if (ContainerSelector.HasValue())
            {
                options["container"] = SanitizeSelector(ContainerSelector);
            }

            if (ConnectWith.HasValue())
            {
                options["connectWith"] = SanitizeSelector(ConnectWith);
            }

            if (HoldToDrag)
            {
                options["holdToDrag"] = true;
            }

            if (Axis != SortableAxis.None)
            {
                options["axis"] = Enum.GetName(typeof(SortableAxis), Axis).ToLowerInvariant();
            }

            if (Cursor.HasValue())
            {
                options["cursor"] = SanitizeSelector(Cursor);
            }

            if (CursorOffset.Left != int.MinValue || CursorOffset.Top != int.MinValue)
            {
                var topLeft = new Dictionary <string, int>();

                if (CursorOffset.Top != int.MinValue)
                {
                    topLeft.Add("top", CursorOffset.Top);
                }

                if (CursorOffset.Left != int.MinValue)
                {
                    topLeft.Add("left", CursorOffset.Left);
                }

                options.Add("cursorOffset", topLeft);
            }

            if (HintHandler.HasValue())
            {
                options["hint"] = HintHandler;
            }
            else if (Hint.HasValue())
            {
                options["hint"] = Hint;
            }

            if (PlaceholderHandler.HasValue())
            {
                options["placeholder"] = PlaceholderHandler;
            }
            else if (Placeholder.HasValue())
            {
                options["placeholder"] = Placeholder;
            }

            return(options);
        }