/// <summary> /// Process an asset definition /// </summary> /// <param name="xml"></param> protected bool ProcessAsset(XmlElement xml) { if (xml == null || xml.Name.ToLower() != "bank") { return(false); } // For each nodes, process it XmlNodeList nodes = xml.ChildNodes; foreach (XmlNode node in nodes) { if (node.NodeType == XmlNodeType.Comment) { continue; } //Provider provider = ResourceManager.GetTagProvider(node.Name); RegisteredAsset ra = ResourceManager.GetRegisteredByTag(node.Name); if (ra == null) { Trace.WriteLine("[StorageBase::Process()] No registered asset found for tag '" + node.Name + "'..."); continue; } //lock (BinaryLock) { ra.Load(node); } } return(true); }
/// <summary> /// Process all file in the storage /// </summary> /// <returns>True on succes</returns> public override bool Process() { Files.Clear(); // Add files to the list DirectoryInfo di = new DirectoryInfo(RootDirectory); foreach (FileInfo fi in di.GetFiles("*", SearchOption.AllDirectories)) { // Adds file to the list Files.Add(fi.FullName.Replace(RootDirectory, string.Empty)); if (!fi.FullName.EndsWith(".xml", true, null)) { continue; } // Convert to xml XmlDocument doc = new XmlDocument(); doc.Load(fi.FullName); // Check the root node XmlElement xml = doc.DocumentElement; if (xml.Name.ToLower() != "bank") { Trace.WriteLine(""); continue; } // For each nodes, process it foreach (XmlNode node in xml.ChildNodes) { if (node.NodeType == XmlNodeType.Comment) { continue; } //Provider provider = ResourceManager.GetTagProvider(node.Name); RegisteredAsset ra = ResourceManager.GetRegisteredByTag(node.Name); if (ra == null) { Trace.WriteLine("[FileSystemStorage::Process()] No registered asset found for tag <" + node.Name + ">..."); continue; } //lock (BinaryLock) { //provider.Load(node); ra.Load(node); } } Trace.WriteLine(""); } return(true); }