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


C# PwEntry.GetSize方法代码示例

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


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

示例1: GetEntryFieldEx

		private string GetEntryFieldEx(PwEntry pe, int iColumnID,
			bool bFormatForDisplay, out bool bRequestAsync)
		{
			List<AceColumn> l = Program.Config.MainWindow.EntryListColumns;
			if((iColumnID < 0) || (iColumnID >= l.Count))
			{
				Debug.Assert(false);
				bRequestAsync = false;
				return string.Empty;
			}

			AceColumn col = l[iColumnID];
			if(bFormatForDisplay && col.HideWithAsterisks)
			{
				bRequestAsync = false;
				return PwDefs.HiddenPassword;
			}

			string str;
			switch(col.Type)
			{
				case AceColumnType.Title: str = pe.Strings.ReadSafe(PwDefs.TitleField); break;
				case AceColumnType.UserName: str = pe.Strings.ReadSafe(PwDefs.UserNameField); break;
				case AceColumnType.Password: str = pe.Strings.ReadSafe(PwDefs.PasswordField); break;
				case AceColumnType.Url: str = pe.Strings.ReadSafe(PwDefs.UrlField); break;
				case AceColumnType.Notes:
					if(!bFormatForDisplay) str = pe.Strings.ReadSafe(PwDefs.NotesField);
					else str = StrUtil.MultiToSingleLine(pe.Strings.ReadSafe(PwDefs.NotesField));
					break;
				case AceColumnType.CreationTime: str = TimeUtil.ToDisplayString(pe.CreationTime); break;
				case AceColumnType.LastModificationTime: str = TimeUtil.ToDisplayString(pe.LastModificationTime); break;
				case AceColumnType.LastAccessTime: str = TimeUtil.ToDisplayString(pe.LastAccessTime); break;
				case AceColumnType.ExpiryTime:
					if(pe.Expires) str = TimeUtil.ToDisplayString(pe.ExpiryTime);
					else str = m_strNeverExpiresText;
					break;
				case AceColumnType.Uuid: str = pe.Uuid.ToHexString(); break;
				case AceColumnType.Attachment: str = pe.Binaries.KeysToString(); break;
				case AceColumnType.CustomString:
					if(!bFormatForDisplay) str = pe.Strings.ReadSafe(col.CustomName);
					else str = StrUtil.MultiToSingleLine(pe.Strings.ReadSafe(col.CustomName));
					break;
				case AceColumnType.PluginExt:
					if(!bFormatForDisplay) str = Program.ColumnProviderPool.GetCellData(col.CustomName, pe);
					else str = StrUtil.MultiToSingleLine(Program.ColumnProviderPool.GetCellData(col.CustomName, pe));
					break;
				case AceColumnType.OverrideUrl: str = pe.OverrideUrl; break;
				case AceColumnType.Tags:
					str = StrUtil.TagsToString(pe.Tags, true);
					break;
				case AceColumnType.ExpiryTimeDateOnly:
					if(pe.Expires) str = TimeUtil.ToDisplayStringDateOnly(pe.ExpiryTime);
					else str = m_strNeverExpiresText;
					break;
				case AceColumnType.Size:
					str = StrUtil.FormatDataSizeKB(pe.GetSize());
					break;
				case AceColumnType.HistoryCount:
					str = pe.History.UCount.ToString();
					break;
				case AceColumnType.AttachmentCount:
					uint uc = pe.Binaries.UCount;
					str = ((uc > 0) ? uc.ToString() : string.Empty);
					break;
				default: Debug.Assert(false); str = string.Empty; break;
			}

			if(Program.Config.MainWindow.EntryListShowDerefData)
			{
				switch(col.Type)
				{
					case AceColumnType.Title:
					case AceColumnType.UserName:
					case AceColumnType.Password:
					case AceColumnType.Url:
					case AceColumnType.Notes:
					case AceColumnType.CustomString:
						bRequestAsync = SprEngine.MightDeref(str);
						break;
					default: bRequestAsync = false; break;
				}

				if(!Program.Config.MainWindow.EntryListShowDerefDataAsync &&
					bRequestAsync)
				{
					PwListItem pli = new PwListItem(pe);
					str = AsyncPwListUpdate.SprCompileFn(str, pli);
					bRequestAsync = false;
				}
			}
			else bRequestAsync = false;

			return str;
		}
开发者ID:riking,项目名称:go-keepass2,代码行数:94,代码来源:MainForm_Functions.cs

