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


C# PwUuid.ToHexString方法代码示例

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


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

示例1: PrepareSave

        private void PrepareSave()
        {
            m_trl.Properties.Application = PwDefs.ProductName;
            m_trl.Properties.ApplicationVersion = PwDefs.VersionString;
            m_trl.Properties.Generator = "TrlUtil";

            PwUuid pwUuid = new PwUuid(true);
            m_trl.Properties.FileUuid = pwUuid.ToHexString();

            m_trl.Properties.LastModified = DateTime.Now.ToString("u");

            m_trl.UnusedText = m_rtbUnusedText.Text;

            try { Validate3Dots(); }
            catch(Exception) { Debug.Assert(false); }

            try
            {
                string strAccel = AccelKeysCheck.Validate(m_trl);
                if(strAccel != null)
                {
                    MessageService.ShowWarning("Warning! The following accelerator keys collide:",
                        strAccel, "Click OK to continue saving.");
                }
            }
            catch(Exception) { Debug.Assert(false); }
        }
开发者ID:ashwingj,项目名称:keepass2,代码行数:27,代码来源:MainForm.cs

示例2: PrepareSave

		private void PrepareSave()
		{
			m_trl.Properties.Application = PwDefs.ProductName;
			m_trl.Properties.ApplicationVersion = PwDefs.VersionString;
			m_trl.Properties.Generator = TrlUtilName;

			PwUuid pwUuid = new PwUuid(true);
			m_trl.Properties.FileUuid = pwUuid.ToHexString();

			m_trl.Properties.LastModified = DateTime.UtcNow.ToString("u");

			m_trl.UnusedText = m_rtbUnusedText.Text;
			if(!string.IsNullOrEmpty(m_trl.UnusedText))
				ShowValidationWarning(@"It is recommended to clear the 'Unused Text' tab.");

			try { Validate3Dots(); }
			catch(Exception) { Debug.Assert(false); }

			try
			{
				string strAccel = AccelKeysCheck.Validate(m_trl);
				if(strAccel != null)
					ShowValidationWarning("The following accelerator keys collide:" +
						MessageService.NewParagraph + strAccel);
			}
			catch(Exception) { Debug.Assert(false); }
		}
开发者ID:joshuadugie,项目名称:KeePass-2.x,代码行数:27,代码来源:MainForm.cs

