예제 #1
0
        private static void LoadConstellationArt(string filename)
        {
            if (ConstellationArt == null)
            {
                ConstellationArt = new List <IImageSet>();
            }

            if (filename.ToLower() == "default.wtml" || !File.Exists(filename))
            {
                filename = ArtworkPath + "default.wtml";
            }


            ConstellationArt.Clear();
            Folder art = Folder.LoadFromFile(filename, false);

            foreach (IPlace place in art.Items)
            {
                if (place.BackgroundImageSet != null && FullNames.ContainsKey(place.BackgroundImageSet.Name))
                {
                    ConstellationArt.Add(place.BackgroundImageSet);
                }

                if (place.StudyImageset != null && FullNames.ContainsKey(place.StudyImageset.Name))
                {
                    ConstellationArt.Add(place.StudyImageset);
                }
            }
        }
        public override void ReadNames()
        {
            if (!FileOperation.Success)
            {
                return;
            }

            base.CheckLength();

            if (!Success)
            {
                return;
            }

            foreach (var name in Names)
            {
                string[] split  = name.Split(' ');
                int      length = split.Length;

                base.CheckAtleastOneGivenName(length);

                if (!Success)
                {
                    break;
                }

                string givenName = string.Empty;
                string lastName  = string.Empty;

                //split the last name and give name and store it in a dictionary
                for (int i = 0; i < length; i++)
                {
                    if (i == length - 1)
                    {
                        lastName = split[i];
                    }
                    else
                    {
                        givenName += split[i] + " ";
                    }
                }

                if (FullNames.ContainsKey(lastName))
                {
                    //there cannot be more than three given names for the same last name
                    base.CheckMoreThanThreeGivenName(FullNames[lastName].Count);

                    if (!Success)
                    {
                        break;
                    }
                    FullNames[lastName].Add(new GivenName()
                    {
                        Name = givenName
                    });
                }
                else
                {
                    FullNames.Add(lastName, new List <GivenName> {
                        new GivenName()
                        {
                            Name = givenName
                        }
                    });
                }
            }
        }