コード例 #1
0
 public static void Main(string[] args)
 {
     // TODO: move this elsewhere, let the config handle this.
     using (WindowTitle.Set("Caesura Solace Manager"))
     {
         CreateHostBuilder(args).Build().Run();
     }
 }
コード例 #2
0
        public static string GetInput()
        {
            WindowTitle SCUI_CUSTOM_MUSIC_EVENT = new WindowTitle();
            string      input = Game.GetUserInput(SCUI_CUSTOM_MUSIC_EVENT, defaulttext, 45);

            defaulttext = input;
            return(input);
        }
コード例 #3
0
        public MainPage()
        {
            this.InitializeComponent();

            NavigationView.RegisterPropertyChangedCallback(NavigationView.IsPaneOpenProperty, OnNavigationViewIsPaneOpenPropertyChanged);
            SystemNavigationManager.GetForCurrentView().BackRequested += OnAppBackRequested;
            WindowTitle.EnableLayoutImplicitAnimations(TimeSpan.FromMilliseconds(100));
            this.Loaded += OnLoaded;
        }
コード例 #4
0
        private void Window_Activated(object sender, EventArgs e)
        {
            Binding binding = new Binding
            {
                Source = Window,
                Path   = new PropertyPath(BorderBrushProperty)
            };

            WindowTitle.SetBinding(ForegroundProperty, binding);
        }
コード例 #5
0
        private void Window_Activated(object sender, EventArgs e)
        {
            Binding binding = new Binding
            {
                Source = Window,
                Path   = new PropertyPath(BackgroundProperty)
            };

            WindowTitle.SetBinding(ForegroundProperty, binding);
            //HeaderTitle.Foreground = new SolidColorBrush(Colors.White);
        }
コード例 #6
0
 public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
 {
     ScriptDomain.CurrentDomain.PauseKeyboardEvents(true);
     InputArgument[] arguments = new InputArgument[] { true, windowTitle.ToString(), string.Empty, defaultText, string.Empty, string.Empty, string.Empty, maxLength + 1 };
     Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, arguments);
     while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD, Array.Empty <InputArgument>()) == 0)
     {
         Script.Yield();
     }
     ScriptDomain.CurrentDomain.PauseKeyboardEvents(false);
     return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT, Array.Empty <InputArgument>()));
 }
コード例 #7
0
        public static async Task <string> GetUserInput(WindowTitle windowTitle = WindowTitle.FMMC_KEY_TIP8, string defaultText = null, int maxLength = 30)
        {
            string result = null;

            // Cancelling throws an exception :/
            try
            {
                result = await Game.GetUserInput(windowTitle, defaultText, maxLength);
            }
            catch {}

            return(result);
        }
コード例 #8
0
        /// <summary>
        /// Creates an input box for enabling a user to input text using the keyboard
        /// </summary>
        /// <param name="windowTitle">The Title of the Window.</param>
        /// <param name="defaultText">The default text.</param>
        /// <param name="maxLength">The maximum length of input allowed.</param>
        /// <returns>The <see cref="string"/> of what the user entered, If the user cancelled <see cref="string.Empty"/> is returned</returns>
        public static async Task <string> GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
        {
            //ScriptDomain.CurrentDomain.PauseKeyboardEvents(true);

            ClearKeyboard(windowTitle, defaultText, maxLength);

            while (API.UpdateOnscreenKeyboard() == 0)
            {
                await BaseScript.Delay(0);
            }

            //ScriptDomain.CurrentDomain.PauseKeyboardEvents(false);

            return(API.GetOnscreenKeyboardResult());
        }
コード例 #9
0
        /// <summary>
        /// Creates an input box for the user to input text using the keyboard.
        /// </summary>
        /// <param name="windowTitle">The title of the input box window.</param>
        /// <param name="maxLength">The maximum length of text input allowed.</param>
        /// <param name="defaultText">The default text.</param>
        /// <returns>The <see cref="string"/> of what the user entered or <see cref="string.Empty"/> if the user canceled.</returns>
        public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
        {
            Input.PauseKeyboardEvents(true);

            Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, _windowTitles[(int)windowTitle], MemoryAccess.NullString, defaultText, MemoryAccess.NullString, MemoryAccess.NullString, MemoryAccess.NullString, maxLength + 1);

            while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD) == 0)
            {
                Script.YieldExecuting();
            }

            Input.PauseKeyboardEvents(false);

            return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT));
        }
