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


C# IStatusLogger.SetProgress方法代码示例

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


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

示例1: SetStatus

 public static bool SetStatus(IStatusLogger slLogger, uint uPercent)
 {
     if(slLogger != null) return slLogger.SetProgress(uPercent);
     else return true;
 }
开发者ID:elitak,项目名称:keepass,代码行数:5,代码来源:ImportUtil.cs

示例2: ExportGroup

        private static void ExportGroup(PwGroup pg, string strDir, IStatusLogger slLogger,
            uint uTotalEntries, ref uint uEntriesProcessed)
        {
            foreach(PwEntry pe in pg.Entries)
            {
                ExportEntry(pe, strDir);

                ++uEntriesProcessed;
                if(slLogger != null)
                    slLogger.SetProgress(((uEntriesProcessed * 50U) /
                        uTotalEntries) + 50U);
            }

            foreach(PwGroup pgSub in pg.Groups)
            {
                string strGroup = UrlUtil.FilterFileName(pgSub.Name);
                string strSub = (UrlUtil.EnsureTerminatingSeparator(strDir, false) +
                    (!string.IsNullOrEmpty(strGroup) ? strGroup : KPRes.Group));

                ExportGroup(pgSub, strSub, slLogger, uTotalEntries, ref uEntriesProcessed);
            }
        }
开发者ID:ashwingj,项目名称:keepass2,代码行数:22,代码来源:WinFavorites10.cs

示例3: DeletePreviousExport

        private static void DeletePreviousExport(string strDir, IStatusLogger slLogger)
        {
            List<string> vDirsToDelete = new List<string>();

            try
            {
                string[] vFiles = Directory.GetFiles(strDir, "*.url",
                    SearchOption.AllDirectories);

                for(int iFile = 0; iFile < vFiles.Length; ++iFile)
                {
                    string strFile = vFiles[iFile];
                    try
                    {
                        IniFile ini = IniFile.Read(strFile, Encoding.Default);
                        string strType = ini.Get(PwDefs.ShortProductName, IniTypeKey);
                        if((strType != null) && (strType == IniTypeValue))
                        {
                            File.Delete(strFile);

                            string strCont = UrlUtil.GetFileDirectory(strFile, false, true);
                            if(vDirsToDelete.IndexOf(strCont) < 0)
                                vDirsToDelete.Add(strCont);
                        }
                    }
                    catch(Exception) { Debug.Assert(false); }

                    if(slLogger != null)
                        slLogger.SetProgress(((uint)iFile * 50U) / (uint)vFiles.Length);
                }

                bool bDeleted = true;
                while(bDeleted)
                {
                    bDeleted = false;

                    for(int i = (vDirsToDelete.Count - 1); i >= 0; --i)
                    {
                        try
                        {
                            Directory.Delete(vDirsToDelete[i]);
                            WaitForDirCommit(vDirsToDelete[i], false);

                            vDirsToDelete.RemoveAt(i);
                            bDeleted = true;
                        }
                        catch(Exception) { } // E.g. not empty
                    }
                }
            }
            catch(Exception) { Debug.Assert(false); }
        }
开发者ID:ashwingj,项目名称:keepass2,代码行数:52,代码来源:WinFavorites10.cs

示例4: Import

        public override void Import(PwDatabase pwStorage, Stream sInput,
            IStatusLogger slLogger)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(sInput);

            XmlNode xmlRoot = xmlDoc.DocumentElement;
            Debug.Assert(xmlRoot.Name == ElemRoot);

            Stack<PwGroup> vGroups = new Stack<PwGroup>();
            vGroups.Push(pwStorage.RootGroup);

            int nNodeCount = xmlRoot.ChildNodes.Count;
            for(int i = 0; i < nNodeCount; ++i)
            {
                XmlNode xmlChild = xmlRoot.ChildNodes[i];

                if(xmlChild.Name == ElemGroup)
                    ReadGroup(xmlChild, vGroups, pwStorage);
                else { Debug.Assert(false); }

                if(slLogger != null)
                    slLogger.SetProgress((uint)(((i + 1) * 100) / nNodeCount));
            }
        }
