/// <summary>Retrieves an existing session from the file system and initialises this instance with the relevant data.</summary> protected override sealed bool ReadSession() { var file = Path.Combine(SessionPath, SessionID); lock (_lock) { if (!File.Exists(file)) { return(false); } ClassifyXml.DeserializeFileIntoObject(file, this); } return(true); }
} // for Classify /// <summary> /// Constructs a new instance by loading an existing summoner data file.</summary> /// <param name="filename"> /// File to load the summoner data from. This filename is also used to save summoner data and to infer the /// directory name for API response cache.</param> public SummonerInfo(string filename) { if (filename == null) { throw new ArgumentNullException(nameof(filename)); } _filename = filename; if (!File.Exists(_filename)) { throw new ArgumentException($"Summoner data file not found: \"{filename}\".", nameof(filename)); } ClassifyXml.DeserializeFileIntoObject(filename, this); if (Region == null || AccountId == 0 || SummonerId == 0) { throw new InvalidOperationException($"Summoner data file does not contain the minimum required data."); } Region = Region.ToUpper(); }