Example #1
0
        private static Facet Convert(LocationsList list)
        {
            var f = new Facet();

            var categories = new StringCollection();

            foreach (var loc in list.Places)
            {
                if (!categories.Contains(loc.Category))
                {
                    categories.Add(loc.Category);
                }
            }

            foreach (var cat in categories)
            {
                var g = new GenericNode(cat);
                f.Nodes.Add(g);
            }

            foreach (var g in f.Nodes)
            {
                var sub = new StringCollection();

                foreach (var loc in list.Places)
                {
                    if (loc.Category == g.Name && !sub.Contains(loc.Subsection))
                    {
                        sub.Add(loc.Subsection);
                    }
                }

                foreach (var s in sub)
                {
                    var gSub = new GenericNode(s);
                    g.Elements.Add(gSub);
                }
            }

            foreach (var gCat in f.Nodes)
            {
                foreach (GenericNode gSub in gCat.Elements)
                {
                    foreach (var loc in list.Places)
                    {
                        if (loc.Category == gCat.Name && loc.Subsection == gSub.Name)
                        {
                            gSub.Elements.Add(Convert(loc));
                        }
                    }
                }
            }

            return(f);
        }
Example #2
0
		private static TheBox.Data.Facet Convert( LocationsList list )
		{
			TheBox.Data.Facet f = new TheBox.Data.Facet();

			StringCollection categories = new StringCollection();

			foreach( Location loc in list.Places )
			{
				if ( ! categories.Contains( loc.Category ) )
				{
					categories.Add( loc.Category );
				}
			}

			foreach( string cat in categories )
			{
				TheBox.Common.GenericNode g = new TheBox.Common.GenericNode( cat );
				f.Nodes.Add( g );
			}

			foreach( TheBox.Common.GenericNode g in f.Nodes )
			{
				StringCollection sub = new StringCollection();

				foreach( Location loc in list.Places )
				{
					if ( loc.Category == g.Name && ! sub.Contains( loc.Subsection ) )
					{
						sub.Add( loc.Subsection );
					}
				}

				foreach( string s in sub )
				{
					TheBox.Common.GenericNode gSub = new TheBox.Common.GenericNode( s );
					g.Elements.Add( gSub );
				}
			}

			foreach( TheBox.Common.GenericNode gCat in f.Nodes )
			{
				foreach( TheBox.Common.GenericNode gSub in gCat.Elements )
				{
					foreach( Location loc in list.Places )
					{
						if ( loc.Category == gCat.Name && loc.Subsection == gSub.Name )
						{
							gSub.Elements.Add( Convert( loc ) );
						}
					}
				}
			}

			return f;
		}
Example #3
0
        private static TheBox.Data.Facet Convert(LocationsList list)
        {
            TheBox.Data.Facet f = new TheBox.Data.Facet();

            StringCollection categories = new StringCollection();

            foreach (Location loc in list.Places)
            {
                if (!categories.Contains(loc.Category))
                {
                    categories.Add(loc.Category);
                }
            }

            foreach (string cat in categories)
            {
                TheBox.Common.GenericNode g = new TheBox.Common.GenericNode(cat);
                f.Nodes.Add(g);
            }

            foreach (TheBox.Common.GenericNode g in f.Nodes)
            {
                StringCollection sub = new StringCollection();

                foreach (Location loc in list.Places)
                {
                    if (loc.Category == g.Name && !sub.Contains(loc.Subsection))
                    {
                        sub.Add(loc.Subsection);
                    }
                }

                foreach (string s in sub)
                {
                    TheBox.Common.GenericNode gSub = new TheBox.Common.GenericNode(s);
                    g.Elements.Add(gSub);
                }
            }

            foreach (TheBox.Common.GenericNode gCat in f.Nodes)
            {
                foreach (TheBox.Common.GenericNode gSub in gCat.Elements)
                {
                    foreach (Location loc in list.Places)
                    {
                        if (loc.Category == gCat.Name && loc.Subsection == gSub.Name)
                        {
                            gSub.Elements.Add(Convert(loc));
                        }
                    }
                }
            }

            return(f);
        }
Example #4
0
        public static TheBox.Data.Facet Convert(string filename)
        {
            LocationsList   single = TheBox.Common.Utility.LoadXml(typeof(LocationsList), filename) as LocationsList;
            CustomLocations cust   = TheBox.Common.Utility.LoadXml(typeof(CustomLocations), filename) as CustomLocations;

            if (single == null)
            {
                cust = TheBox.Common.Utility.LoadXml(typeof(CustomLocations), filename) as CustomLocations;

                if (cust == null)
                {
                    return(null);
                }
            }

            if (single != null)
            {
                return(Convert(single));
            }
            else
            {
                PB1ImportForm form = new PB1ImportForm();
                form.ShowDialog();

                switch (form.Map)
                {
                case 0: return(Convert(cust.Felucca));

                case 1: return(Convert(cust.Felucca));

                case 2: return(Convert(cust.Ilshenar));

                case 3: return(Convert(cust.Malas));
                }
            }

            return(null);
        }
Example #5
0
 public CustomLocations()
 {
     Felucca  = new LocationsList();
     Ilshenar = new LocationsList();
     Malas    = new LocationsList();
 }
Example #6
0
		public CustomLocations()
		{
			Felucca = new LocationsList();
			Ilshenar = new LocationsList();
			Malas = new LocationsList();
		}