为什么手持设备会忽略“文件同步路径”注册表项值?

时间:2015-02-05 18:03:10

标签: c# registry windows-ce handheld remote-registry

我们不希望手持设备和PC之间进行文件同步。

手持设备将某些(SQL CE数据库)文件放在手持设备的\ My Documents文件夹中。这些特别是我们不希望同步到PC的文件。

我首先添加了" sdf" (和#34; SDF"只是为了确定)到" ExcludeExts"注册表项。这没有任何帮助。然后我改变了" FileSyncPath"和" NoSubfolderIn"来自"我的文档"的注册表项文件夹到"个人资料"文件夹:

private void UpdateRegistry()
{
    RegistryKey key =
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows CE
Services");
    if (key != null)
    {
        key.SetValue("ExcludeExts", "lnk,tmp,cdb,mdb,sdf,SDF", 
RegistryValueKind.String);
        key.SetValue("FileSyncPath", "\\profiles",
RegistryValueKind.String);
        key.SetValue("NoSubfolderIn", "\\profiles\\",
RegistryValueKind.String);
    }
}

配置文件文件夹中只有其他文件夹,由于" NoSubfolderIn"注册表项:

enter image description here

更改已写入设备上的注册表:

enter image description here

...但我仍然将\ My Documents的.SDF文件同步到PC:

enter image description here

为什么呢?更改.SDF文件存储在设备上的位置是解决方案(IOW,从#34; My Documents"移动它,文件同步似乎无论如何都要使用)?或者,是否还需要更新其他Windows CE服务注册文件夹?奇怪的是,设备上有三个,加上一个" Windows CE工具"文件夹:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows CE Services <= It has one registry key, "DeviceFriendlyName"
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services <= shown in the scream shot above; it has several (7) registry keys
HKEY_LOCAL_MACHINE\Windows CE Tools <= It has one registry key, "Platform"
HKEY_LOCAL_MACHINE\Windows CE Services <= it's empty

这些注册表项是否只是&#34; teases&#34;?我在这里错过了什么吗?

更新

我添加了这些条目,将相同的值放在手持设备注册表的另外两个位置,其中有一个&#34; Windows CE服务&#34;文件夹:

RegistryKey keyLocalWCES =
    Registry.LocalMachine.CreateSubKey(@"Windows CE Services");
if (null != keyLocalWCES)
{
    keyLocalWCES.SetValue("GuestOnly", 00000001
RegistryValueKind.DWord);
    keyLocalWCES.SetValue("ExcludeExts", "lnk,tmp,cdb,mdb,sdf,SDF"
RegistryValueKind.String);
    keyLocalWCES.SetValue("FileSyncPath", "\\profiles",
RegistryValueKind.String);
    keyLocalWCES.SetValue("NoSubfolderIn", "\\profiles\\",
RegistryValueKind.String);
}

RegistryKey keyCurrentUser 
    Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows CE 
        Services");
if (null != keyCurrentUser)
{
    keyCurrentUser.SetValue("GuestOnly", 00000001
RegistryValueKind.DWord);
    keyCurrentUser.SetValue("ExcludeExts"
"lnk,tmp,cdb,mdb,sdf,SDF", RegistryValueKind.String);
    keyCurrentUser.SetValue("FileSyncPath", "\\profiles",
RegistryValueKind.String);
    keyCurrentUser.SetValue("NoSubfolderIn", "\\profiles\\",
RegistryValueKind.String);
}

...我仍然要同步文件!天哪到Murgatroid,当他的奶酪不停地移动时,该怎么做??

更新2

这就是我解决困境的方法:我将有问题的文件(当前版本中的* .SDF文件,下一版本中的* .sqlite文件)保存到与设置为&#34;的不同的位置。 FileSyncPath&#34;值。具体来说,就我而言,我改变了&#34; FileSyncPath&#34;回到它一直以来的样子&#34;我的文件&#34;但是改变了我将我不想同步的文件保存到一个名为&#34; profiles的无害的小文件夹。&#34;它似乎工作得很好,现在:没有任何东西被同步到PC。 ActiveStync正在显示一个错误的消息,但我认为它只是让它无法窃取文件,而且只是简单地吹嘘。&#34;

或者,重构以保持数据始终保持原样可能更安全,但只需更改&#34; FileSyncPath&#34;的值即可。 (也许&#34; NoSubfolderIn&#34;虽然它可能是不必要的)关键注册表值不是存储数据的地方(或者不是你不喜欢的文件所在的位置)想要同步存在)。

0 个答案:

没有答案
相关问题