GuiCompare.XMLAssembly.CreateFromFile C# (CSharp) Method

CreateFromFile() public static method

public static CreateFromFile ( string file ) : XMLAssembly
file string
return XMLAssembly
		public static XMLAssembly CreateFromFile (string file)
		{
			XmlDocument doc = new XmlDocument ();
			doc.Load (File.OpenRead (file));

			XmlNode node = doc.SelectSingleNode ("/assemblies/assembly");
			if (node != null) {
				XMLAssembly result = new XMLAssembly ();
				try {
					result.LoadData (node);
				} catch (Exception e) {
					Console.Error.WriteLine ("Error loading {0}: {1}\n{2}", file, e.Message, e);
					return null;
				}
				return result;
			}

			return null;
		}

Usage Example

 public MasterAssembly(string path)
     : base(path)
 {
     masterinfo = XMLAssembly.CreateFromFile(path);
     if (masterinfo == null)
     {
         throw new ArgumentException("Error loading masterinfo from " + path);
     }
     attributes = MasterUtils.GetAttributes(masterinfo.attributes);
 }