开发者ID:eis,项目名称:keepass-eis-flavored,代码行数:25,代码来源:KeePassXXml041.cs

示例5: Import

        public override void Import(PwDatabase pwStorage, Stream sInput,
            IStatusLogger slLogger)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(sInput);

            XmlNode xmlRoot = xmlDoc.DocumentElement;
            Debug.Assert(xmlRoot.Name == ElemRoot);

            Dictionary<string, PwGroup> dictGroups = new Dictionary<string, PwGroup>();
            int nNodeCount = xmlRoot.ChildNodes.Count;

            for(int i = 0; i < nNodeCount; ++i)
            {
                XmlNode xmlChild = xmlRoot.ChildNodes[i];

                if(xmlChild.Name == ElemEntry)
                    ReadEntry(xmlChild, pwStorage, dictGroups);
                else { Debug.Assert(false); }

                if(slLogger != null)
                    slLogger.SetProgress((uint)(((i + 1) * 100) / nNodeCount));
            }
        }
开发者ID:amiryal,项目名称:keepass2,代码行数:24,代码来源:KeePassXml1x.cs

示例6: DeletePreviousExport

		private static void DeletePreviousExport(string strDir, IStatusLogger slLogger)
		{
			List<string> vDirsToDelete = new List<string>();

			try
			{
				List<string> lUrlFiles = UrlUtil.GetFilePaths(strDir, "*.url",
					SearchOption.AllDirectories);
				List<string> lLnkFiles = UrlUtil.GetFilePaths(strDir, "*.lnk",
					SearchOption.AllDirectories);

				List<string> lFiles = new List<string>();
				lFiles.AddRange(lUrlFiles);
				lFiles.AddRange(lLnkFiles);

				for(int iFile = 0; iFile < lFiles.Count; ++iFile)
				{
					string strFile = lFiles[iFile];
					try
					{
						bool bDelete = false;

						if(strFile.EndsWith(".url", StrUtil.CaseIgnoreCmp))
						{
							IniFile ini = IniFile.Read(strFile, Encoding.Default);
							string strType = ini.Get(PwDefs.ShortProductName, IniTypeKey);
							bDelete = ((strType != null) && (strType == IniTypeValue));
						}
						else if(strFile.EndsWith(".lnk", StrUtil.CaseIgnoreCmp))
						{
							ShellLinkEx sl = ShellLinkEx.Load(strFile);
							if(sl != null)
								bDelete = ((sl.Description != null) &&
									sl.Description.EndsWith(LnkDescSuffix));
						}
						else { Debug.Assert(false); }

						if(bDelete)
						{
							File.Delete(strFile);

							string strCont = UrlUtil.GetFileDirectory(strFile, false, true);
							if(vDirsToDelete.IndexOf(strCont) < 0)
								vDirsToDelete.Add(strCont);
						}
					}
					catch(Exception) { Debug.Assert(false); }

					if(slLogger != null)
						slLogger.SetProgress(((uint)iFile * 50U) / (uint)lFiles.Count);
				}

				bool bDeleted = true;
				while(bDeleted)
				{
					bDeleted = false;

					for(int i = (vDirsToDelete.Count - 1); i >= 0; --i)
					{
						try
						{
							Directory.Delete(vDirsToDelete[i], false);
							WaitForDirCommit(vDirsToDelete[i], false);

							vDirsToDelete.RemoveAt(i);
							bDeleted = true;
						}
						catch(Exception) { } // E.g. not empty
					}
				}
			}
			catch(Exception) { Debug.Assert(false); }
		}
开发者ID:riking,项目名称:go-keepass2,代码行数:73,代码来源:WinFavorites10.cs


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