コード例 #10
0
ファイル: Game.cs プロジェクト: fivmp/fivmp-not-fivem
        /// <summary>
        /// Creates an input box for enabling a user to input text using the keyboard
        /// </summary>
        /// <param name="windowTitle">The Title of the Window.</param>
        /// <param name="defaultText">The default text.</param>
        /// <param name="maxLength">The maximum length of input allowed.</param>
        /// <returns>The <see cref="string"/> of what the user entered, If the user cancelled <see cref="string.Empty"/> is returned</returns>
        public static async Task <string> GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
        {
            //ScriptDomain.CurrentDomain.PauseKeyboardEvents(true);

            ClearKeyboard(windowTitle, defaultText, maxLength);

            while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD) == 0)
            {
                await BaseScript.Delay(0);
            }

            //ScriptDomain.CurrentDomain.PauseKeyboardEvents(false);

            return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT));
        }
コード例 #11
0
        /// <summary>
        /// Creates an input box for the user to input text using the keyboard.
        /// </summary>
        /// <param name="windowTitle">The title of the input box window.</param>
        /// <param name="maxLength">The maximum length of text input allowed.</param>
        /// <param name="defaultText">The default text.</param>
        /// <returns>The <see cref="string"/> of what the user entered or <see cref="string.Empty"/> if the user canceled.</returns>
        public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
        {
            SHVDN.ScriptDomain.CurrentDomain.PauseKeyEvents(true);

            Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, _windowTitles[(int)windowTitle], SHVDN.NativeMemory.NullString, defaultText, SHVDN.NativeMemory.NullString, SHVDN.NativeMemory.NullString, SHVDN.NativeMemory.NullString, maxLength + 1);

            while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD) == 0)
            {
                Script.Yield();
            }

            SHVDN.ScriptDomain.CurrentDomain.PauseKeyEvents(false);

            return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT));
        }
コード例 #12
0
		private bool Callback(IntPtr hwnd, int lParam)
		{
                        const int WS_BORDER = 0x800000;
                        const int WS_VISIBLE = 0x10000000;
                        const int GWL_STYLE = (-16);
			int visibleWindow = WS_BORDER | WS_VISIBLE;
			if ((GetWindowLong(hwnd, GWL_STYLE) & visibleWindow) == visibleWindow)
			{
				this.visibleWindows.Add(new Window()
				{
					Handle = hwnd,
					Title = WindowTitle.GetText(hwnd)
				});
			}
			return true; //continue enumeration
		}
コード例 #13
0
        /// <summary>
        /// Creates an input box for enabling a user to input text using the keyboard
        /// </summary>
        /// <param name="windowTitle">The Title of the Window.</param>
        /// <param name="defaultText">The default text.</param>
        /// <param name="maxLength">The maximum length of input allowed</param>
        /// <returns>The <see cref="string"/> of what the user entered, If the user cancelled <see cref="string.Empty"/> is returned</returns>
        public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
        {
            Input.PauseKeyboardEvents(true);

            // int p0, char* windowTitle, char* p2, char* defaultText, char* defaultConcat1, char* defaultConcat2, char* defaultConcat3, int maxInputLength
            Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, windowTitle.ToString(), string.Empty, defaultText, string.Empty, string.Empty, string.Empty, maxLength + 1);

            while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD) == 0)
            {
                Script.YieldExecuting();
            }

            Input.PauseKeyboardEvents(false);

            return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT));
        }
コード例 #14
0
        public MTHCrypto(int hwnd, ICore core) : base(hwnd, core)
        {
            TableName = WindowTitle.Substring(0, WindowTitle.IndexOf('-'));
            //TODO: Get GameForm, GameType, GameLimit

            // Get the action button pixel color
            Bitmap bmp = (Bitmap)Bitmap.FromFile(Path.Combine(Win32.GetModuleDirectory(hwnd), "img\\p_btn_betting.jpg"));

            actionButtonPixelColor = bmp.GetPixel(116, 51);
            bmp.Dispose();

            // Get the "more chips" active button color
            bmp = (Bitmap)Bitmap.FromFile(Path.Combine(Win32.GetModuleDirectory(hwnd), "img\\p_btn_morechips.jpg"));
            activeMoreChipsButtonPixelColor = bmp.GetPixel(0, 0);
            bmp.Dispose();

            // Get the "sit out" button color
            bmp = (Bitmap)Bitmap.FromFile(Path.Combine(Win32.GetModuleDirectory(hwnd), "img\\p_btn_sitout.jpg"));
            sitOutButtonPixelColor = bmp.GetPixel(0, 0);
            bmp.Dispose();
        }
