internal static async void LoadFilesPromScript(string name) { int num = Function.Call <int>(Hash.GET_NUM_RESOURCE_METADATA, name, "file"); #if DEBUG Debug.WriteLine($"{num} files for {name}"); #endif for (int i = 0; i < num; i++) { var filename = Function.Call <string>(Hash.GET_RESOURCE_METADATA, name, "file", i); var data = Function.Call <string>(Hash.LOAD_RESOURCE_FILE, name, filename); Utils.DebugWriteLine($"Checking {filename}"); if (Path.GetExtension(filename).ToLower() == ".xml") { if (VCF.isValidData(data)) { VcfData.Add(new Tuple <string, string, string>(name, filename, data)); } else { #if DEBUG Utils.DebugWriteLine($"XML data for {filename} is not valid"); #endif } } } }
internal static async void LoadFilesPromScript(string name) { int num = Function.Call <int>(Hash.GET_NUM_RESOURCE_METADATA, name, "file"); for (int i = 0; i < num; i++) { var filename = Function.Call <string>(Hash.GET_RESOURCE_METADATA, name, "file", i); var data = Function.Call <string>(Hash.LOAD_RESOURCE_FILE, name, filename); if (Path.GetExtension(filename).ToLower() == ".xml") { try { if (VCF.isValidData(data)) { VcfData.Add(new Tuple <string, string, string>(name, filename, data)); } } catch (XMLParsingException e) { Utils.ReleaseWriteLine($"There was a parsing error in {filename} please validate this XML and try again."); } } } }
internal static void checkFiles(string name, FileInfo[] files) { foreach (FileInfo f in files) { Utils.DebugWriteLine($"Checking {f.FullName}"); if (Path.GetExtension(f.Name).ToLower() == ".xml") { string data = File.ReadAllText(f.FullName); try { if (VCF.isValidData(data)) { VcfData.Add(new Tuple <string, string, string>(name, f.Name, data)); Utils.DebugWriteLine($"Added {f.Name} to parsed list"); } else { Utils.DebugWriteLine($"XML data for {f.Name} is not valid"); } } catch (XMLParsingException e) { Utils.ReleaseWriteLine($"There was a parsing error in {f.Name} please validate this XML and try again."); Utils.ReleaseWriteLine($"{f.Name} has an error of {e.Message}"); } } } }