예제 #1
0
        public bool AddYbnFile(YbnFile ybn)
        {
            string relpath = GetRelativePath(ybn.FilePath);

            if (string.IsNullOrEmpty(relpath))
            {
                relpath = ybn.Name;
            }
            if (YndFilenames.Contains(relpath))
            {
                return(false);
            }
            YbnFilenames.Add(relpath);
            YbnFiles.Add(ybn);
            return(true);
        }
예제 #2
0
        public void RemoveYbnFile(YbnFile ybn)
        {
            if (ybn == null)
            {
                return;
            }
            var relpath = GetRelativePath(ybn.FilePath);

            if (string.IsNullOrEmpty(relpath))
            {
                relpath = ybn.Name;
            }
            YbnFiles.Remove(ybn);
            YbnFilenames.Remove(relpath);
            HasChanged = true;
        }
예제 #3
0
        public void Load(string filepath)
        {
            FileInfo fi = new FileInfo(filepath);

            Filename = fi.Name;
            Filepath = filepath;

            XmlDocument doc = new XmlDocument();

            doc.Load(filepath);

            var projelem = doc.DocumentElement;

            Name    = Xml.GetChildInnerText(projelem, "Name");
            Version = Xml.GetChildIntAttribute(projelem, "Version", "value");

            YmapFilenames.Clear();
            YmapFiles.Clear();
            var ymapselem = Xml.GetChild(projelem, "YmapFilenames");

            if (ymapselem != null)
            {
                foreach (var node in ymapselem.SelectNodes("Item"))
                {
                    XmlElement ymapel = node as XmlElement;
                    if (ymapel != null)
                    {
                        AddYmapFile(ymapel.InnerText);
                    }
                }
            }


            YtypFilenames.Clear();
            YtypFiles.Clear();
            var ytypselem = Xml.GetChild(projelem, "YtypFilenames");

            if (ytypselem != null)
            {
                foreach (var node in ytypselem.SelectNodes("Item"))
                {
                    XmlElement ytypel = node as XmlElement;
                    if (ytypel != null)
                    {
                        AddYtypFile(ytypel.InnerText);
                    }
                }
            }


            YbnFilenames.Clear();
            YbnFiles.Clear();
            var ybnselem = Xml.GetChild(projelem, "YbnFilenames");

            if (ybnselem != null)
            {
                foreach (var node in ybnselem.SelectNodes("Item"))
                {
                    XmlElement ybnel = node as XmlElement;
                    if (ybnel != null)
                    {
                        AddYbnFile(ybnel.InnerText);
                    }
                }
            }


            YndFilenames.Clear();
            YndFiles.Clear();
            var yndselem = Xml.GetChild(projelem, "YndFilenames");

            if (yndselem != null)
            {
                foreach (var node in yndselem.SelectNodes("Item"))
                {
                    XmlElement yndel = node as XmlElement;
                    if (yndel != null)
                    {
                        AddYndFile(yndel.InnerText);
                    }
                }
            }



            YnvFilenames.Clear();
            YnvFiles.Clear();
            var ynvselem = Xml.GetChild(projelem, "YnvFilenames");

            if (ynvselem != null)
            {
                foreach (var node in ynvselem.SelectNodes("Item"))
                {
                    XmlElement ynvel = node as XmlElement;
                    if (ynvel != null)
                    {
                        AddYnvFile(ynvel.InnerText);
                    }
                }
            }


            TrainsFilenames.Clear();
            TrainsFiles.Clear();
            var trainsselem = Xml.GetChild(projelem, "TrainsFilenames");

            if (trainsselem != null)
            {
                foreach (var node in trainsselem.SelectNodes("Item"))
                {
                    XmlElement trainel = node as XmlElement;
                    if (trainel != null)
                    {
                        AddTrainsFile(trainel.InnerText);
                    }
                }
            }



            ScenarioFilenames.Clear();
            ScenarioFiles.Clear();
            var scenarioselem = Xml.GetChild(projelem, "ScenarioFilenames");

            if (scenarioselem != null)
            {
                foreach (var node in scenarioselem.SelectNodes("Item"))
                {
                    XmlElement scenarioel = node as XmlElement;
                    if (scenarioel != null)
                    {
                        AddScenarioFile(scenarioel.InnerText);
                    }
                }
            }



            AudioRelFilenames.Clear();
            AudioRelFiles.Clear();
            var audiorelselem = Xml.GetChild(projelem, "AudioRelFilenames");

            if (audiorelselem != null)
            {
                foreach (var node in audiorelselem.SelectNodes("Item"))
                {
                    XmlElement audiorelel = node as XmlElement;
                    if (audiorelel != null)
                    {
                        AddAudioRelFile(audiorelel.InnerText);
                    }
                }
            }


            YdrFilenames.Clear();
            YdrFiles.Clear();
            var ydrselem = Xml.GetChild(projelem, "YdrFilenames");

            if (ydrselem != null)
            {
                foreach (var node in ydrselem.SelectNodes("Item"))
                {
                    XmlElement ydrel = node as XmlElement;
                    if (ydrel != null)
                    {
                        AddYdrFile(ydrel.InnerText);
                    }
                }
            }


            YddFilenames.Clear();
            YddFiles.Clear();
            var yddselem = Xml.GetChild(projelem, "YddFilenames");

            if (yddselem != null)
            {
                foreach (var node in yddselem.SelectNodes("Item"))
                {
                    XmlElement yddel = node as XmlElement;
                    if (yddel != null)
                    {
                        AddYddFile(yddel.InnerText);
                    }
                }
            }


            YftFilenames.Clear();
            YftFiles.Clear();
            var yftselem = Xml.GetChild(projelem, "YftFilenames");

            if (yftselem != null)
            {
                foreach (var node in yftselem.SelectNodes("Item"))
                {
                    XmlElement yftel = node as XmlElement;
                    if (yftel != null)
                    {
                        AddYftFile(yftel.InnerText);
                    }
                }
            }


            YtdFilenames.Clear();
            YtdFiles.Clear();
            var ytdselem = Xml.GetChild(projelem, "YtdFilenames");

            if (ytdselem != null)
            {
                foreach (var node in ytdselem.SelectNodes("Item"))
                {
                    XmlElement ytdel = node as XmlElement;
                    if (ytdel != null)
                    {
                        AddYtdFile(ytdel.InnerText);
                    }
                }
            }
        }