简体   繁体   English

文件系统WP7

[英]File System WP7

I want to save a text file on the wp7 file system that doesn't get deleted on uninstall of the app. 我想将文本文件保存在wp7文件系统上,该文件在卸载应用程序时不会被删除。

I want to save the version of the app and language preference selected by the user so that it doesnt get deleted when the user upgrades the app. 我想保存应用程序的版本和用户选择的语言首选项,以便在用户升级应用程序时不会被删除。 I dont want to use IsolatedStorage instead i want to use the device's file system.. Is this possible? 我不想使用IsolatedStorage,而是想使用设备的文件系统。这可能吗? If yes how??? 如果是,怎么办??? As of now am doing this:- 截至目前正在这样做:

 public void SaveLanguageAndVersion()
    {
        IsolatedStorageFile appInfoFile = IsolatedStorageFile.GetUserStoreForApplication();

        //create new file
        using (StreamWriter writetoAppInfo = new StreamWriter(new IsolatedStorageFileStream("appInfo.txt", FileMode.Create, FileAccess.Write, appInfoFile)))
        {
            string appVer = new StringBuilder().Append(Utils.getRelVersion()).Append(":").Append(Utils.getFWversion()).ToString();
            writetoAppInfo.WriteLine(appVer);
            string appLanguage = CacheManager.getInstance().getApplicationSettings(Utils.APP_LANG);
            writetoAppInfo.WriteLine(appLanguage);
            writetoAppInfo.Close();
        }
    }

but the appinfo.txt file gets deleted on uninstalling of the app. 但是appinfo.txt文件在卸载应用程序时被删除。 I wanna overcome this. 我想克服这个。

If i use LINQ SQL can i overcome this problem and achieve what i want? 如果我使用LINQ SQL,我可以克服这个问题并实现我想要的吗? ie, Save the app level info like the version and the language of user's choice? 即,保存应用级别信息,例如版本和用户选择的语言?

This is not possible. 这是不可能的。 If you want to have device / user specific data, consider using ANID or Device ID and store it in the Cloud 如果要获取设备/用户特定的数据,请考虑使用ANID或设备ID并将其存储在云中

have a look at this post. 看看这个帖子。 Gives you info on how to get ANID and DeviceID http://www.nickharris.net/2010/09/windows-phone-7-how-to-find-the-device-unique-id-windows-live-anonymous-id-and-manufacturer/ 为您提供有关如何获取ANID和DeviceID的信息http://www.nickharris.net/2010/09/windows-phone-7-how-to-find-the-device-unique-id-windows-live-anonymous- ID-和制造商/

Windows Phone 7 is quite picky about letting the user make changes outside of the applications isolated storage. Windows Phone 7对于让用户在应用程序隔离的存储之外进行更改非常挑剔。

What you could do is save the preferences in the cloud and use either the device id or the user id as a key. 您可以做的是将首选项保存在云中,并使用设备ID或用户ID作为密钥。 And when the user reinstalls the app the preferences could be downloaded. 并且当用户重新安装应用程序时,可以下载首选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM