public async Task<bool> SetCurrent(string url) { if (!await HasData(url)) { return false; } url = url.TrimStart('/'); CurrentPath = url; if (!HasOutline) { ChmMeta.SetLast(CurrentPath); return false; } if (Current >= 0 && Current < Chm.Contents.Count && string.Compare(url, Chm.Contents[Current].Url, StringComparison.OrdinalIgnoreCase) == 0) { return true; } for (int i = 0; i < Chm.Contents.Count; ++i) { if (string.Compare(url, Chm.Contents[i].Url, StringComparison.OrdinalIgnoreCase) == 0) { return await SetCurrent(i); } } return false; }
private void SetCurrentInternal(int index) { string url = Chm.Contents[index].Url; Current = index; CurrentPath = url; ChmMeta.SetLast(CurrentPath); }