示例2: PerformDefaultAction

		private void PerformDefaultAction(object sender, EventArgs e, PwEntry pe,
			int colID)
		{
			Debug.Assert(pe != null); if(pe == null) return;

			if(this.DefaultEntryAction != null)
			{
				CancelEntryEventArgs args = new CancelEntryEventArgs(pe, colID);
				this.DefaultEntryAction(sender, args);
				if(args.Cancel) return;
			}

			bool bCnt = false;

			AceColumn col = GetAceColumn(colID);
			AceColumnType colType = col.Type;
			switch(colType)
			{
				case AceColumnType.Title:
					if(PwDefs.IsTanEntry(pe)) OnEntryCopyPassword(sender, e);
					else OnEntryEdit(sender, e);
					break;
				case AceColumnType.UserName:
					OnEntryCopyUserName(sender, e);
					break;
				case AceColumnType.Password:
					OnEntryCopyPassword(sender, e);
					break;
				case AceColumnType.Url:
					PerformDefaultUrlAction(null, false);
					break;
				case AceColumnType.Notes:
					bCnt = ClipboardUtil.CopyAndMinimize(pe.Strings.GetSafe(
						PwDefs.NotesField), true, this, pe, m_docMgr.ActiveDatabase);
					break;
				case AceColumnType.CreationTime:
					bCnt = ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(
						pe.CreationTime), true, this, pe, null);
					break;
				case AceColumnType.LastModificationTime:
					bCnt = ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(
						pe.LastModificationTime), true, this, pe, null);
					break;
				case AceColumnType.LastAccessTime:
					bCnt = ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(
						pe.LastAccessTime), true, this, pe, null);
					break;
				case AceColumnType.ExpiryTime:
					if(pe.Expires)
						bCnt = ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(
							pe.ExpiryTime), true, this, pe, null);
					else
						bCnt = ClipboardUtil.CopyAndMinimize(m_strNeverExpiresText,
							true, this, pe, null);
					break;
				case AceColumnType.Attachment:
				case AceColumnType.AttachmentCount:
					PerformDefaultAttachmentAction();
					break;
				case AceColumnType.Uuid:
					bCnt = ClipboardUtil.CopyAndMinimize(pe.Uuid.ToHexString(),
						true, this, pe, null);
					break;
				case AceColumnType.CustomString:
					bCnt = ClipboardUtil.CopyAndMinimize(pe.Strings.ReadSafe(
						col.CustomName), true, this, pe, m_docMgr.ActiveDatabase);
					break;
				case AceColumnType.PluginExt:
					if(Program.ColumnProviderPool.SupportsCellAction(col.CustomName))
						Program.ColumnProviderPool.PerformCellAction(col.CustomName, pe);
					else
						bCnt = ClipboardUtil.CopyAndMinimize(
							Program.ColumnProviderPool.GetCellData(col.CustomName, pe),
							true, this, pe, m_docMgr.ActiveDatabase);
					break;
				case AceColumnType.OverrideUrl:
					bCnt = ClipboardUtil.CopyAndMinimize(pe.OverrideUrl,
						true, this, pe, null);
					break;
				case AceColumnType.Tags:
					bCnt = ClipboardUtil.CopyAndMinimize(StrUtil.TagsToString(pe.Tags, true),
						true, this, pe, null);
					break;
				case AceColumnType.ExpiryTimeDateOnly:
					if(pe.Expires)
						bCnt = ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayStringDateOnly(
							pe.ExpiryTime), true, this, pe, null);
					else
						bCnt = ClipboardUtil.CopyAndMinimize(m_strNeverExpiresText,
							true, this, pe, null);
					break;
				case AceColumnType.Size:
					bCnt = ClipboardUtil.CopyAndMinimize(StrUtil.FormatDataSizeKB(
						pe.GetSize()), true, this, pe, null);
					break;
				case AceColumnType.HistoryCount:
					EditSelectedEntry(true);
					break;
				default:
					Debug.Assert(false);
//.........这里部分代码省略.........
开发者ID:riking,项目名称:go-keepass2,代码行数:101,代码来源:MainForm_Functions.cs

