/// <summary> /// Loads data asynchronously. This method is called via LoadData(string artefactIdentifier) to hide the asynchronous /// implementation from the caller as the implementation is not relevant to existing client code. /// /// In many cases, this function will run all-at-once; the function need only yield in the case where data has yet to /// be loaded from disk or over the network /// </summary> /// <param name="artefactIdentifier">The identifier of the artefact to load</param> private IEnumerator LoadDataAsync(string artefactIdentifier) { Debug.Log("ContextPanel_InfoController.LoadDataAsync"); InfoMode.SwitchMode("info"); artefactId = artefactIdentifier; // If the DublinCoreReader has not been populated with data by some preceding operation, populate it now if (!DublinCoreReader.HasXml()) { Debug.Log("Populateding DublinCoreReader"); UnityWebRequest www = UnityWebRequest.Get(Paths.ArtefactMetadata); yield return(www.Send()); if (www.isError) { Debug.Log("There was an error downloading artefact information: " + www.error); } else { DublinCoreReader.LoadXmlFromText(www.downloadHandler.text); } } Dictionary <string, Dictionary <string, string[]> > data = DublinCoreReader.GetArtefactWithIdentifier(artefactIdentifier); ArtefactInfoLoad(data); ContextInfoLoad(data); ObjectInfoLoad(data); MediaInfoLoad(data); MeshInfoLoad(data); }
public void TestBasicMetadataReading_01() { Dictionary <string, Dictionary <string, string[]> > metadata = DublinCoreReader.GetArtefactWithIdentifier("TestMonk"); // Check that both titles are represented Assert.That(metadata ["descriptive"] ["title"] [0] == "Test Monk" || metadata ["descriptive"] ["title"] [0] == "Doog"); Assert.That(metadata ["descriptive"] ["title"] [1] == "Test Monk" || metadata ["descriptive"] ["title"] [1] == "Doog"); // Check that the number of keys in each dictionary makes sense Assert.That(metadata["descriptive"].Keys.Count == 4); // Title, Description, Creator, Date Assert.That(metadata["structural"].Keys.Count == 5); // Creator, Created, Description, Identifier, Extent // Check that the content makes sense Assert.That(metadata["descriptive"]["description"][0] == "Model for testing Vertice Archive connection"); Assert.That(metadata["descriptive"]["creator"][0] == "Blender Org"); Assert.That(metadata["descriptive"]["date"][0] == "2016/04/13"); Assert.That(metadata["structural"]["creator"][0] == "Ryan Achten"); Assert.That(metadata["structural"]["created"][0] == "2016/04/13"); Assert.That(metadata["structural"]["description"][0] == "Created in Blender"); Assert.That(metadata["structural"]["identifier"][0] == "Doog.obj"); Assert.That(metadata["structural"]["extent"][0] == "1.5 scale"); }
public void TestBasicMetadataReading_Invalid() { Dictionary <string, Dictionary <string, string[]> > metadata = DublinCoreReader.GetArtefactWithIdentifier("DOES NOT EXIST"); }