コード例 #1
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            Name         = entry.Name;
            RpfFileEntry = entry;


            RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;

            if (resentry == null)
            {
                throw new Exception("File entry wasn't a resource! (is it binary data?)");
            }

            ResourceDataReader rd = new ResourceDataReader(resentry, data);

            //MemoryUsage = 0;

            try
            {
                Waypoints = rd.ReadBlock <WaypointRecordList>();
            }
            catch (Exception ex)
            {
                string err = ex.ToString();
            }



            Loaded = true;
        }
コード例 #2
0
        public static WaypointRecordList ReadXmlNode(XmlNode node)
        {
            if (node == null)
            {
                return(null);
            }
            var l = new WaypointRecordList();

            l.ReadXml(node);
            return(l);
        }
コード例 #3
0
        public static string GetXml(YwrFile ywr)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(XmlHeader);

            if (ywr?.Waypoints != null)
            {
                WaypointRecordList.WriteXmlNode(ywr.Waypoints, sb, 0);
            }

            return(sb.ToString());
        }
コード例 #4
0
        public static YwrFile GetYwr(XmlDocument doc, string inputFolder = "")
        {
            YwrFile r = new YwrFile();

            var node = doc.DocumentElement;

            if (node != null)
            {
                r.Waypoints = WaypointRecordList.ReadXmlNode(node);
            }

            r.Name = Path.GetFileName(inputFolder);

            return(r);
        }
コード例 #5
0
 public static void WriteXmlNode(WaypointRecordList l, StringBuilder sb, int indent, string name = "WaypointRecordList")
 {
     if (l == null)
     {
         return;
     }
     if ((l.Entries?.Data == null) || (l.Entries.Data.Count == 0))
     {
         YwrXml.SelfClosingTag(sb, indent, name);
     }
     else
     {
         YwrXml.OpenTag(sb, indent, name);
         l.WriteXml(sb, indent + 1);
         YwrXml.CloseTag(sb, indent, name);
     }
 }