Ejemplo n.º 1
0
    public static StorageFile CreateFile(string path)
    {
        path = StorageUtility.ConvertPathSeparators(path);
        int pathSeparatorIndex = StorageUtility.GetPathSeparatorIndex(path, false);

        if (pathSeparatorIndex == -1)
        {
            throw new Exception("No folder in file path: " + path);
        }
        int           num           = pathSeparatorIndex + 1;
        StorageFolder storageFolder = null;
        string        text          = path;
        List <string> list          = new List <string>();

        while (storageFolder == null && pathSeparatorIndex != -1)
        {
            text = text.Substring(0, pathSeparatorIndex);
            pathSeparatorIndex = StorageUtility.GetPathSeparatorIndex(text, false);
            try
            {
                storageFolder = StorageUtility.GetFolderFromPath(text);
            }
            catch (Exception var_6_55)
            {
                if (pathSeparatorIndex != -1)
                {
                    list.Add(text.Substring(pathSeparatorIndex + 1));
                }
                storageFolder = null;
            }
        }
        if (storageFolder == null)
        {
            throw new Exception("No accesible folder found in path: " + path);
        }
        int count = list.Count;

        if (list.Count > 0)
        {
            for (int i = list.Count; i >= 0; i--)
            {
                storageFolder = StorageUtility.CreateFolder(storageFolder, list[i]);
            }
        }
        return(StorageUtility.CreateFile(storageFolder, path.Substring(num)));
    }
Ejemplo n.º 2
0
    public static string CreateFolderAtPath(string path)
    {
        path = StorageUtility.ConvertPathSeparators(path);
        while (StorageUtility.IsPathSeparator(path.get_Chars(path.get_Length() - 1)))
        {
            path = path.Substring(0, path.get_Length() - 1);
        }
        int           num           = path.get_Length();
        string        text          = path;
        List <string> list          = new List <string>();
        StorageFolder storageFolder = null;

        while (storageFolder == null && num != -1)
        {
            text = text.Substring(0, num);
            num  = StorageUtility.GetPathSeparatorIndex(text, false);
            try
            {
                storageFolder = StorageUtility.GetFolderFromPath(text);
            }
            catch (Exception var_4_5D)
            {
                if (num != -1)
                {
                    list.Add(text.Substring(num + 1));
                }
                storageFolder = null;
            }
        }
        if (storageFolder == null)
        {
            throw new Exception("No accesible folder found in path: " + path);
        }
        int count = list.Count;

        if (list.Count > 0)
        {
            for (int i = list.Count - 1; i >= 0; i--)
            {
                storageFolder = StorageUtility.CreateFolder(storageFolder, list[i]);
            }
        }
        return(storageFolder.get_Path());
    }
Ejemplo n.º 3
0
 public static StorageFolder CreateFolder(StorageFolder folder, string name)
 {
     return(StorageUtility.CreateFolder(folder, name, 3));
 }
Ejemplo n.º 4
0
 public unsafe static long $Invoke19(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(StorageUtility.CreateFolder((StorageFolder)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)), *(int *)(args + 2))));
 }