static void Main(String[] args) { var h = new CHttp(4, DownloadChangedCallback, DownloadCompletedCallback); //h.Push(new SInObj("http://madplanet-patch.s3.ca-central-1.amazonaws.com", "/ServerInfo.txt")); h.Push(new SInObj("http://madplanet-patch.s3.ca-central-1.amazonaws.com", "/data/test2.msi")); while (true) { h.Proc(); Thread.Sleep(1); } }
protected void _Patch(SPatchData Data_) { if (_Data.Data.Version.Main != Data_.Version.Main) { var di = new DirectoryInfo(_DataPathFull); foreach (var file in di.GetFiles()) { file.Delete(); } foreach (var dir in di.GetDirectories()) { dir.Delete(true); } } Int32 LeftCount = 0; foreach (var i in Data_.Files) { if (i.Value.IsAdded) { string ObjectName = (_VersionPath ? (i.Value.SubVersion.ToString() + "/") : ""); ObjectName += i.Key; _Http.Push(new SInObj(_ServerName, ObjectName.Replace('\\', '/'))); ++LeftCount; } else { File.Delete(_DataPathFull.Combine(i.Key)); } } if (LeftCount > 0) { _PatchDatas.Enqueue(new _SPatchDataCount(Data_, LeftCount)); } }