private PackList ScanPacks(PackList original) { lock (_packList) { PackList o, n; do { o = _packList.get(); if (o != original) { // Another thread did the scan for us, while we // were blocked on the monitor above. // return(o); } n = ScanPacksImpl(o); if (n == o) { return(n); } } while (!_packList.compareAndSet(o, n)); return(n); } }
private Dictionary <ulong, string> BuildFileMap(PackList packFiles, bool useCache) { if (useCache && _packFileLocator.TryGetValue(packFiles, out var files)) { return(files); } files = new Dictionary <ulong, string>(); foreach (var packFile in packFiles.Packs) { var pack = LoadPack(packFile, useCache); for (int i = 0; i < pack.FileEntries.Count; i++) { var hash = pack.FileEntries[i].PathHash; files[hash] = packFile; } } if (useCache) { _packFileLocator.TryAdd(packFiles, files); } return(files); }
public override void OpenObjectInAllPacksImplementation(ICollection <PackedObjectLoader> @out, WindowCursor windowCursor, AnyObjectId objectId) { PackList pList = _packList.get(); while (true) { SEARCH: foreach (PackFile p in pList.packs) { try { PackedObjectLoader ldr = p.Get(windowCursor, objectId); if (ldr != null) { @out.Add(ldr); } } catch (PackMismatchException) { // Pack was modified; refresh the entire pack list. // pList = ScanPacks(pList); goto SEARCH; } catch (IOException) { // Assume the pack is corrupted. // RemovePack(p); } } break; } }
public PackService() { if (_packList == null) { _packList = InitPacks(); } }
private PackList UpdateDeliveryNotesWithProductDescriptions(TradevineGateway gateway, PackList input) { var originalDeliveryNotes = input.DeliveryNotes; foreach (var packListItem in input.PackListItems) { string productDescription = gateway.Products.GetProductById(packListItem.ProductID.Value).Description; string productCode = gateway.Products.GetProductById(packListItem.ProductID.Value).Code; if (productCode != "SHIP") { productDescription = productDescription.Substring(0, Math.Min(1000, productDescription.Length)); if (string.IsNullOrEmpty(input.DeliveryNotes) || !input.DeliveryNotes.Contains(productDescription)) { input.DeliveryNotes = (input.DeliveryNotes ?? string.Empty) + productDescription; } } } if (input.DeliveryNotes == originalDeliveryNotes) return input; Console.WriteLine("Updating delivery notes for {0}", input.PackListNumber); var output = gateway.Sales.UpdatePackList(input); return output; }
public GameEngine(MyGame game) { screenLog = new ScreenLog(); _hotkeys = new List<HotKey>(); _hotkeys.Add(new HotKey(new Keys[] { Keys.O }, SwichDebugRender)); _hotkeys.Add(new HotKey(new Keys[] { Keys.P }, SwichBehaviourModel)); KeyboardManager.Manager.AddKeyboardUser(this); game._engine = this; packs = new PackList(); // newPacks = new ContentNew.PackList(); Instance = this; lightDir.Normalize(); gameScene = new EngineScene(); Scene = gameScene.Scene; //разме рэкрана MyGame.DeviceManager.PreferredBackBufferWidth = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width *0.8 ); MyGame.DeviceManager.PreferredBackBufferHeight = (int) (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height*0.8); GameConfiguration.ScreenResolution = new Vector2(MyGame.DeviceManager.PreferredBackBufferWidth, MyGame.DeviceManager.PreferredBackBufferHeight); MyGame.DeviceManager.IsFullScreen = false; _cashe = new ObjectCashe(); }
private static Dictionary <string, PackFile> ReuseMap(PackList old) { var forReuse = new Dictionary <string, PackFile>(); foreach (PackFile p in old.packs) { if (p.IsInvalid) { // The pack instance is corrupted, and cannot be safely used // again. Do not include it in our reuse map. // p.Close(); continue; } PackFile prior = forReuse[p.File.Name] = p; if (prior != null) { // This should never occur. It should be impossible for us // to have two pack files with the same name, as all of them // came out of the same directory. If it does, we promised to // close any PackFiles we did not reuse, so close the one we // just evicted out of the reuse map. // prior.Close(); } } return(forReuse); }
public async Task <ActionResult <PackList> > PostPackList(PackList list) { _context.PackLists.Add(list); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetPackList), new { id = list.Id }, list)); }
private void SetupNewPackList() { packList = new PackList(); foreach (Pack.PackID packId in Enum.GetValues(typeof(Pack.PackID))) { packList.Add(new Pack(packId)); } }
private PackList UpdatePacklistToAwaitingPack(TradevineGateway gateway, PackList input) { input.Status = Constants.CVs.PackListStatus.Values.AwaitingPack; var output = gateway.Sales.UpdatePackList(input); Console.WriteLine("Packlist {0} now has status {1}", output.PackListNumber, output.Status); return output; }
public override bool tryAgain1() { PackList old = _packList.get(); _packDirectory.Refresh(); if (old.tryAgain(_packDirectory.LastWriteTime.Ticks)) { return(old != ScanPacks(old)); } return(false); }
public override bool tryAgain1() { PackList old = _packList.get(); _packDirectory.Refresh(); if (old.tryAgain(_packDirectory.lastModified())) { return(old != ScanPacks(old)); } return(false); }
private void ComparePackListFile(PackList packListFromFile) { for (int i = 0; i < packList.GetList().Count; i++) { foreach (Pack packFromFile in packListFromFile.GetList()) { if (packList.GetList()[i].packId == packFromFile.packId) { packList.GetList()[i] = packFromFile; } } } }
private void InsertPack(PackFile pf) { PackList o, n; do { o = _packList.get(); PackFile[] oldList = o.packs; var newList = new PackFile[1 + oldList.Length]; newList[0] = pf; Array.Copy(oldList, 0, newList, 1, oldList.Length); n = new PackList(o.lastRead, o.lastModified, newList); } while (!_packList.compareAndSet(o, n)); }
private void LoadLevelDataAndroid() { WWW file = new WWW(LEVEL_DATA_FILENAME); while (!file.isDone) { ; } MemoryStream memStream = new MemoryStream(file.bytes); BinaryFormatter bf = new BinaryFormatter(); packList = bf.Deserialize(memStream) as PackList; memStream.Close(); }
public override void closeSelf() { PackList packs = _packList.get(); _packList.set(NoPacks); foreach (PackFile p in packs.packs) { p.Close(); } #if DEBUG GC.SuppressFinalize(this); // Disarm lock-release checker #endif }
public ActionResult Create(string item, bool isPurchased) { PackList newPackList = new PackList(item, isPurchased); if (isPurchased == false) { newPackList.IsPurchased = false; } else { newPackList.IsPurchased = true; } return(RedirectToAction("Index")); }
public List <Card> Draw(int aAmount) { if (aAmount > PackList.Count) { throw new Exception("Not enough cards remaining in the deck."); } List <Card> returnList = new List <Card>(); for (int i = 0; i < aAmount; i++) { returnList.Add(PackList[0]); PackList.RemoveAt(0); } return(returnList); }
public ActionResult Index() { PackList PackList = new PackList(); var dbPacklist = ShopManager.GetAllPacks(); foreach (var p in dbPacklist) { Pack pack = new Pack(); pack.IdPack = p.idpack; pack.Packname = p.packname; pack.Packprice = (double)p.packprice; pack.Cardquantity = (int)p.cardquantity; pack.Goldquantity = p.goldquantity; pack.Url = pack.Url + p.picturename; PackList.AllPack.Add(pack); } var dbCardPacklist = ShopManager.GetCardPacks(); foreach (var p in dbCardPacklist) { Pack pack = new Pack(); pack.IdPack = p.idpack; pack.Packname = p.packname; pack.Packprice = (double)p.packprice; pack.Cardquantity = (int)p.cardquantity; pack.Goldquantity = p.goldquantity; pack.Url = pack.Url + p.picturename; PackList.CardPack.Add(pack); } var dbGoldPacklist = ShopManager.GetGoldPacks(); foreach (var p in dbGoldPacklist) { Pack pack = new Pack(); pack.IdPack = p.idpack; pack.Packname = p.packname; pack.Packprice = (double)p.packprice; pack.Cardquantity = (int)p.cardquantity; pack.Goldquantity = p.goldquantity; pack.Url = pack.Url + p.picturename; PackList.GoldPack.Add(pack); } return(View(PackList)); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { foreach (var pack in PackList) { if (pack.Key != PackageType.SystemPack) { pack.Value.Dispose(); } } PackList.Clear(); } SystemPack.Dispose(); disposedValue = true; } }
private void RemovePack(PackFile deadPack) { PackList o, n; do { o = _packList.get(); PackFile[] oldList = o.packs; int j = indexOf(oldList, deadPack); if (j < 0) { break; } var newList = new PackFile[oldList.Length - 1]; Array.Copy(oldList, 0, newList, 0, j); Array.Copy(oldList, j + 1, newList, j, newList.Length - j); n = new PackList(o.lastRead, o.lastModified, newList); } while (!_packList.compareAndSet(o, n)); deadPack.Close(); }
public ListController(PackContext context) { _context = context; if (_context.PackLists.Count() == 0) { // Create a new PackList if collection is empty, // which means you can't delete all PackList. PackList packList1 = new PackList { Description = "List1" }; packList1.PackItems.Add(new PackItem { Description = "PackItem1ListItem1", Weight = 25, Volume = 30 }); packList1.PackItems.Add(new PackItem { Description = "PackItem1ListItem2", Weight = 5, Volume = 10 }); _context.PackLists.Add(packList1); _context.SaveChanges(); } }
public override ObjectLoader openObject1(WindowCursor curs, AnyObjectId objectId) { PackList pList = _packList.get(); while (true) { SEARCH: foreach (PackFile p in pList.packs) { try { PackedObjectLoader ldr = p.Get(curs, objectId); if (ldr != null) { ldr.Materialize(curs); return(ldr); } } catch (PackMismatchException) { // Pack was modified; refresh the entire pack list. // pList = ScanPacks(pList); goto SEARCH; } catch (IOException) { // Assume the pack is corrupted. // RemovePack(p); } } return(null); } }
private static StreamReader Open(FileSystemInfo f) { return new StreamReader(new FileStream(f.FullName, System.IO.FileMode.Open)); } private static Dictionary<string, PackFile> ReuseMap(PackList old) { var forReuse = new Dictionary<string, PackFile>(); foreach (PackFile p in old.packs) { if (p.IsInvalid) { // The pack instance is corrupted, and cannot be safely used // again. Do not include it in our reuse map. // p.Dispose(); continue; } PackFile prior = forReuse[p.File.Name] = p; if (prior != null) { // This should never occur. It should be impossible for us // to have two pack files with the same name, as all of them // came out of the same directory. If it does, we promised to // close any PackFiles we did not reuse, so close the one we // just evicted out of the reuse map. //
public void pkUpDb(PackList pk, string guid) { Packinglistdal pkdll = new Packinglistdal(); pkdll.pkUpDb(pk, guid); }
public void pkUpDb(PackList pk) { Packinglistdal pkdll = new Packinglistdal(); pkdll.pkUpDb(pk); }
public FormNewElement(PackList _packs, TreeView _tv) { InitializeComponent(); packs = _packs; tv = _tv; }
public void AddPackList(PackList packList) { PackLists.Add(packList); }
private PackList ScanPacksImpl(PackList old) { Dictionary <string, PackFile> forReuse = ReuseMap(old); long lastRead = DateTime.Now.Ticks; long lastModified = _packDirectory.LastWriteTime.Ticks; HashSet <String> names = listPackDirectory(); var list = new List <PackFile>(names.Count >> 2); bool foundNew = false; foreach (string indexName in names) { // Must match "pack-[0-9a-f]{40}.idx" to be an index. // if (indexName.Length != 49 || !indexName.EndsWith(".idx")) { continue; } string @base = indexName.Slice(0, indexName.Length - 4); string packName = IndexPack.GetPackFileName(@base); if (!names.Contains(packName)) { // Sometimes C Git's HTTP fetch transport leaves a // .idx file behind and does not download the .pack. // We have to skip over such useless indexes. // continue; } PackFile oldPack; forReuse.TryGetValue(packName, out oldPack); forReuse.Remove(packName); if (oldPack != null) { list.Add(oldPack); continue; } var packFile = new FileInfo(_packDirectory.FullName + "/" + packName); var idxFile = new FileInfo(_packDirectory + "/" + indexName); list.Add(new PackFile(idxFile, packFile)); foundNew = true; } // If we did not discover any new files, the modification time was not // changed, and we did not remove any files, then the set of files is // the same as the set we were given. Instead of building a new object // return the same collection. // if (!foundNew && lastModified == old.lastModified && forReuse.isEmpty()) { return(old.updateLastRead(lastRead)); } foreach (PackFile p in forReuse.Values) { p.Close(); } if (list.Count == 0) { return(new PackList(lastRead, lastModified, NoPacks.packs)); } PackFile[] r = list.ToArray(); Array.Sort(r, PackFile.PackFileSortComparison); return(new PackList(lastRead, lastModified, r)); }
private void Awake() { packList = GameObject.FindObjectOfType <PackList>(); dataManager = GameObject.FindObjectOfType <DataManager>(); }
public IEnumerable <PackList> GetPackList(PackList param = null) { return(GetDictionary <PackList>(nameof(PackList), param)); }
public void pkUpDb(PackList pk) { String sql = @"INSERT INTO T_PackList (guid ,CustomName ,GoodsTypeEnName ,CustomStyleName ,CustomStyleCode ,SizeName ,TotalCount ,CutNo ,ManufactureOrder ,CustomPO ,ColorGroupName ,BoxSize ,BoxNoTotal ,PerCount ,perCountTotal ,NW ,TNW ,GW ,TGW ,BoxVolume ,MT ,BOXTONO ,BOXNO ,Totsumcount ,Boxsumcount ,OrderDate) VALUES (@guid ,@CustomName ,@GoodsTypeEnName ,@CustomStyleName ,@CustomStyleCode ,@SizeName ,@TotalCount ,@CutNo ,@ManufactureOrder ,@CustomPO ,@ColorGroupName ,@BoxSize ,@BoxNoTotal ,@PerCount ,@perCountTotal ,@NW ,@TNW ,@GW ,@TGW ,@BoxVolume ,@MT ,@BOXTONO ,@BOXNO ,@Totsumcount ,@Boxsumcount ,@OrderDate);"; SqlParameter[] sps = { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier) { Value = pk.guid }, new SqlParameter("@CustomName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomName) }, new SqlParameter("@GoodsTypeEnName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.GoodsTypeEnName) }, new SqlParameter("@CustomStyleName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomStyleName) }, new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomStyleCode) }, new SqlParameter("@SizeName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.SizeName) }, new SqlParameter("@TotalCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.TotalCount) }, new SqlParameter("@CutNo", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CutNo) }, new SqlParameter("@ManufactureOrder", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.ManufactureOrder) }, new SqlParameter("@CustomPO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomPO) }, new SqlParameter("@ColorGroupName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.ColorGroupName) }, new SqlParameter("@BoxSize", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BoxSize) }, new SqlParameter("@BoxNoTotal", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BoxNoTotal) }, new SqlParameter("@PerCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.PerCount) }, new SqlParameter("@perCountTotal", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.perCountTotal) }, new SqlParameter("@NW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.NW) }, new SqlParameter("@TNW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.TNW) }, new SqlParameter("@GW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.GW) }, new SqlParameter("@TGW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.TGW) }, new SqlParameter("@BoxVolume", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BoxVolume) }, new SqlParameter("@MT", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.MT) }, new SqlParameter("@BOXTONO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BOXTONO) }, new SqlParameter("@BOXNO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BOXNO) }, new SqlParameter("@Totsumcount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.Totsumcount) }, new SqlParameter("@Boxsumcount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.Boxsumcount) }, new SqlParameter("@OrderDate", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.OrderDate) } }; SqlHelper.ExecuteNonQuery(sql, sps); }
public void pkUpDb(PackList pk, string guid) { String sql = @" UPDATE T_PackList SET CustonName=@CustonName ,GoodsTypeEnName=@GoodsTypeEnName ,CustoStyleName=@CustoStyleName ,CustomStyleCode=CustomStyleCode ,SizeName=@SizeName ,TotalCount=@TotalCount ,CutNo=@CutNo ,ManufactureOrder=@ManufactureOrder ,CustomPO=@CustomPO ,ColorGroupName=@ColorGroupName ,BoxSize=@BoxSize ,BoxNoTotal=@BoxNoTotal ,PerCount=@PerCount ,perCountTotal=@perCountTotal ,NW=@NW ,TNW=@TNW ,GW=@GW ,TGW=@TGW ,BoxVolume=@BoxVolume ,MT=@MT ,BOXTONO=@BOXTONO ,BOXNO=@BOXNO ,Totsumcount=@Totsumcount ,Boxsumcount=@Boxsumcount ,OrderDate=@OrderDate WHERE guid= '" + guid + "'"; SqlParameter[] sps = { // new SqlParameter("@Guid",SqlDbType.UniqueIdentifier) {Value= pk.guid }, new SqlParameter("@CustomName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomName) }, new SqlParameter("@GoodsTypeEnName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.GoodsTypeEnName) }, new SqlParameter("@CustomStyleName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomStyleName) }, new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomStyleCode) }, new SqlParameter("@SizeName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.SizeName) }, new SqlParameter("@TotalCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.TotalCount) }, new SqlParameter("@CutNo", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CutNo) }, new SqlParameter("@ManufactureOrder", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.ManufactureOrder) }, new SqlParameter("@CustomPO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.CustomPO) }, new SqlParameter("@ColorGroupName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.ColorGroupName) }, new SqlParameter("@BoxSize", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BoxSize) }, new SqlParameter("@BoxNoTotal", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BoxNoTotal) }, new SqlParameter("@PerCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.PerCount) }, new SqlParameter("@perCountTotal", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.perCountTotal) }, new SqlParameter("@NW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.NW) }, new SqlParameter("@TNW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.TNW) }, new SqlParameter("@GW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.GW) }, new SqlParameter("@TGW", SqlDbType.Float) { Value = SqlHelper.ToDbValue(pk.TGW) }, new SqlParameter("@BoxVolume", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BoxVolume) }, new SqlParameter("@MT", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.MT) }, new SqlParameter("@BOXTONO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BOXTONO) }, new SqlParameter("@BOXNO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.BOXNO) }, new SqlParameter("@Totsumcount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.Totsumcount) }, new SqlParameter("@Boxsumcount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.Boxsumcount) }, new SqlParameter("@OrderDate", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(pk.OrderDate) } }; SqlHelper.ExecuteNonQuery(sql, sps); }
{ string d = objectName.Slice(0, 2); string f = objectName.Substring(2); return new FileInfo(_objects.FullName + "/" + d + "/" + f); } private void InsertPack(PackFile pf) { PackList o, n; do { o = _packList.get(); PackFile[] oldList = o.packs;
public void AddItemToPackList(PackList packList, PackItem item) { var list = PackLists.Where(p => p.PackListId == packList.PackListId).FirstOrDefault(); list.PackItems.Add(item); }
Repository db = RepositoryCache.open(RepositoryCache.FileKey.exact(parent)); return new AlternateRepositoryDatabase(db); } return new ObjectDirectory(objdir, null); } private void RemovePack(PackFile deadPack) { PackList o, n; do { o = _packList.get(); PackFile[] oldList = o.packs; int j = indexOf(oldList, deadPack); if (j < 0) break; var newList = new PackFile[oldList.Length - 1];
Array.Copy(oldList, j + 1, newList, j, newList.Length - j); n = new PackList(o.lastRead, o.lastModified, newList); } while (!_packList.compareAndSet(o, n)); deadPack.Dispose(); } private PackList ScanPacks(PackList original) { lock (_packList) { PackList o, n; do { o = _packList.get(); if (o != original) { // Another thread did the scan for us, while we // were blocked on the monitor above. // return o; } n = ScanPacksImpl(o); if (n == o)
} while (!_packList.compareAndSet(o, n)); return n; } } private PackList ScanPacksImpl(PackList old) { Dictionary<string, PackFile> forReuse = ReuseMap(old); long lastRead = DateTime.Now.Ticks; long lastModified = _packDirectory.LastWriteTime.Ticks; HashSet<String> names = listPackDirectory(); var list = new List<PackFile>(names.Count >> 2); bool foundNew = false; foreach (string indexName in names) { // Must match "pack-[0-9a-f]{40}.idx" to be an index. // if (indexName.Length != 49 || !indexName.EndsWith(".idx")) continue; string @base = indexName.Slice(0, indexName.Length - 4); string packName = IndexPack.GetPackFileName(@base); if (!names.Contains(packName)) { // Sometimes C Git's HTTP fetch transport leaves a // .idx file behind and does not download the .pack. // We have to skip over such useless indexes. // continue; } PackFile oldPack; forReuse.TryGetValue(packName, out oldPack); forReuse.Remove(packName); if (oldPack != null) { list.Add(oldPack); continue; } var packFile = new FileInfo(_packDirectory.FullName + "/" + packName); var idxFile = new FileInfo(_packDirectory + "/" + indexName); list.Add(new PackFile(idxFile, packFile)); foundNew = true; } // If we did not discover any new files, the modification time was not // changed, and we did not remove any files, then the set of files is // the same as the set we were given. Instead of building a new object // return the same collection. // if (!foundNew && lastModified == old.lastModified && forReuse.isEmpty()) return old.updateLastRead(lastRead); foreach (PackFile p in forReuse.Values) { p.Dispose(); } if (list.Count == 0) { return new PackList(lastRead, lastModified, NoPacks.packs);
public ActionResult Index() { List <PackList> newList = PackList.GetAll(); return(View(newList)); }