当前位置: 首页>>代码示例>>C#>>正文


C# PwEntry类代码示例

本文整理汇总了C#中PwEntry的典型用法代码示例。如果您正苦于以下问题:C# PwEntry类的具体用法?C# PwEntry怎么用?C# PwEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PwEntry类属于命名空间,在下文中一共展示了PwEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Copy

		public static bool Copy(ProtectedString psToCopy, bool bIsEntryInfo,
			PwEntry peEntryInfo, PwDatabase pwReferenceSource)
		{
			if(psToCopy == null) throw new ArgumentNullException("psToCopy");
			return Copy(psToCopy.ReadString(), true, bIsEntryInfo, peEntryInfo,
				pwReferenceSource, IntPtr.Zero);
		}
开发者ID:dbremner,项目名称:keepass2,代码行数:7,代码来源:ClipboardUtil.cs

示例2: ProcessCsvLine

		private static void ProcessCsvLine(string strLine, PwDatabase pwStorage)
		{
			List<string> list = ImportUtil.SplitCsvLine(strLine, ",");
			Debug.Assert(list.Count == 5);

			PwEntry pe = new PwEntry(true, true);
			pwStorage.RootGroup.AddEntry(pe, true);

			if(list.Count == 5)
			{
				pe.Strings.Set(PwDefs.TitleField, new ProtectedString(
					pwStorage.MemoryProtection.ProtectTitle,
					ProcessCsvWord(list[0])));
				pe.Strings.Set(PwDefs.UserNameField, new ProtectedString(
					pwStorage.MemoryProtection.ProtectUserName,
					ProcessCsvWord(list[1])));
				pe.Strings.Set(PwDefs.PasswordField, new ProtectedString(
					pwStorage.MemoryProtection.ProtectPassword,
					ProcessCsvWord(list[2])));
				pe.Strings.Set(PwDefs.UrlField, new ProtectedString(
					pwStorage.MemoryProtection.ProtectUrl,
					ProcessCsvWord(list[3])));
				pe.Strings.Set(PwDefs.NotesField, new ProtectedString(
					pwStorage.MemoryProtection.ProtectNotes,
					ProcessCsvWord(list[4])));
			}
			else throw new FormatException("Invalid field count!");
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:28,代码来源:PwKeeperCsv70.cs

示例3: SetEntry

                public void SetEntry(PwEntry e)
                {
                    KpDatabase = new PwDatabase();
                    KpDatabase.New(new IOConnectionInfo(), new CompositeKey());

                    KpDatabase.RootGroup.AddEntry(e, true);
                }
开发者ID:pythe,项目名称:wristpass,代码行数:7,代码来源:App.cs

示例4: AddItem

        private static void AddItem(PwEntry pe)
        {
            if(pe == null) { Debug.Assert(false); return; }

            ToolStripMenuItem tsmi = new ToolStripMenuItem(pe.Strings.ReadSafe(
                PwDefs.TitleField));
            tsmi.Tag = pe;
            tsmi.Click += OnMenuExecute;

            Image img = null;
            PwDatabase pd = Program.MainForm.ActiveDatabase;
            if(pd != null)
            {
                if(!pe.CustomIconUuid.EqualsValue(PwUuid.Zero))
                    img = pd.GetCustomIcon(pe.CustomIconUuid);
                if(img == null)
                {
                    try { img = Program.MainForm.ClientIcons.Images[(int)pe.IconId]; }
                    catch(Exception) { Debug.Assert(false); }
                }
            }
            if(img == null) img = Properties.Resources.B16x16_KGPG_Key1;
            tsmi.Image = img;

            m_btnItemsHost.DropDownItems.Add(tsmi);
            m_vToolStripItems.Add(tsmi);
        }
开发者ID:elitak,项目名称:keepass,代码行数:27,代码来源:EntryTemplates.cs

示例5: PwEntryView

        private PwEntryView(GroupBaseActivity groupActivity, PwEntry pw, int pos)
            : base(groupActivity)
        {
            _groupActivity = groupActivity;

            View ev = Inflate(groupActivity, Resource.Layout.entry_list_entry, null);
            _textView = (TextView)ev.FindViewById(Resource.Id.entry_text);
            _textView.TextSize = PrefsUtil.GetListTextSize(groupActivity);

            _textviewDetails = (TextView)ev.FindViewById(Resource.Id.entry_text_detail);
            _textviewDetails.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity);

            _textgroupFullPath = (TextView)ev.FindViewById(Resource.Id.group_detail);
            _textgroupFullPath.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity);

            _showDetail = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean(
                groupActivity.GetString(Resource.String.ShowUsernameInList_key),
                Resources.GetBoolean(Resource.Boolean.ShowUsernameInList_default));

            _showGroupFullPath = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean(
                groupActivity.GetString(Resource.String.ShowGroupnameInSearchResult_key),
                Resources.GetBoolean(Resource.Boolean.ShowGroupnameInSearchResult_default));

            _isSearchResult = _groupActivity is keepass2android.search.SearchResults;

            PopulateView(ev, pw, pos);

            LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);

            AddView(ev, lp);
        }
