Exemplo n.º 1
0
        public int InputBox(IntPtr gui, uint flags, string title, string body, IntPtr buffer, int minlen, int maxlen, UInt32 guiid)
        {
            log.DebugFormat("flags: {0}, title: {1}, body: {2}, minlen: {3}, maxlen: {4}, guuid: {5}",
                            flags, title, body, minlen, maxlen, guiid);

            Console.WriteLine(title);
            string input = Console.ReadLine();

            Marshal.Copy(AqHelper.StringToByteArray(input), 0, buffer, input.Length);
            return(0);
        }
Exemplo n.º 2
0
        // AqGui stuff
        public int GetPassword(IntPtr gui, uint flags, string token, string title, string text, IntPtr buffer, int minLen, int maxLen, uint guiid)
        {
            log.DebugFormat("title: {0}, token: {1}, text; {2}", title, token, text);

            if (string.IsNullOrEmpty(Pin))
            {
                throw new Exception("no pin set for noninteractive mode");
            }

            if (title == "PIN-Eingabe" || title == "Enter PIN")
            {
                log.Debug("Copying pre-saved Pin");
                Marshal.Copy(AqHelper.StringToByteArray(this.Pin), 0, buffer, this.Pin.Length);
            }
            else
            {
                throw new System.Exception("unknown GetPassword dialog");
            }
            return(0);
        }
Exemplo n.º 3
0
        public int GetPassword(IntPtr gui, uint flags, string token, string title, string text, IntPtr buffer, int minLen, int maxLen, uint guiid)
        {
            log.DebugFormat("title: {0}, token: {1}, text; {2}", title, token, text);

            string input;

            if (PasswordBuffer [token] != null)
            {
                log.Debug("using buffered password");
                input = (string)PasswordBuffer [token];
            }
            else
            {
                Console.WriteLine(title);
                Console.WriteLine(text);
                input = Console.ReadLine();
                PasswordBuffer [token] = input;
            }
            Marshal.Copy(AqHelper.StringToByteArray(input), 0, buffer, input.Length);
            return(0);
        }