Esempio n. 1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (content != null)
                {
                    content.Unload();
                    content.Dispose();
                    content = null;
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        public static Container Load(Manager manager, string asset)
        {
            Container         win     = null;
            LayoutXmlDocument doc     = new LayoutXmlDocument();
            ArchiveManager    content = new ArchiveManager(manager.Game.Services);

            try {
                content.RootDirectory = manager.LayoutDirectory;

#if (!XBOX && !XBOX_FAKE)
                string file = content.RootDirectory + asset;

                if (File.Exists(file))
                {
                    doc.Load(file);
                }
                else
#endif
                {
                    doc = content.Load <LayoutXmlDocument>(asset);
                }


                if (doc != null && doc["Layout"]["Controls"] != null && doc["Layout"]["Controls"].HasChildNodes)
                {
                    XmlNode node = doc["Layout"]["Controls"].GetElementsByTagName("Control").Item(0);
                    string  cls  = node.Attributes["Class"].Value;
                    Type    type = Type.GetType(cls);

                    if (type == null)
                    {
                        cls  = "GodLesZ.Library.Xna.WindowLibrary.Controls." + cls;
                        type = Type.GetType(cls);
                    }

                    win = (Container)LoadControl(manager, node, type, null);
                }
            } finally {
                content.Dispose();
            }

            return(win);
        }
Esempio n. 3
0
		public static Container Load(Manager manager, string asset) {
			Container win = null;
			LayoutXmlDocument doc = new LayoutXmlDocument();
			ArchiveManager content = new ArchiveManager(manager.Game.Services);

			try {
				content.RootDirectory = manager.LayoutDirectory;

#if (!XBOX && !XBOX_FAKE)

				string file = content.RootDirectory + asset;

				if (File.Exists(file)) {
					doc.Load(file);
				} else

#endif
 {
					doc = content.Load<LayoutXmlDocument>(asset);
				}


				if (doc != null && doc["Layout"]["Controls"] != null && doc["Layout"]["Controls"].HasChildNodes) {
					XmlNode node = doc["Layout"]["Controls"].GetElementsByTagName("Control").Item(0);
					string cls = node.Attributes["Class"].Value;
					Type type = Type.GetType(cls);

					if (type == null) {
						cls = "GodLesZ.Library.Xna.WindowLibrary.Controls." + cls;
						type = Type.GetType(cls);
					}

					win = (Container)LoadControl(manager, node, type, null);
				}

			} finally {
				content.Dispose();
			}

			return win;
		}