コード例 #15
0
        public void OnApplicationStart()
        {
            try
            {
                HarmonyInstance harmony = HarmonyInstance.Create("com.jackbaron.beatsaber.owoSaber");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                Logger.Log("Patched successfully!");
            }
            catch (Exception e)
            {
                Logger.Log(
                    "This plugin requires Harmony. Make sure you installed the plugin " +
                    "properly, as the Harmony DLL should have been installed with it.",
                    Logger.LogLevel.Warning);

                Console.WriteLine(e);
            }

            string title    = WindowTitle.Get();
            string replaced = Replacement.ReplaceText(title);

            WindowTitle.Set(replaced);
        }
コード例 #16
0
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != spawnCarKey)
            {
                spawnCarMult = 0;
            }

            if (Function.Call <bool>(Hash.IS_PED_IN_ANY_VEHICLE, Game.Player, true))
            {
                spawnCarMult = 0;
            }
            // Resets wanted level to 0
            if (e.KeyCode == resetLevelKey)
            {
                if (Game.Player.WantedLevel == 0)
                {
                    UI.ShowSubtitle("You have no wanted level!", 3000);
                }
                else
                {
                    Game.Player.WantedLevel = 0;
                    UI.ShowSubtitle("Your wanted level is now 0!", 3000);
                }
            }
            // Increases wanted level by 1
            if (e.KeyCode == increaseLevelKey)
            {
                currentLevel++;
                if (Game.Player.WantedLevel >= 5)
                {
                    UI.ShowSubtitle("You've reached the max level!", 3000);
                    currentLevel = 5;
                }
                else
                {
                    Game.Player.WantedLevel = currentLevel;
                    UI.ShowSubtitle("Your wanted level is now " + currentLevel + "!", 3000);
                }
            }
            // Decreases wanted level by 1
            if (e.KeyCode == decreaseLevelKey)
            {
                currentLevel--;
                if (Game.Player.WantedLevel <= 0)
                {
                    UI.ShowSubtitle("You've reached the lowest level!", 3000);
                    currentLevel = 0;
                }
                else
                {
                    Game.Player.WantedLevel = currentLevel;
                    UI.ShowSubtitle("Your wanted level is now " + currentLevel + "!", 3000);
                }
            }
            // Starts/Ends Never Wanted
            if (e.KeyCode == noWantedLevelKey)
            {
                isNeverWantedOn = !isNeverWantedOn;
                if (isNeverWantedOn)
                {
                    UI.ShowSubtitle("Never Wanted Turned On", 3000);
                }
                else
                {
                    UI.ShowSubtitle("Never Wanted Turned Off", 3000);
                }
            }
            // Spawns a random car
            if (e.KeyCode == spawnCarKey)
            {
                spawnCarMult++;
                SpawnCar("");
            }
            // Spawns a user-inputted car
            if (e.KeyCode == spawnCustomCar)
            {
                WindowTitle temp     = new WindowTitle();
                var         carModel = Game.GetUserInput(temp, "Enter a Car Model", 15);
                spawnCarMult++;
                SpawnCar(carModel);
            }
            // Spawns a random ped
            if (e.KeyCode == spawnRandomPed)
            {
                SpawnPed();
            }
        }
コード例 #17
0
ファイル: Game.cs プロジェクト: fivmp/fivmp-not-fivem
 private static void ClearKeyboard(WindowTitle windowTitle, string defaultText, int maxLength)
 {
     Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, windowTitle.ToString(), MemoryAccess.NullString, defaultText, MemoryAccess.NullString, MemoryAccess.NullString, MemoryAccess.NullString, maxLength + 1);
 }
