public void Add(GikouBookEntry entry) { if (!this.entries.ContainsKey(entry.Key)) { // ない場合 this.entries.Add(entry.Key, new List <GikouBookEntry>()); } this.entries[entry.Key].Add(entry); }
public static GikouBookEntry FromBytes(byte[] data, int ofs) { GikouBookEntry entry = new GikouBookEntry(); entry.Key = BitConverter.ToInt64(data, ofs + 0); entry.Move.Set(BitConverter.ToUInt32(data, ofs + 8)); entry.Frequency = BitConverter.ToUInt32(data, ofs + 12); entry.WinCount = BitConverter.ToUInt32(data, ofs + 16); entry.Opening = BitConverter.ToUInt32(data, ofs + 20); entry.Score = BitConverter.ToInt32(data, ofs + 24); return(entry); }
private void LoadEntrys(Stream sr) { byte[] data = new byte[GikouBookEntry.EntrySize]; while (true) { int len = sr.Read(data, 0, GikouBookEntry.EntrySize); if (len < GikouBookEntry.EntrySize) { break; } GikouBookEntry entry = GikouBookEntry.FromBytes(data, 0); this.Add(entry); } }
/// <summary> /// 追加 /// </summary> public void Add(long key, uint frequency, uint win_count, int score, GikouMove move) { GikouBookEntry entry = new GikouBookEntry() { Key = key, Move = move, Frequency = frequency, WinCount = win_count, Score = score, }; if (!this.entries.ContainsKey(key)) { // ない場合 this.entries.Add(key, new List <GikouBookEntry>()); } this.entries[key].Add(entry); }