Beispiel #1
0
        protected override void DoCommandAction()
        {
            CommandExecuter.Instance.GUIActive = true;
            GoAhead.GUI.GUI gui = new GoAhead.GUI.GUI();
            gui.FormsToLoadOnStartup.AddRange(FormsToLoadOnStartup);
            gui.CommandToExecuteOnLoad.AddRange(GUICommands.Where(cmd => cmd is OpenScriptInDebugger));

            foreach (GUICommand addCmd in GUICommands.Where(cmd => cmd is AddUserElement))
            {
                CommandExecuter.Instance.Execute(addCmd);
            }
            GUICommands.Clear();

            // store FPGA View for SaveFPGAViewAsBitmap
            m_FPGAView = gui.FPGAView;
            try
            {
                gui.ShowDialog();
            }
            catch (Exception) { }

            CommandHook            hook         = CommandExecuter.Instance.GetAllHooks().FirstOrDefault(h => h is PrintProgressToGUIHook);
            PrintProgressToGUIHook progressHook = (PrintProgressToGUIHook)hook;

            progressHook.m_forms.Add(gui);

            CommandExecuter.Instance.GUIActive = false;
        }
Beispiel #2
0
        public override void Init()
        {
            CommandHook meow = CreateCommandHook("meow", Meow, "Usage: /meow");
            CommandHook woof = CreateCommandHook("woof", Woof, "Usage: /woof");

            HexChat.Print("Example .NET plugin loaded!");
        }
        protected override void DoCommandAction()
        {
            // surpreess own output after ProfileAll
            Profile = false;
            Dictionary <string, long> profile = new Dictionary <string, long>();

            if (Append && File.Exists(FileName))
            {
                TextReader tr   = new StreamReader(FileName);
                string     line = "";
                while ((line = tr.ReadLine()) != null)
                {
                    string[] atoms = Regex.Split(line, ";");
                    if (atoms.Length == 2)
                    {
                        string cmdName  = atoms[0];
                        long   cmdCount = long.Parse(atoms[1]);
                        profile[cmdName] = cmdCount;
                    }
                }
                tr.Close();
            }

            if (File.Exists(FileName))
            {
                // bypass later append
                File.Delete(FileName);
            }

            CommandHook   hook        = CommandExecuter.Instance.GetAllHooks().FirstOrDefault(h => h is ProfilingHook);
            ProfilingHook profileHook = (ProfilingHook)hook;

            if (profileHook == null)
            {
                throw new ArgumentException("No profiler found");
            }
            else
            {
                foreach (KeyValuePair <string, long> tupel in profileHook.TotalProfile)
                {
                    string key = tupel.Key;
                    if (!profile.ContainsKey(key))
                    {
                        profile.Add(key, 0);
                    }
                    profile[key] += tupel.Value;
                }
            }

            //TextWriter tw = new StreamWriter(this.FileName);
            foreach (KeyValuePair <string, long> tupel in profile.OrderBy(t => t.Value))
            {
                OutputManager.WriteOutput(tupel.Key + ";" + profile[tupel.Key]);
                //tw.WriteLine(tupel.Key + ";" + profile[tupel.Key]);
            }
            //tw.Close();
        }
    public override void Stop()
    {
        base.Stop();
        Owner.EnableAnimator(true);
        CommandHook c = Cmd as CommandHook;

        if (c.StopCallback != null)
        {
            c.StopCallback();
            c.StopCallback = null;
        }
    }
Beispiel #5
0
        static void Main(string[] args)
        {
            //Dont.Be.A.Scumbag.And.Remove.This.Warn.warn();
            Console.WriteLine("Xri Client");
            Console.WriteLine("Flare port to C#");
            Console.WriteLine("Xri port to C#");
            Console.WriteLine("Discord: https://discord.gg/t8pp4Vm");

            Process.Start("minecraft://");

            try
            {
                MCM.openGame();
                MCM.openWindowHost();

                CommandHook     cmh   = new CommandHook();
                SDK             sdk   = new SDK();
                FileMan         fm    = new FileMan();
                CategoryHandler ch    = new CategoryHandler();
                TabUiHandler    tuih  = new TabUiHandler();
                ModuleHandler   mh    = new ModuleHandler();
                KeybindHandler  kh    = new KeybindHandler();
                Thread          uiApp = new Thread(() => { OverlayHost ui = new OverlayHost(); Application.Run(ui); });
                if (fm.readConfig())
                {
                    Console.WriteLine("Loaded configurations!");
                }
                else
                {
                    Console.WriteLine("Could not load configurations!");
                }
                uiApp.Start();
                while (true)
                {
                    try
                    {
                        mainLoop.Invoke(null, new EventArgs());
                        Thread.Sleep(threadSleep);
                    }
                    catch (Exception)
                    {
                    }
                }
            } catch (Exception ex)
            {
                Console.WriteLine("Message: " + ex.Message);
                Console.WriteLine("Stacktrace: " + ex.StackTrace);
                MessageBox.Show("Xri crashed! Check the console for error details. Click 'Ok' to quit.");
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            //Dont.Be.A.Scumbag.And.Remove.This.Warn.warn();
            Console.WriteLine("Flare# Client");
            Console.WriteLine("Flare port to C#");
            Console.WriteLine("Discord: https://discord.gg/Hz3Dxg8");

            Process.Start("minecraft://");

            try
            {
                MCM.openGame();
                MCM.openWindowHost();

                CommandHook     cmh   = new CommandHook();
                FileMan         fm    = new FileMan();
                CategoryHandler ch    = new CategoryHandler();
                ModuleHandler   mh    = new ModuleHandler();
                KeybindHandler  kh    = new KeybindHandler();
                Thread          uiApp = new Thread(() => { OverlayHost ui = new OverlayHost(); Application.Run(ui); });
                if (fm.readConfig())
                {
                    Console.WriteLine("Loaded config!");
                }
                else
                {
                    Console.WriteLine("Could not load config!");
                }
                uiApp.Start();
                if (args != null)
                {
                    if (args.Length > 0)
                    {
                        if (args[0] == "dualThread")
                        {
                            Thread moduleThread = new Thread(() => { while (true)
                                                                     {
                                                                         try { ModuleHandler.registry.tickModuleThread(); Thread.Sleep(1); } catch (Exception) { }
                                                                     }
                                                             });
                            moduleThread.Start();
                        }
                    }
                }
                while (true)
                {
                    try
                    {
                        mainLoop.Invoke(null, new EventArgs());
                        if (limitCpu)
                        {
                            Thread.Sleep(1);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            } catch (Exception ex)
            {
                Console.WriteLine("Message: " + ex.Message);
                Console.WriteLine("Stacktrace: " + ex.StackTrace);
                MessageBox.Show("Flare crashed! Check the console for error details. Click 'Ok' to quit.");
            }
        }