コード例 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Set width of text control based on width from Designer Studio
            _txtLookupReference.Width = GetTextControlWidth();

            if (!IsPostBack)
            {
                _txtLookupReference.Attributes.Add("onKeyDown", "GetKeyPress1(event,'" + _hiddenShowpopUP.ClientID + "')");
                _btnCancel.Attributes.Add("onclick", "ClearSelectedRowIndex(event,'" + gvLookup.ClientID + "','" + _hdnLookupId.ClientID + "')");
                _txtLookupReference.Text  = DisplayNameValue.Trim();
                lblLookupWindowTitle.Text = WindowTitle.Trim();
            }
            else
            {
                // Handle the JavaScript post back required by the parent page
                if (Request.Form["__EVENTTARGET"] != null && Request.Form["__EVENTTARGET"].ToUpper().Contains("MYDBLCLICK"))
                {
                    string[] values = Request.Form["__EVENTARGUMENT"].Split('~');

                    if (values != null && values.Length == 3)
                    {
                        if (AttributeName == values[2])
                        {
                            this.LookupId          = values[0];
                            gvLookup.SelectedIndex = int.Parse(values[1]);
                            GridViewRow row = gvLookup.SelectedRow;
                            _hiddenShowpopUP.Value   = "true";
                            _txtLookupReference.Text = row.Cells[1].Text.Trim(); // Identifier/Key column
                            _hdnLookupRef.Value      = row.Cells[1].Text.Trim();
                            AttributeValue           = row.Cells[2].Text.Trim(); // Description column
                            _modalpopupLookupSearch.Hide();
                        }

                        lookupUserControl userControl;

                        // Clear WorkType and ChargeRate value if Department value has been selected
                        if (!string.IsNullOrEmpty(values[2]) && values[2].ToUpper().Trim().Equals("MATTER.DEPARTMENT"))
                        {
                            if (this.Parent.FindControl("WorkType") != null)
                            {
                                userControl = (lookupUserControl)this.Parent.FindControl("WorkType");
                                userControl.Clear();
                            }

                            if (this.Parent.FindControl("ChargeRate") != null)
                            {
                                userControl = (lookupUserControl)this.Parent.FindControl("ChargeRate");
                                userControl.Clear();
                            }
                        }

                        // Clear ChargeRate value if WorkType value has been selected
                        else if (!string.IsNullOrEmpty(values[2]) && values[2].ToUpper().Trim().Equals("MATTER.WORKTYPE"))
                        {
                            if (this.Parent.FindControl("ChargeRate") != null)
                            {
                                userControl = (lookupUserControl)this.Parent.FindControl("ChargeRate");
                                userControl.Clear();
                            }
                        }
                    }
                }
            }
        }
コード例 #19
0
 /// <summary>
 /// Creates an input box for enabling a user to input text using the keyboard
 /// </summary>
 /// <param name="windowTitle">The Title of the Window.</param>
 /// <param name="maxLength">The maximum length of input allowed</param>
 /// <returns>The <see cref="string"/> of what the user entered, If the user cancelled <see cref="string.Empty"/> is returned</returns>
 public static string GetUserInput(WindowTitle windowTitle, int maxLength)
 {
     return(GetUserInput(windowTitle, string.Empty, maxLength));
 }