示例3: GetEntryFieldEx

        private string GetEntryFieldEx(PwEntry pe, int iColumnID, bool bAsterisksIfHidden)
        {
            List<AceColumn> l = Program.Config.MainWindow.EntryListColumns;
            if ((iColumnID < 0) || (iColumnID >= l.Count)) { Debug.Assert(false); return string.Empty; }

            AceColumn col = l[iColumnID];
            if (bAsterisksIfHidden && col.HideWithAsterisks) return PwDefs.HiddenPassword;

            string str = string.Empty;
            switch (col.Type)
            {
                case AceColumnType.Title: str = pe.Strings.ReadSafe(PwDefs.TitleField); break;
                case AceColumnType.UserName: str = pe.Strings.ReadSafe(PwDefs.UserNameField); break;
                case AceColumnType.Password: str = pe.Strings.ReadSafe(PwDefs.PasswordField); break;
                case AceColumnType.Url: str = pe.Strings.ReadSafe(PwDefs.UrlField); break;
                case AceColumnType.Notes: str = pe.Strings.ReadSafe(PwDefs.NotesField); break;
                case AceColumnType.CreationTime: str = TimeUtil.ToDisplayString(pe.CreationTime); break;
                case AceColumnType.LastAccessTime: str = TimeUtil.ToDisplayString(pe.LastAccessTime); break;
                case AceColumnType.LastModificationTime: str = TimeUtil.ToDisplayString(pe.LastModificationTime); break;
                case AceColumnType.ExpiryTime:
                    if (pe.Expires) str = TimeUtil.ToDisplayString(pe.ExpiryTime);
                    else str = KPRes.NeverExpires;
                    break;
                case AceColumnType.Uuid: str = pe.Uuid.ToHexString(); break;
                case AceColumnType.Attachment: str = pe.Binaries.KeysToString(); break;
                case AceColumnType.CustomString:
                    str = pe.Strings.ReadSafe(col.CustomName);
                    break;
                case AceColumnType.PluginExt:
                    str = Program.ColumnProviderPool.GetCellData(col.CustomName, pe);
                    break;
                case AceColumnType.OverrideUrl: str = pe.OverrideUrl; break;
                case AceColumnType.Tags:
                    str = StrUtil.TagsToString(pe.Tags, true);
                    break;
                case AceColumnType.ExpiryTimeDateOnly:
                    if (pe.Expires) str = TimeUtil.ToDisplayStringDateOnly(pe.ExpiryTime);
                    else str = KPRes.NeverExpires;
                    break;
                case AceColumnType.Size:
                    str = StrUtil.FormatDataSizeKB(pe.GetSize());
                    break;
                case AceColumnType.HistoryCount:
                    str = pe.History.UCount.ToString();
                    break;
                default: Debug.Assert(false); break;
            }

            return str;
        }
开发者ID:iamkarlson,项目名称:keepass-quicksearch,代码行数:50,代码来源:SearchController.cs

示例4: GetEntryFieldEx

        private string GetEntryFieldEx(PwEntry pe, int iColumnID, bool bFormatForDisplay)
        {
            IList<EntryColumn> columns = configuration.AvailableColumns;

             if ((iColumnID < 0) || (iColumnID >= columns.Count)) {
            return string.Empty;
             }

             EntryColumn col = columns[iColumnID];
            //         if (bFormatForDisplay && col.HideWithAsterisks) {
            ////            bRequestAsync = false;
            //            return PwDefs.HiddenPassword;
            //         }

             string str;
             switch (col.ColumnType)
             {
             case ColumnType.Title:
            str = pe.Strings.ReadSafe (PwDefs.TitleField);
            break;
             case ColumnType.UserName:
            str = pe.Strings.ReadSafe (PwDefs.UserNameField);
            break;
             case ColumnType.Password:
            str = pe.Strings.ReadSafe (PwDefs.PasswordField);
            break;
             case ColumnType.Url:
            str = pe.Strings.ReadSafe (PwDefs.UrlField);
            break;
             case ColumnType.Notes:
            if (!bFormatForDisplay)
               str = pe.Strings.ReadSafe (PwDefs.NotesField);
            else
               str = StrUtil.MultiToSingleLine (pe.Strings.ReadSafe (PwDefs.NotesField));
            break;
             case ColumnType.CreationTime:
            str = TimeUtil.ToDisplayString (pe.CreationTime);
            break;
             case ColumnType.LastAccessTime:
            str = TimeUtil.ToDisplayString (pe.LastAccessTime);
            break;
             case ColumnType.LastModificationTime:
            str = TimeUtil.ToDisplayString (pe.LastModificationTime);
            break;
             case ColumnType.ExpiryTime:
            if (pe.Expires)
               str = TimeUtil.ToDisplayString (pe.ExpiryTime);
            else
               str = ""; //m_strNeverExpiresText;
            break;
             case ColumnType.Uuid:
            str = pe.Uuid.ToHexString ();
            break;
             case ColumnType.Attachment:
            str = pe.Binaries.KeysToString ();
            break;
            //         case ColumnType.CustomString:
            //            if (!bFormatForDisplay)
            //               str = pe.Strings.ReadSafe (col.CustomName);
            //            else
            //               str = StrUtil.MultiToSingleLine (pe.Strings.ReadSafe (col.CustomName));
            //            break;
             //case AceColumnType.PluginExt:
             //   if (!bFormatForDisplay) str = Program.ColumnProviderPool.GetCellData(col.CustomName, pe);
             //   else str = StrUtil.MultiToSingleLine(Program.ColumnProviderPool.GetCellData(col.CustomName, pe));
             //   break;
             case ColumnType.OverrideUrl:
            str = pe.OverrideUrl;
            break;
             case ColumnType.Tags:
            str = StrUtil.TagsToString (pe.Tags, true);
            break;
             case ColumnType.ExpiryTimeDateOnly:
            if (pe.Expires)
               str = TimeUtil.ToDisplayStringDateOnly (pe.ExpiryTime);
            else
               str = ""; //m_strNeverExpiresText;
            break;
             case ColumnType.Size:
            str = StrUtil.FormatDataSizeKB (pe.GetSize ());
            break;
             case ColumnType.HistoryCount:
            str = pe.History.UCount.ToString ();
            break;
             default:
            //Debug.Assert (false);
            str = string.Empty;
            break;
             }

             return str;
        }
