private AliasListing Load() { var version = ReadByte(); switch (version) { case 1: { IntSize = ReadByte(); var count = ReadInt(); var listing = new AliasListing(); for (var i = 0; i < count; i++) { var alias = ReadString(); var id = ReadString(); listing[alias] = id; } CheckFullyRead(); return(listing); } default: throw new InvalidOperationException($"Unsupported key version: {version}"); } }
private void Save(AliasListing listing) { WriteByte(CurrentVersion); WriteByte(SystemIntSize); WriteInt(listing.Count); foreach (var alias in listing.Keys) { WriteString(alias); WriteString(listing[alias]); } }
private void Remove(AliasListing listing, string alias) { listing.Remove(alias); Save(listing); }
private void Add(AliasListing listing, KeyAlias key) { listing[key.Alias] = key.Id; Save(listing); }