コード例 #20
0
        public static List <PowerBIInstance> GetLocalInstances()
        {
            List <PowerBIInstance> _instances = new List <PowerBIInstance>();

            _instances.Clear();

            var dict = ManagedIpHelper.GetExtendedTcpDictionary();

            foreach (var proc in Process.GetProcessesByName("msmdsrv"))
            {
                int _port = 0;
                EmbeddedSSASIcon _icon = EmbeddedSSASIcon.PowerBI;
                var parent             = proc.GetParent();

                // exit here if the parent == "services" then this is a SSAS instance
                if (parent.ProcessName.Equals("services", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                // exit here if the parent == "RSHostingService" then this is a SSAS instance
                if (parent.ProcessName.Equals("RSHostingService", StringComparison.OrdinalIgnoreCase))
                {
                    // only show PBI Report Server if we are running as admin
                    // otherwise we won't have any access to the models
                    if (IsAdministrator())
                    {
                        _icon = EmbeddedSSASIcon.PowerBIReportServer;
                    }
                    else
                    {
                        continue;
                    }
                }

                // if the process was launched from Visual Studio change the icon
                if (parent.ProcessName.Equals("devenv", StringComparison.OrdinalIgnoreCase))
                {
                    _icon = EmbeddedSSASIcon.Devenv;
                }

                // get the window title so that we can parse out the file name
                var parentTitle = parent.MainWindowTitle;
                if (parentTitle.Length == 0)
                {
                    // for minimized windows we need to use some Win32 api calls to get the title
                    //parentTitle = WindowTitle.GetWindowTitleTimeout( parent.Id, 300);
                    parentTitle = WindowTitle.GetWindowTitle(parent.Id);
                }

                // try and get the tcp port from the Win32 TcpTable API
                try
                {
                    TcpRow tcpRow = null;
                    dict.TryGetValue(proc.Id, out tcpRow);
                    if (tcpRow != null)
                    {
                        _port = tcpRow.LocalEndPoint.Port;
                        _instances.Add(new PowerBIInstance(parentTitle, _port, _icon));
                        Log.Debug("{class} {method} PowerBI found on port: {port}", "PowerBIHelper", "Refresh", _port);
                    }
                    else
                    {
                        Log.Debug("{class} {method} PowerBI port not found for process: {processName} PID: {pid}", "PowerBIHelper", "Refresh", proc.ProcessName, proc.Id);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("{class} {Method} {Error} {StackTrace}", "PowerBIHelper", "Refresh", ex.Message, ex.StackTrace);
                }
            }
            return(_instances);
        }
コード例 #21
0
 private static void ClearKeyboard(WindowTitle windowTitle, string defaultText, int maxLength)
 {
     API.DisplayOnscreenKeyboard(1, windowTitle.ToString(), null, defaultText, null, null, null, maxLength + 1);
 }
コード例 #22
0
 /// <summary>
 /// Creates an input box for enabling a user to input text using the keyboard
 /// </summary>
 /// <param name="windowTitle">The Title of the Window.</param>
 /// <param name="maxLength">The maximum length of input allowed.</param>
 /// <returns>The <see cref="string"/> of what the user entered, If the user cancelled <see cref="string.Empty"/> is returned</returns>
 public static async Task <string> GetUserInput(WindowTitle windowTitle, int maxLength)
 {
     return(await GetUserInput(windowTitle, string.Empty, maxLength));
 }
コード例 #23
0
 public static string GetUserInput(WindowTitle windowTitle, int maxLength) =>
 GetUserInput(windowTitle, string.Empty, maxLength);
コード例 #24
0
        public MTHPartyPoker(int hwnd, ICore core) : base(hwnd, core)
        {
            TableName = WindowTitle.Substring(0, WindowTitle.IndexOf('-'));

            // Set WinHook to listen for show/hide window
            wh = new WinHook();

            wh.HwndParam = (IntPtr)WindowHandle;
            wh.Monitor   = HookMonitor.HwndAndChildren;
            wh.HookType  = HookTypes.CallWndProc;
            wh.Messages  = new WindowsMessageList();
            wh.Messages.AddMessage(StandardMessages.WM_SHOWWINDOW);
            wh.OnMessageHook += new MessageHookEventHandler(wh_OnMessageHook);
            wh.Enabled        = true;

            // Update children
            UpdateChildren();

            // Check if we're seated
            bool foundChild = false;

            foreach (ChildWindow cw in children.Values)
            {
                if (cw.ControlID == 443 && cw.IsVisible)
                {
                    foundChild = true;
                    break;
                }
            }

            if (foundChild)
            {
                isSeated = true;
                OnSeated();
            }
            else
            {
                isSeated = false;
                OnUnSeated();
            }

            // Check if we're sitting out
            if (isSeated)
            {
                foundChild = false;
                foreach (ChildWindow cw in children.Values)
                {
                    if (cw.ControlID == 4000 && cw.IsVisible && cw.Text.ToLower().Replace(" ", "") == "iamback")
                    {
                        foundChild = true;
                        break;
                    }
                }

                if (foundChild)
                {
                    isSittingOut = true;
                    OnSittingOut();
                }
                else
                {
                    isSittingOut = false;
                    OnSittingIn();
                }
            }

            // TODO: Check for requiring action
        }