开发者ID:enecciari,项目名称:mackeepass,代码行数:92,代码来源:DatabaseCommands.cs

示例5: GetEntryFieldEx

            internal static string GetEntryFieldEx(PwEntry pe, int iColumnID, bool bFormatForDisplay)
            {
                // Adapted variables
                string m_strNeverExpiresText = KPRes.NeverExpires;

                List<AceColumn> l = Program.Config.MainWindow.EntryListColumns;
                if ((iColumnID < 0) || (iColumnID >= l.Count)) { Debug.Assert(false); return string.Empty; }

                AceColumn col = l[iColumnID];
                // TODO Optionally PasswordChar *** during editing for protected strings
                if (bFormatForDisplay && col.HideWithAsterisks) return PwDefs.HiddenPassword;

                string str;
                switch (col.Type)
                {
                    case AceColumnType.Title: str = pe.Strings.ReadSafe(PwDefs.TitleField); break;
                    case AceColumnType.UserName: str = pe.Strings.ReadSafe(PwDefs.UserNameField); break;
                    case AceColumnType.Password: str = pe.Strings.ReadSafe(PwDefs.PasswordField); break;
                    case AceColumnType.Url: str = pe.Strings.ReadSafe(PwDefs.UrlField); break;
                    case AceColumnType.Notes:
                        if (!bFormatForDisplay) str = pe.Strings.ReadSafe(PwDefs.NotesField);
                        else str = StrUtil.MultiToSingleLine(pe.Strings.ReadSafe(PwDefs.NotesField));
                        break;
                    case AceColumnType.CreationTime: str = TimeUtil.ToDisplayString(pe.CreationTime); break;
                    case AceColumnType.LastAccessTime: str = TimeUtil.ToDisplayString(pe.LastAccessTime); break;
                    case AceColumnType.LastModificationTime: str = TimeUtil.ToDisplayString(pe.LastModificationTime); break;
                    case AceColumnType.ExpiryTime:
                        if (pe.Expires) str = TimeUtil.ToDisplayString(pe.ExpiryTime);
                        else str = m_strNeverExpiresText;
                        break;
                    case AceColumnType.Uuid: str = pe.Uuid.ToHexString(); break;
                    case AceColumnType.Attachment: str = pe.Binaries.KeysToString(); break;
                    case AceColumnType.CustomString:
                        if (!bFormatForDisplay) str = pe.Strings.ReadSafe(col.CustomName);
                        else str = StrUtil.MultiToSingleLine(pe.Strings.ReadSafe(col.CustomName));
                        break;
                    case AceColumnType.PluginExt:
                        if (!bFormatForDisplay) str = Program.ColumnProviderPool.GetCellData(col.CustomName, pe);
                        else str = StrUtil.MultiToSingleLine(Program.ColumnProviderPool.GetCellData(col.CustomName, pe));
                        break;
                    case AceColumnType.OverrideUrl: str = pe.OverrideUrl; break;
                    case AceColumnType.Tags:
                        str = StrUtil.TagsToString(pe.Tags, true);
                        break;
                    case AceColumnType.ExpiryTimeDateOnly:
                        if (pe.Expires) str = TimeUtil.ToDisplayStringDateOnly(pe.ExpiryTime);
                        else str = m_strNeverExpiresText;
                        break;
                    case AceColumnType.Size:
                        str = StrUtil.FormatDataSizeKB(pe.GetSize());
                        break;
                    case AceColumnType.HistoryCount:
                        str = pe.History.UCount.ToString();
                        break;
                    default: Debug.Assert(false); str = string.Empty; break;
                }

                return str;
            }
开发者ID:unforgiven512,项目名称:kpenhancedlistview,代码行数:59,代码来源:Util.cs


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