public void InitIndexFile(string filename) { XmlSerializer serializer = new XmlSerializer(_indexType, _indexExtraTypes); var version = new VersionModel("0.0.1.0", "http://www.sample.com/file.zip"); var collection = new VersionIndexModel(); collection.Versions.Add(version); using (TextWriter writer = new StreamWriter(filename)) serializer.Serialize(writer, collection); }
public IEnumerable <Version> RetrieveVersions() { IEnumerable <Version> result = new List <Version>(); var serializer = new XmlSerializer(_indexType, _indexExtraTypes); var reader = new XmlTextReader(_indexUrl); try { _versionIndexModel = (VersionIndexModel)serializer.Deserialize(reader); result = _versionIndexModel.Versions.Select(o => o.Version); } catch { RaiseError($"Error reading version index {_indexUrl}"); } return(result); }