开发者ID:pythe,项目名称:wristpass,代码行数:31,代码来源:PwEntryView.cs

示例6: Copy

		public static bool Copy(ProtectedString psToCopy, bool bIsEntryInfo,
			PwEntry peEntryInfo, PwDatabase pwReferenceSource)
		{
			Debug.Assert(psToCopy != null);
			if(psToCopy == null) throw new ArgumentNullException("psToCopy");

			if(bIsEntryInfo && !AppPolicy.Try(AppPolicyId.CopyToClipboard))
				return false;

			string strData = SprEngine.Compile(psToCopy.ReadString(), false,
				peEntryInfo, pwReferenceSource, false, false);

			try
			{
				ClipboardUtil.Clear();

				DataObject doData = CreateProtectedDataObject(strData);
				Clipboard.SetDataObject(doData);

				m_pbDataHash32 = HashClipboard();
				m_strFormat = null;

				RaiseCopyEvent(bIsEntryInfo, strData);
			}
			catch(Exception) { Debug.Assert(false); return false; }

			if(peEntryInfo != null) peEntryInfo.Touch(false);

			// SprEngine.Compile might have modified the database
			Program.MainForm.UpdateUI(false, null, false, null, false, null, false);

			return true;
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:33,代码来源:ClipboardUtil.cs

示例7: DeleteEntry

 public DeleteEntry(Context ctx, IKp2aApp app, PwEntry entry, OnFinish finish)
     : base(finish, app)
 {
     Ctx = ctx;
     Db = app.GetDb();
     _entry = entry;
 }
开发者ID:pythe,项目名称:wristpass,代码行数:7,代码来源:DeleteEntry.cs

示例8: FillPlaceholders

        public static string FillPlaceholders(string strText, PwEntry pe,
            SprContentFlags cf)
        {
            if(pe == null) return strText;

            string str = strText;

            if(str.ToUpper().IndexOf(@"{PICKPASSWORDCHARS}") >= 0)
            {
                ProtectedString ps = pe.Strings.Get(PwDefs.PasswordField);
                if(ps != null)
                {
                    byte[] pb = ps.ReadUtf8();
                    bool bNotEmpty = (pb.Length > 0);
                    Array.Clear(pb, 0, pb.Length);

                    if(bNotEmpty)
                    {
                        CharPickerForm cpf = new CharPickerForm();
                        cpf.InitEx(ps, true, true);

                        if(cpf.ShowDialog() == DialogResult.OK)
                        {
                            str = StrUtil.ReplaceCaseInsensitive(str, @"{PICKPASSWORDCHARS}",
                                SprEngine.TransformContent(cpf.SelectedCharacters.ReadString(), cf));
                        }
                    }
                }

                str = StrUtil.ReplaceCaseInsensitive(str, @"{PICKPASSWORDCHARS}", string.Empty);
            }

            return str;
        }
开发者ID:jonbws,项目名称:strengthreport,代码行数:34,代码来源:EntryUtil.cs

示例9: AfterUpdate

 public AfterUpdate(PwEntry backup, PwEntry updatedEntry, IKp2aApp app, OnFinish finish)
     : base(finish)
 {
     _backup = backup;
     _updatedEntry = updatedEntry;
     _app = app;
 }
开发者ID:pythe,项目名称:wristpass,代码行数:7,代码来源:UpdateEntry.cs

示例10: WriteEntries

        /// <summary>
        /// Write entries to a stream.
        /// </summary>
        /// <param name="msOutput">Output stream to which the entries will be written.</param>
        /// <param name="pwDatabase">Source database.</param>
        /// <param name="vEntries">Entries to serialize.</param>
        /// <returns>Returns <c>true</c>, if the entries were written successfully to the stream.</returns>
        public static bool WriteEntries(Stream msOutput, PwDatabase pwDatabase, PwEntry[] vEntries)
        {
            Kdb4File f = new Kdb4File(pwDatabase);
            f.m_format = Kdb4Format.PlainXml;

            XmlTextWriter xtw = null;
            try { xtw = new XmlTextWriter(msOutput, Encoding.UTF8); }
            catch(Exception) { Debug.Assert(false); return false; }
            if(xtw == null) { Debug.Assert(false); return false; }

            f.m_xmlWriter = xtw;

            xtw.Formatting = Formatting.Indented;
            xtw.IndentChar = '\t';
            xtw.Indentation = 1;

            xtw.WriteStartDocument(true);
            xtw.WriteStartElement(ElemRoot);

            foreach(PwEntry pe in vEntries)
                f.WriteEntry(pe, false);

            xtw.WriteEndElement();
            xtw.WriteEndDocument();

            xtw.Flush();
            xtw.Close();
            return true;
        }
开发者ID:jonbws,项目名称:strengthreport,代码行数:36,代码来源:Kdb4File.Write.cs

示例11: Copy

        public static bool Copy(string strToCopy, bool bIsEntryInfo,
            PwEntry peEntryInfo, PwDatabase pwReferenceSource)
        {
            Debug.Assert(strToCopy != null);
            if(strToCopy == null) throw new ArgumentNullException("strToCopy");

            if(bIsEntryInfo && !AppPolicy.Try(AppPolicyId.CopyToClipboard))
                return false;

            string strData = SprEngine.Compile(strToCopy, false, peEntryInfo,
                pwReferenceSource, false, false);

            try
            {
                Clipboard.Clear();

                DataObject doData = CreateProtectedDataObject(strData);
                Clipboard.SetDataObject(doData);

                m_pbDataHash32 = HashClipboard();
                m_strFormat = null;
            }
            catch(Exception) { Debug.Assert(false); return false; }

            return true;
        }
开发者ID:jonbws,项目名称:strengthreport,代码行数:26,代码来源:ClipboardUtil.cs

示例12: AddItem

		private static void AddItem(PwEntry pe)
		{
			if(pe == null) { Debug.Assert(false); return; }

			string strText = StrUtil.EncodeMenuText(pe.Strings.ReadSafe(
				PwDefs.TitleField));
			ToolStripMenuItem tsmi = new ToolStripMenuItem(strText);
			tsmi.Tag = pe;
			tsmi.Click += OnMenuExecute;

			Image img = null;
			PwDatabase pd = Program.MainForm.DocumentManager.SafeFindContainerOf(pe);
			if(pd != null)
			{
				if(!pe.CustomIconUuid.Equals(PwUuid.Zero))
					img = DpiUtil.GetIcon(pd, pe.CustomIconUuid);
				if(img == null)
				{
					try { img = Program.MainForm.ClientIcons.Images[(int)pe.IconId]; }
					catch(Exception) { Debug.Assert(false); }
				}
			}
			if(img == null) img = Properties.Resources.B16x16_KGPG_Key1;
			tsmi.Image = img;

			m_btnItemsHost.DropDownItems.Add(tsmi);
			m_vToolStripItems.Add(tsmi);
		}
开发者ID:riking,项目名称:go-keepass2,代码行数:28,代码来源:EntryTemplates.cs

示例13: GetCellData

            /// <summary>
            /// Tells KeePass what to display in the column.
            /// </summary>
            /// <param name="strColumnName"></param>
            /// <param name="pe"></param>
            /// <returns>String displayed in the columns.</returns>
            public override string GetCellData(string strColumnName, PwEntry pe)
            {
                if (strColumnName == null) throw new ArgumentNullException("strColumnName");
                if (pe == null) throw new ArgumentNullException("pe");
                if (plugin.SettingsCheck(pe) && plugin.SeedCheck(pe))
                {
                    bool ValidInterval;
                    bool ValidLength;
                    bool ValidUrl;
                    if (plugin.SettingsValidate(pe, out ValidInterval, out ValidLength, out ValidUrl))
                    {
                        string[] Settings = plugin.SettingsGet(pe);

                        TOTPProvider TOTPGenerator = new TOTPProvider(Settings, ref plugin.TimeCorrections);

                        if (plugin.SeedValidate(pe))
                        {
                            return TOTPGenerator.GenerateByByte(
                                Base32.Decode(plugin.SeedGet(pe).ReadString().ExtWithoutSpaces())) + (m_host.CustomConfig.GetBool(setname_bool_TOTPColumnTimer_Visible, true) ? TOTPGenerator.Timer.ToString().ExtWithParenthesis().ExtWithSpaceBefore() : string.Empty);
                        }
                        return TrayTOTP_CustomColumn_Localization.strWarningBadSeed;
                    }
                    return TrayTOTP_CustomColumn_Localization.strWarningBadSet;
                }
                return (plugin.SettingsCheck(pe) || plugin.SeedCheck(pe) ? TrayTOTP_CustomColumn_Localization.strWarningStorage : string.Empty);
            }
开发者ID:victor-rds,项目名称:KeeTrayTOTP,代码行数:32,代码来源:TrayTOTP_CustomColumn.cs

示例14: ApplyTo

        // public bool CopyHistory
        // {
        //    get { return m_bCopyHistory; }
        // }
        public void ApplyTo(PwEntry peNew, PwEntry pe, PwDatabase pd)
        {
            if((peNew == null) || (pe == null)) { Debug.Assert(false); return; }

            Debug.Assert(peNew.Strings.ReadSafe(PwDefs.UserNameField) ==
                pe.Strings.ReadSafe(PwDefs.UserNameField));
            Debug.Assert(peNew.Strings.ReadSafe(PwDefs.PasswordField) ==
                pe.Strings.ReadSafe(PwDefs.PasswordField));

            if(m_bAppendCopy && (pd != null))
            {
                string strTitle = peNew.Strings.ReadSafe(PwDefs.TitleField);
                peNew.Strings.Set(PwDefs.TitleField, new ProtectedString(
                    pd.MemoryProtection.ProtectTitle, strTitle + " - " +
                    KPRes.CopyOfItem));
            }

            if(m_bFieldRefs && (pd != null))
            {
                string strUser = @"{REF:[email protected]:" + pe.Uuid.ToHexString() + @"}";
                peNew.Strings.Set(PwDefs.UserNameField, new ProtectedString(
                    pd.MemoryProtection.ProtectUserName, strUser));

                string strPw = @"{REF:[email protected]:" + pe.Uuid.ToHexString() + @"}";
                peNew.Strings.Set(PwDefs.PasswordField, new ProtectedString(
                    pd.MemoryProtection.ProtectPassword, strPw));
            }

            if(!m_bCopyHistory)
                peNew.History = new PwObjectList<PwEntry>();
        }
开发者ID:haro-freezd,项目名称:KeePass,代码行数:35,代码来源:DuplicationForm.cs

示例15: hasFields

 public static bool hasFields(PwEntry entry)
 {
     foreach (KeyValuePair<string, ProtectedString> kvpStr in entry.Strings)
     {
         if (!PwDefs.IsStandardField(kvpStr.Key)) return true;
     }
     return false;
 }
开发者ID:nein23,项目名称:KeePassContext,代码行数:8,代码来源:Util.cs


注:本文中的PwEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。