}   // end of Delete()

        static public FileAttributes GetAttributes(string fullPath)
        {
            StorageFile file = GetStorageFile(fullPath);

            Windows.Storage.FileAttributes fileAttributes = file.Attributes;

            FileAttributes attributes = 0;

            if (fileAttributes.HasFlag(Windows.Storage.FileAttributes.Archive))
            {
                attributes |= FileAttributes.Archive;
            }
            if (fileAttributes.HasFlag(Windows.Storage.FileAttributes.Directory))
            {
                attributes |= FileAttributes.Directory;
            }
            if (fileAttributes.HasFlag(Windows.Storage.FileAttributes.Normal))
            {
                attributes |= FileAttributes.Normal;
            }
            if (fileAttributes.HasFlag(Windows.Storage.FileAttributes.ReadOnly))
            {
                attributes |= FileAttributes.ReadOnly;
            }
            if (fileAttributes.HasFlag(Windows.Storage.FileAttributes.Temporary))
            {
                attributes |= FileAttributes.Temporary;
            }

            return(attributes);
        }   // end of GetAttributes()
Exemplo n.º 2
0
 public void Connect(IConnectionHelper connectionHelper, string userAgent, int connectionTimeout, int readTimeout, PURLConnection purlConnection)
 {
     if (purlConnection.PURL.IsFile)
     {
         Windows.Storage.FileAttributes attributes = ((StorageFile)purlConnection.File).Attributes;
         if (attributes.HasFlag(Windows.Storage.FileAttributes.Directory))
         {
             connectionHelper.HandleFileDirectory(purlConnection.File);
         }
         else
         {
             string suffix = purlConnection.PURL.Suffix;
             if (suffix != null)
             {
                 if (connectionHelper.ParseFilesWithSuffix(suffix))
                 {
                     try
                     {
                         purlConnection.FileConnect();
                     }
                     catch (FileNotFoundException e)
                     {
                         Debug.WriteLine("ERROR: Can't open because FileNotFoundException");
                     }
                 }
             }
         }
     }
     else
     {
         purlConnection.NetworkConnectAndCatch(connectionHelper, userAgent, connectionTimeout, readTimeout);
     }
 }