none
在metro中把文件添加到zip文件 RRS feed

  • 问题

  • 我有一个zip文件,现在一张图片,我想把它添加到这个zip文件中。不是新建一个zip文件,是加入zip文件。


    wjm

    2014年3月5日 6:24

答案

  • Hi,

    您可以分为以下几步:

    #先将这个zip文件解压

    #然后将图片添加到解压后的文件夹内

    #最后将文件夹压缩

    请参考以下代码如果将图片文件添加到文件夹内:

    private async void Button_Click(object sender, RoutedEventArgs e)
            {
                
                StorageFile imagefile = await KnownFolders.PicturesLibrary.GetFileAsync("image.jpg");
                StorageFolder zipfloder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("zipfloder.zip", CreationCollisionOption.OpenIfExists);
                    if (zipfloder != null && imagefile !=null)
    {
        await imagefile.CopyAsync(zipfloder, imagefile.Name, NameCollisionOption.GenerateUniqueName);
    }

    关于如果解压缩zip文件您还可以参考以下链接:

    http://social.msdn.microsoft.com/Forums/zh-CN/1ab0f22b-b48d-4dcd-a8c4-db9f1fff53fc/cmetro-zip?forum=winstoreappzhcn

    祝您好运!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    2014年3月6日 2:34
    版主