示例3: OnKPDBOpen

        private void OnKPDBOpen(object sender, FileOpenedEventArgs e)
        {
            EnsureDBIconIsInKPRPCIconCache();

            // If we've not already upgraded the KPRPC data for this database...
            if (!e.Database.CustomData.Exists("KeePassRPC.KeeFox.configVersion")
                || e.Database.CustomData.Get("KeePassRPC.KeeFox.configVersion") != "1")
            {
                // We know that this upgrade path may contain duplicate KeeFox
                // sample entries due to an earlier bug so lets get rid of them
                // for good and replace them with a single instance of each. Not
                // a perfect solution but should only cause problems for KeeFox
                // developers and those with OCD and a short fuse.

                PwUuid pwuuid1 = new PwUuid(new byte[] {
                0xe9, 0x9f, 0xf2, 0xed, 0x05, 0x12, 0x47, 0x47,
                0xb6, 0x3e, 0xaf, 0xa5, 0x15, 0xa3, 0x04, 0x24});
                PwUuid pwuuid2 = new PwUuid(new byte[] {
                0xe8, 0x9f, 0xf2, 0xed, 0x05, 0x12, 0x47, 0x47,
                0xb6, 0x3e, 0xaf, 0xa5, 0x15, 0xa3, 0x04, 0x25});
                PwUuid pwuuid3 = new PwUuid(new byte[] {
                0xe7, 0x9f, 0xf2, 0xed, 0x05, 0x12, 0x47, 0x47,
                0xb6, 0x3e, 0xaf, 0xa5, 0x15, 0xa3, 0x04, 0x26});
                PwUuid pwuuid4 = new PwUuid(new byte[] {
                0xe6, 0x9f, 0xf2, 0xed, 0x05, 0x12, 0x47, 0x47,
                0xb6, 0x3e, 0xaf, 0xa5, 0x15, 0xa3, 0x04, 0x27});
                PwUuid pwuuid5 = new PwUuid(new byte[] {
                0xe5, 0x9f, 0xf2, 0xed, 0x05, 0x12, 0x47, 0x47,
                0xb6, 0x3e, 0xaf, 0xa5, 0x15, 0xa3, 0x04, 0x28});

                List<string> uuids = new List<string>(5);
                uuids.Add(pwuuid1.ToHexString());
                uuids.Add(pwuuid2.ToHexString());
                uuids.Add(pwuuid3.ToHexString());
                uuids.Add(pwuuid4.ToHexString());
                uuids.Add(pwuuid5.ToHexString());

                KeePassLib.Collections.PwObjectList<PwEntry> output = new KeePassLib.Collections.PwObjectList<PwEntry>();

                // Scan every entry for matching UUIDs and add them to the list for deletion
                KeePassLib.Delegates.EntryHandler ehdup = delegate(PwEntry pe)
                {
                    if (uuids.Contains(pe.Uuid.ToHexString()))
                    {
                        output.Add(pe);
                    }
                    return true;
                };
                e.Database.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, ehdup);

                // Tidy up
                if (output.UCount > 0)
                {
                    foreach (PwEntry pwe in output)
                    {
                        pwe.ParentGroup.Entries.Remove(pwe);
                    }
                    InstallKeeFoxSampleEntries(e.Database, true);
                    _host.MainWindow.UpdateUI(false, null, true, null, true, null, true);
                }

                bool foundStringsToUpgrade = false;
                // Scan every string of every entry to find out whether we need to disturb the user
                KeePassLib.Delegates.EntryHandler eh = delegate(PwEntry pe)
                {
                    foreach (KeyValuePair<string, ProtectedString> kvp in pe.Strings)
                    {
                        if (StringIsFromKPRPCv1(kvp.Key))
                        {
                            foundStringsToUpgrade = true;
                            // Cancel our search, we have the answer (unfortunately we can only cancel the search in this group so more organised users will have to wait a little longer)
                            return false;
                        }
                    }
                    return true;
                };

                // If our search is aborted before the end it's becuase we found a string that needs upgrading
                e.Database.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, eh);
                if (foundStringsToUpgrade)
                {
                    DialogResult dr = MessageBox.Show("KeePassRPC (KeeFox) needs to update your database. This process is safe but irreversible so it is strongly recommended that you ensure you have a recent backup of your password database before you continue." + Environment.NewLine + Environment.NewLine + "You can take a backup right now if you want: just find the database file on your system and copy (not move) it to a safe place. The database you are trying to open is located at " + e.Database.IOConnectionInfo.Path + "." + Environment.NewLine + Environment.NewLine + "You will not be able to use this database with older versions of KeeFox once you click OK. Make sure you hold onto your backup copy until you're happy that the upgrade process was successful." + Environment.NewLine + Environment.NewLine + "Press OK to perform the upgrade.", "KeeFox upgrade", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (dr != DialogResult.OK)
                    {
                        // User aborted so we must shut down this database to prevent KeeFox from attempting communication with it
                        e.Database.Close();
                        _host.MainWindow.DocumentManager.CloseDatabase(e.Database);
                        _host.MainWindow.DocumentManager.ActiveDatabase.UINeedsIconUpdate = true;
                        _host.MainWindow.UpdateUI(true, null, true, null, true, null, false);
                        _host.MainWindow.ResetDefaultFocus(null);
                        DialogResult dr2 = MessageBox.Show("KeePassRPC has NOT upgraded your database. The database has been closed to protect it from damage." + Environment.NewLine + Environment.NewLine + "It is safe to use this database with older versions of KeeFox but you can not use it with this version until you re-open it and perform the upgrade.", "KeeFox upgrade cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        // User has confirmed they have a recent backup so we start the upgrade

                        // Scan every string of every entry to find entries we will update
                        KeePassLib.Delegates.EntryHandler ehupgrade = delegate(PwEntry pe)
                        {
//.........这里部分代码省略.........
开发者ID:TheDesignerOfThings,项目名称:KeeFox,代码行数:101,代码来源:KeePassRPCExt.cs

示例4: PrepareSave

        private void PrepareSave()
        {
            m_trl.Properties.Application = PwDefs.ProductName;
            m_trl.Properties.ApplicationVersion = PwDefs.VersionString;
            m_trl.Properties.Generator = "TrlUtil";

            PwUuid pwUuid = new PwUuid(true);
            m_trl.Properties.FileUuid = pwUuid.ToHexString();

            m_trl.Properties.LastModified = DateTime.Now.ToString("u");

            m_trl.UnusedText = m_rtbUnusedText.Text;
        }
开发者ID:jonbws,项目名称:strengthreport,代码行数:13,代码来源:MainForm.cs


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