示例#1
0
        void downloadFile(string localPath, string path, Datei datei)
        {
            string pfad = localPath + path + Path.DirectorySeparatorChar + datei.filename;

            if (!checkFile(pfad, datei))
            {
                Console.WriteLine(path + Path.DirectorySeparatorChar + datei.filename + " (" + datei.id + ")");
                try
                {
                    wc.DownloadFile(API_BASE + "file/" + datei.id + "/download", pfad);
                }
                catch (Exception ex)
                {
                    try
                    {
                        //API wirft Fehler bei Dateien > 500MB, nutze dann WEB UI
                        wc.DownloadFile(BASE + "sendfile.php?force_download=1&type=0&file_id=" + datei.id, pfad);
                    }
                    catch (Exception ex1)
                    {
                        Console.WriteLine("Fehler beim Downloaden der Datei " + datei.filename + "(" + datei.id + ")\r\n" + ex.Message);
                    }
                }
            }
        }
示例#2
0
 bool checkFile(string pfad, Datei datei)
 {
     if (!File.Exists(pfad))
     {
         return(false);
     }
     if (ToUnixTime(File.GetLastWriteTime(pfad)) < datei.chdate)
     {
         Console.WriteLine(datei.filename + " wurde bearbeitet!");
         return(false);
     }
     return(true);
 }