コード例 #1
0
 internal static ApiResponse GetUploadFileResponse(UploadFilePacket data)
 {
     if (!data.FileUrl.EndsWith("/data", StringComparison.OrdinalIgnoreCase))
         data.FileUrl += "/data";
   
     data.RequestUri = new Uri(data.FileUrl);
     data.Method = "PUT";
     return ApiRequestSender.SendPacket(data);
 }
コード例 #2
0
        internal void HandleFileUpload(Packet pa)
        {
            UploadFilePacket p = pa as UploadFilePacket;
            Mod m = Server.Mods.Find(new Predicate <Mod>(delegate(Mod mod)
            {
                if (mod.Identifier == p.Identifier)
                {
                    return(true);
                }
                return(false);
            }));

            if (m == null)
            {
                m = new Mod();
            }
            if (File.Exists(Config.ModsPath + "/" + m.ModFile))
            {
                File.Delete(Config.ModsPath + "/" + m.ModFile);
            }
            currentDownload = m;
            downloaded      = new byte[p.Size];
        }