示例#1
0
        internal string[] GetUserPass(PwEntryDatabase entryDatabase)
        {
            // follow references
            SprContext ctx = new SprContext(entryDatabase.entry, entryDatabase.database,
                                            SprCompileFlags.All, false, false);

            return(GetUserPass(entryDatabase, ctx));
        }
示例#2
0
        internal string[] GetUserPass(PwEntryDatabase entryDatabase, SprContext ctx)
        {
            // follow references
            string user = SprEngine.Compile(
                entryDatabase.entry.Strings.ReadSafe(PwDefs.UserNameField), ctx);
            string pass = SprEngine.Compile(
                entryDatabase.entry.Strings.ReadSafe(PwDefs.PasswordField), ctx);
            var f = (MethodInvoker) delegate
            {
                // apparently, SprEngine.Compile might modify the database
                HostInstance.MainWindow.UpdateUI(false, null, false, null, false, null, false);
            };

            if (HostInstance.MainWindow.InvokeRequired)
            {
                HostInstance.MainWindow.Invoke(f);
            }
            else
            {
                f.Invoke();
            }

            return(new string[] { user, pass });
        }
示例#3
0
        internal string GetTotpSettings(PwEntry entry)
        {
            PwEntryDatabase entryDatabase = new PwEntryDatabase(entry, HostInstance.Database);
            SprContext      ctx           = new SprContext(entryDatabase.entry, entryDatabase.database,
                                                           SprCompileFlags.All, false, false);

            string settings = SprEngine.Compile(entryDatabase.entry.Strings.ReadSafe("otp"), ctx);
            var    f        = (MethodInvoker) delegate
            {
                // apparently, SprEngine.Compile might modify the database
                HostInstance.MainWindow.UpdateUI(false, null, false, null, false, null, false);
            };

            if (HostInstance.MainWindow.InvokeRequired)
            {
                HostInstance.MainWindow.Invoke(f);
            }
            else
            {
                f.Invoke();
            }

            return(settings);
        }