Esempio n. 1
0
    private void DownloadGitFile(string id, GitNode file, string folderPath)
    {
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            throw new Exception("Internet error");
        }
        GitFile download = RequestFromGit <GitFile>(id, file.path);

        byte[] bytes        = Convert.FromBase64String(download.content);
        string downloadFile = Path.Combine(folderPath, file.path);
        string downloadDir  = ShaCache.ToContaingFolder(downloadFile);

        if (!Directory.Exists(downloadDir))
        {
            Directory.CreateDirectory(downloadDir);
        }
        File.WriteAllBytes(downloadFile, bytes);
        localSha.UpdateInsertCache(downloadFile, file.id);
    }