如何使用C#比较2 xml注册表备份 [英] how to compare between 2 xml registry backup using C#
本文介绍了如何使用C#比较2 xml注册表备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从两台电脑上取2 xml备份注册表
我在它们之间进行比较
i有错误
<? xml 版本 = 1.0 encoding = UTF-8 ? >
< 注册表 >
< k 名称 = HKEY_CURRENT_USER >
< k name = 软件 >
< k name = yahoo >
< k 名称 = pager >
< k <跨度 class =code-attribute> name = 个人资料 >
< v name = LastSkin value = Glossy Berry>< / v>
< v name = ViewSettings0 value = 00 00 00 00 00 00 00 00 type = REG_BINARY > < / v >
< v name = pref value = 连接>< / v>
< v name = Flags0 value = 00 00 00 00 00 00 00 00 类型 = REG_BINARY > < / v >
< v 名称 = WarnOnceFlags value = 0xffffffff 4294967295 ty pe = REG_DWORD > < / v >
< v 名称 = Flags1 value = ff ff ff ff ff ff ff ff ff type = REG_BINARY > < / v >
< k name = 提醒 > < / k >
< k name = 存档 > < / k >
< k name = 聊天跨度> >
< v 名称 = WordFilter value = 0x00000001 1 type = REG_DWORD > < / v >
< / k >
< k < span class =code-attribute> name = Launchcast > < / k >
< k 名称 = 插件 > < / k >
< k 名称 = RecentSearches > < / k >
< k name = 皮肤 >
< v 名称 = Default_SkinDir value = C:\Program Files \\ \\Yahoo \Messenger\skins\Default>!< / v>
< / k>
< k name = UI 设置 >
< v name = CC_Vitality_Compact value = 0x00000001 1 类型 = REG_DWORD > < / v >
< / k >
< / k >
< / k >
< / k >
< / k >
< / k >
< / registry >
< br $> b $ b
使用 Microsoft.XmlDiffPatch;
System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create( D:\\ diff.xml跨度>);
// XmlDiffOptions枚举中有许多可用选项
XmlDiff diff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder | XmlDiffOptions.IgnoreComments | XmlDiffOptions.IgnoreWhitespace | XmlDiffOptions.IgnoreXmlDecl | XmlDiffOptions.IgnorePI | XmlDiffOptions.IgnoreNamespaces | XmlDiffOptions.IgnorePrefixes | XmlDiffOptions.IgnoreDtd);
diff.Compare( @ D:\\ registrybackup。 xml, @ D:\\registrybackupthef.xml, true ,writer);
error
System.Xml.XmlException未处理
消息= ' 。,十六进制值 0x00, 是无效字符。行 8 ,位置 39 。
来源= System.Xml
LineNumber = 8
LinePosition = 39
SourceUri =
StackTrace:
at System。 System.Xml.XmlTextReaderImpl.Throw中的Xml.XmlTextReaderImpl.Throw(例外e)
( String res, String [] args)
在System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow( Int32 curPos,Char quoteChar,NodeData attr)
at System系统.Xml.XmlTextReaderImpl.ParseAlements()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent,XmlReader reader,< span class =code-sdkkeyword> Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent,XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent,XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes (XmlDiffParentNode parent,XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent,XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent,XmlReader reader, Boolean bEmptyElement)
在Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiff) ParentNode parent,XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.Load(XmlReader reader,XmlHash xmlHash)
at Microsoft.XmlDiffPatch .XmlDiff.Compare(XmlReader sourceReader,XmlReader changedReader,XmlWriter diffgramWriter)
at Microsoft.XmlDiffPatch.XmlDiff.Compare( String sourceFile, String changedFile, Boolean bFragments,XmlWriter diffgramWriter)
at yahoo.Form1.button1_Click(对象发件人,EventArgs e)在 C:\ Users \Sirhirbaz \documents\visual studio 2010 \Projects\yahoo\\ \\ yahoo\Form1.cs:在System.Windows上的System.Windows.Forms.Control.OnClick(EventArgs e)
处的行 31
.Forms.Button.OnClick(EventArgs e) System.Windows.Forms.OnMouseUp(MouseEventArgs mevent)
在System.Windows.Forms.Control.WmMouseUp上的
(消息& m,MouseButtons按钮, Int32 点击)System.Windows上System.Windows.Forms.Control.WndProc(Message& m)
的
。 Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback( IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop( IntPtr dwComponentID, Int32 原因, Int32 pvLoopData)
在System.Windows.Forms.Application .ThreadContext.RunMessageLoopInner( Int32 reason,ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop( Int32 原因,ApplicationContext上下文)
at System.Windows.Forms.Application.Run(Form mainForm)
at yahoo.Program.Main() in C:\ Users \Sirhirbaz \documents\visual studio 2010 \Projects \yahoo\yahoo\Program.cs:line 18
在System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly , String [] args )System.AppDomain.ExecuteAssembly的
( String asse mblyFile,Evidence assemblySecurity, String [] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper .ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,对象状态)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
解决方案
请参考以下链接:
十六进制值0-IS-无效字符
十六进制值0x00,是无效字符
如果他们帮助您找到解决方案,请不要忘记将有用的回复标记为答案。 :)
i take 2 xml backup registry from two pc
when i compare between them
i have that error
<?xml version="1.0" encoding="UTF-8"?>
<registry>
<k name="HKEY_CURRENT_USER">
<k name="SOFTWARE">
<k name="yahoo">
<k name="pager">
<k name="profiles">
<v name="LastSkin" value="Glossy Berry></v>
<v name="ViewSettings0" value="00 00 00 00 00 00 00 00" type="REG_BINARY"></v>
<v name="pref" value="Connection></v>
<v name="Flags0" value="00 00 00 00 00 00 00 00" type="REG_BINARY"></v>
<v name="WarnOnceFlags" value="0xffffffff 4294967295" type="REG_DWORD"></v>
<v name="Flags1" value="ff ff ff ff ff ff ff ff" type="REG_BINARY"></v>
<k name="Alerts"></k>
<k name="Archive"></k>
<k name="Chat">
<v name="WordFilter" value="0x00000001 1" type="REG_DWORD"></v>
</k>
<k name="Launchcast"></k>
<k name="Plugins"></k>
<k name="RecentSearches"></k>
<k name="Skins">
<v name="Default_SkinDir" value="C:\Program Files\Yahoo!\Messenger\skins\Default></v>
</k>
<k name="UI Settings">
<v name="CC_Vitality_Compact" value="0x00000001 1" type="REG_DWORD"></v>
</k>
</k>
</k>
</k>
</k>
</k>
</registry>
using Microsoft.XmlDiffPatch;
System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create("D:\\diff.xml");
// There are a number of available options in the XmlDiffOptions enum
XmlDiff diff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder | XmlDiffOptions.IgnoreComments | XmlDiffOptions.IgnoreWhitespace | XmlDiffOptions.IgnoreXmlDecl | XmlDiffOptions.IgnorePI | XmlDiffOptions.IgnoreNamespaces | XmlDiffOptions.IgnorePrefixes | XmlDiffOptions.IgnoreDtd);
diff.Compare(@"D:\\registrybackup.xml", @"D:\\registrybackupthef.xml", true, writer);
error
System.Xml.XmlException was unhandled
Message='.', hexadecimal value 0x00, is an invalid character. Line 8, position 39.
Source=System.Xml
LineNumber=8
LinePosition=39
SourceUri=""
StackTrace:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.LoadChildNodes(XmlDiffParentNode parent, XmlReader reader, Boolean bEmptyElement)
at Microsoft.XmlDiffPatch.XmlDiffDocument.Load(XmlReader reader, XmlHash xmlHash)
at Microsoft.XmlDiffPatch.XmlDiff.Compare(XmlReader sourceReader, XmlReader changedReader, XmlWriter diffgramWriter)
at Microsoft.XmlDiffPatch.XmlDiff.Compare(String sourceFile, String changedFile, Boolean bFragments, XmlWriter diffgramWriter)
at yahoo.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\Sirhirbaz\documents\visual studio 2010\Projects\yahoo\yahoo\Form1.cs:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at yahoo.Program.Main() in C:\Users\Sirhirbaz\documents\visual studio 2010\Projects\yahoo\yahoo\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
解决方案
Please refer the link given below:
hexadecimal-value-0-is-an-invalid-character
hexadecimal value 0x00, is an invalid character
Don''t forget to mark useful responses as Answer if they helped you towards a solution. :)
这篇关于如何使用C#比较2 xml注册表备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文