荣耀彩票代理

IT技术互动交流平台

[UWP]涨姿势UWP源码IsolatedStorage

作者:楼上那个蜀黍  来源:IT165收集  发布日期:2016-12-14 20:33:15

  QIANYIPIANZHANGZISHIUWPYUANMAFENXICONGSHUJUYUANZHESHOU,JIESHILERSS feedDEHUOQUHEJIEXI,BENPIANZEHUIJIUSHUJUYUANDEBAOCUNHEDUQUJINXINGJULI。

  HEZHIQIANDEWindows RuntimeYIYANG,UWPCAIYONGIsolatedStorageDEFANGSHILAICUNCHUAPPDESIYOUSHUJU,ZHEIYANGZUODAOAPPZHIJIANHUBUGANRAO,JIANSHAOLECUOWUJIANQUANYINHUAN。XIANZAIDEApplicationDESHEJISIHUDOULIUXINGZHEIGEZUOFA。

  UWPZHONGDUIYINGYONGCHENGXUSHUJUCUNCHUQUDEFANGWEN,TONGCHANGSHIYONGApplicationDataZHEIGELEILAICAOZUO,WOMENBAZUICHANGYONGDEYIXIESHUXINGLIECHU:

SHUXINGHEFANGFA

YONGTU

public StorageFolder LocalFolder { get; }

HUOQUBENDIYINGYONGCHENGXUSHUJUCUNCHUQUZHONGDEGENWENJIANJIA。

荣耀彩票代理public ApplicationDataContainer LocalSettings { get; }

HUOQUBENDIYINGYONGCHENGXUSHUJUCUNCHUQUZHONGDEYINGYONGCHENGXUSHEZHIRONGQI。

public StorageFolder RoamingFolder { get; }

荣耀彩票代理HUOQUMANYOUYINGYONGCHENGXUSHUJUCUNCHUQUZHONGDEGENWENJIANJIA。

public ApplicationDataContainer RoamingSettings { get; }

HUOQUMANYOUYINGYONGCHENGXUSHUJUCUNCHUQUZHONGDEYINGYONGCHENGXUSHEZHIRONGQI。

荣耀彩票代理public IAsyncAction ClearAsync();

SHANCHUBENDI、MANYOUYIJILINSHIYINGYONGCHENGXUSHUJUCUNCHUQUZHONGDESUOYOUYINGYONGCHENGXUSHUJU。

  JUTIZAIZHANGZISHIUWPZHONG,SHOUXIANTONGGUOApplicationData.Current.LocalFolderNADAODANGQIANAPPDUIYINGCUNCHUKONGJIANDEGENWENJIANJIA,RANHOUTONGGUOStorageFolderDUIXIANGJINXINGCreateFileCAOZUO,ZHUYIZHEILIXUANZELECreationCollisionOption.ReplaceExistingZHEIGEMEIJU,QIWANGMEICIDOUNENGGOUYONGXINDERSS feedWENJIANFUGAIYIYOUDEWENJIAN。

荣耀彩票代理  JIEXIALAIXUYAOXIANJIANGXUYAOBAOCUNDEZIFUCHUANNEIRONGZHUANHUANCHENGYIBIANMADEbufferDUIXIANG,ZAITONGGUOFileIO.WriteBufferAsyncFANGFAXIERUZHIQIANCHUANGJIANHAODEWENJIANZHONG。DANGRANNIZHIJIEFileIO.WriteTextAsyncYEBUSHIBUKEYI,CryptographicBufferZHUYAOBAOHANEncode,DecodeDENGBIANMAXIANGGUANDEFANGFA,KEYONGYUJIAMICAOZUO。

        public async Task<bool> SaveRssFileAsync(string content)
        {
            bool isWriteSuccess = true;
            try
            {
                StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
                StorageFile rssFile = await storageFolder.CreateFileAsync(RssFileName, CreationCollisionOption.ReplaceExisting);

                var buffer = CryptographicBuffer.ConvertStringToBinary(content, BinaryStringEncoding.Utf8);
                await FileIO.WriteBufferAsync(rssFile, buffer);
            }
            catch (Exception)
            {
                isWriteSuccess = false;
            }

            return isWriteSuccess;
        }

荣耀彩票代理  UWPWENJIANCUNCHUXIANGGUANDELEI,CHULESHANGSHUTIDAODEWindows.StorageMINGMINGKONGJIANXIAZUICHANGYONGDEStorageFolder、StorageFileHEFileIO,HAIYOUWindows.Storage.PickersMINGMINGKONGJIANXIADEGELEIPicker,Windows.Storage.StreamsMINGMINGKONGJIANXIADEGEZHONGbuffer,steam,SHUXIZHIHOUYONGQILAIHAISHIHENFANGBIANDE。

荣耀彩票代理  JIEZHEWOMENKANKANDUQUWENJIANNEIRONGDECAOZUO,TONGYANGSHIZHAODAOLocalFolder,RANHOUGENJUWENJIANMINGQUDUQUStorageFile,RUGUOStorageFileBUWEIKONG,JIUTONGGUOReadTextAsyncFANGFALAIHUOQUCUNCHUDEWENBENNEIRONG。

        public async Task<string> ReadRssFileAsync()
        {
            string content = string.Empty;

            StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
            StorageFile rssFile = await storageFolder.TryGetItemAsync(RssFileName) as StorageFile;
            if (rssFile != null)
            {
                content = await FileIO.ReadTextAsync(rssFile);
            }

            return content;
        }

荣耀彩票代理  WENJIANDEBAOCUNHEDUQUDAZHIJIUSHIYISHANGZHEIXIE,SHIBUSHIBIXIANGXIANGDEJIANDANDUOLE。SHANGZHOUZHANGZISHIUWPGENGXINLEYIBAN,XIUFULEYIXIEBUKEGAORENDEXIAObug,YOUHUA(HUOCHOUHUA)LEBUFENJIEMIAN,HUANYINGLAIZHANGZISHI。

荣耀彩票代理  GitHubYUANDAIMADIZHI:

荣耀彩票代理http://github.com/manupstairs/ZhangZiShiRSSRead

  Windows Store:

荣耀彩票代理http://www.microsoft.com/zh-cn/store/p/%e6%b6%a8%e5%a7%bf%e5%8a%bfuwp/9nblggh3zqd1

Tag标签:      
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规