protected void _PatchCore(SPatchData Data_) { if (_Data.Data.Version.Main != Data_.Version.Main || _Data.Data.Version.Sub > Data_.Version.Sub) { _Data.Data = Data_; } else { _Data.Data.Version.Sub = Data_.Version.Sub; foreach (var i in Data_.Files) { if (i.Value.IsAdded) { _Data.Data.Files.Add(i.Key, i.Value); } else { _Data.Data.Files.Remove(i.Key); } } } _Data.Save(); }
void DataCallback(SPatchData PatchData_) { if (Int32.Parse(tbMainVer.Text) != PatchData_.Version.Main || Int32.Parse(tbSubVer.Text) > PatchData_.Version.Sub) { lbFullData.Items.Clear(); } SetVersion(PatchData_.Version); Log("Version : Main[" + PatchData_.Version.Main.ToString() + "] Sub[" + PatchData_.Version.Sub.ToString() + "]"); foreach (var i in PatchData_.Files) { if (i.Value.IsAdded) { if (!lbFullData.Items.Contains(i.Key)) { lbFullData.Items.Add(i.Key); } } else { if (lbFullData.Items.Contains(i.Key)) { lbFullData.Items.Remove(i.Key); } } } }
void _RecvScPatchData(CKey Key_, CStream Stream_) { var Proto = new SPatchData(); Stream_.Pop(Proto); _Patch(Proto); _NetB.CloseAll(); }
void _RecvMaPatchData(CKey Key_, CStream Stream_) { var Proto = new SPatchData(); Stream_.Pop(Proto); _PatchCore(Proto); _DataFunc(Proto); }
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)); } }
public void Set(SPatchData Obj_) { Version.Set(Obj_.Version); Files = Obj_.Files; }
public SPatchData(SPatchData Obj_) { Version = Obj_.Version; Files = Obj_.Files; }
public _SPatchDataCount(SPatchData PatchData_, Int32 LeftCount_) { PatchData = PatchData_; LeftCount = LeftCount_; }