Esempio n. 1
0
    public static string[] retrieveProjectFolders(string url)
    {
        string zipFilename, internalPath;

        if (extractPaths(url, out zipFilename, out internalPath))
        {
            if (new FileInfo(zipFilename).Exists)
            {
                string[] dirList = ZIP_Operations.getDirectories(zipFilename, internalPath);
                return(dirList);
            }
        }

        return(new string[0]); //  empty array.
    }
Esempio n. 2
0
    public static bool synchronizeProjectFolder(string url, out string projectFolder)
    {
        projectFolder = null;

        string zipFilename, internalPath;

        if (extractPaths(url, out zipFilename, out internalPath))
        {
            string folderName = (new DirectoryInfo(internalPath)).Name;

            string tmpProjectFolder = Application.temporaryCachePath + "/" + folderName;

            FileInfo zipFileInfo = new FileInfo(zipFilename);
            if (zipFileInfo.Exists)
            {
                DirectoryInfo tmpDirInfo = new DirectoryInfo(tmpProjectFolder);

                //Message.Log( "zipFileInfo: " + zipFileInfo.LastWriteTime.ToString() );
                //Message.Log( "tmpDirInfo: " + tmpDirInfo.LastWriteTime.ToString() );

                if (tmpDirInfo.Exists && (tmpDirInfo.LastWriteTime > zipFileInfo.LastWriteTime))
                {
                    projectFolder = tmpProjectFolder;
                    return(true);
                }
                else
                {
                    //  Copy new version of asset.
                    if (tmpDirInfo.Exists)
                    {
                        tmpDirInfo.Delete(true /*recursive*/);
                    }

                    //  Unzip project folder to temporary cache path.
                    ZIP_Operations.unzipFolder(zipFilename, internalPath, tmpProjectFolder);

                    if (new DirectoryInfo(tmpProjectFolder).Exists)
                    {
                        projectFolder = tmpProjectFolder;
                        return(true);
                    }
                }
            }
        }

        return(false);
    }