Exemple #1
0
 public AttachGroup XMLConvert(AttachGroup v, XAttribute attr)
 {
     if (attr == null)
     {
         return(v);
     }
     return(new AttachGroup((string)attr.Parent.Attribute("name") ?? String.Empty, (string)attr));
 }
Exemple #2
0
 public AttachGroup XMLConvert(AttachGroup v, XElement el)
 {
     if (el == null)
     {
         return(v);
     }
     return(new AttachGroup((string)el.Attribute("name"), (string)el.Attribute("attachTiles")));
 }
Exemple #3
0
        public void XMLConvert(ObservableCollection <AttachGroup> v, XAttribute attr)
        {
            var oc = new ObservableCollection <AttachGroup>();

            if (string.IsNullOrWhiteSpace((string)attr))
            {
                return;
            }

            foreach (string ag in ((string)attr).Split(';'))
            {
                var newAG = new AttachGroup();
                newAG.Name = "Tile: " + this.Name;

                var      raw = ag;
                string[] ptf = raw.Split(':');
                if (ptf.Length == 2)
                {
                    newAG.Placement = (new FramePlacement()).Convert <FramePlacement>(ptf[0]);
                    raw             = ptf[1];
                }

                // Check for named AttachGroups
                if (Regex.IsMatch(raw, @"[a-zA-Z]+"))
                {
                    if (!_hasReadCache)
                    {
                        _readAttachGroups(attr.Parent);
                    }
                    raw = Regex.Replace(raw, @"\s", String.Empty);
                    foreach (var agc in _attachGroupsCache)
                    {
                        if (agc == raw)
                        {
                            if (agc.Placement != null && newAG.Placement == null)
                            {
                                newAG.Placement = agc.Placement;
                            }
                            newAG.AttachesTo = agc.AttachesTo;
                            break;
                        }
                    }
                }
                else
                {
                    AttachGroup.TryParse(raw, ref newAG);
                }

                oc.Add(newAG);
            }
            v.ReplaceRange(oc);
        }