public static NexusMod Deserialize(string json) { var mod = new NexusMod(); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json)); var settings = new DataContractJsonSerializerSettings(); settings.UseSimpleDictionaryFormat = true; var serializer = new DataContractJsonSerializer(mod.GetType(), settings); mod = serializer.ReadObject(ms) as NexusMod; ms.Close(); return(mod); }
private void getURL_Click(object sender, RoutedEventArgs e) { nexusAPIURL = Nexus.NexusURLtoAPI(inputURL.Text.Trim()); string json = Nexus.GetNexusFileList(nexusAPIURL); var list = NexusFileList.Deserialize(json); fileList.ItemsSource = list.files; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(fileList.ItemsSource); view.SortDescriptions.Add(new SortDescription("file_id", ListSortDirection.Descending)); json = Nexus.GetNexusMod(nexusAPIURL); currentMod = NexusMod.Deserialize(json); }