Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Xml;
  6. using System.Xml.Serialization;
  7.  
  8. namespace S4TunnelServer.XML
  9. {
  10.     [XmlType(AnonymousType = true)]
  11.     [XmlRoot(Namespace = "", IsNullable = false, ElementName = "S4_Items")]
  12.     public class S4Items
  13.     {
  14.         [XmlElement("Item")]
  15.         public ItemDto[] items { get; set; }
  16.     }
  17.  
  18.     [XmlType(AnonymousType = true)]
  19.     public class ItemDto
  20.     {
  21.         [XmlAttribute("ID")]
  22.         public uint ID { get; set; }
  23.  
  24.         [XmlAttribute("Color_Count")]
  25.         public uint Colors { get; set; }
  26.  
  27.         [XmlAttribute("Name")]
  28.         public string Name { get; set; }
  29.  
  30.         [XmlAttribute("Description")]
  31.         public string Description { get; set; }
  32.     }
  33.    
  34.     class Items
  35.     {
  36.         public static List<ItemDto> List = new List<ItemDto>();
  37.  
  38.         public static void LoadItems()
  39.         {
  40.             List = Reader.Deserialize<S4Items>("Items.xml").items.ToList();
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement