static void Main(string[] args) { string ModuleXML; if (EFI.GetModuleXML("DataSource", out ModuleXML)) { Console.WriteLine("DataSource Module XML follows:\n{0}", ModuleXML); } else { Console.WriteLine("DataSource Module XML not found!"); } //Console.WriteLine(EFI.GetModuleXML("DataSink")); //Console.WriteLine(EFI.VerifyRunfile("stuff")); }
//Kind of annoying that you have to cast it, but better than making three versions. #region Eliminated String Index Method /* * public EfiXmlData this[string ModuleName, string IOPName, string IOPType] * { * * get * { * ModuleXML tempModuleXML = null; * string TempModuleName = ModuleName; * * //change some stuff about * //TempModuleName = TempModuleName.Replace(" ", ""); * //TempModuleName = TempModuleName.toLower(); * * * //send the module back * foreach (ModuleXML theModuleXML in ModuleXmlList) * { * if (theModuleXML.theModuleXmlInformation.ModuleXMLExecutablename.ToLower() == ModuleName.ToLower()) * tempModuleXML = theModuleXML; * } * throw new IndexOutOfRangeException("The requested module executable \"" + ModuleName + "\" was not found in the Module Directory"); * * * * switch (IOPType.ToLower()) * { * case "parameter": * foreach (ModuleXmlParameter MXParameter in tempModuleXML.theModuleXmlParameters) * { * if (MXParameter.ParameterType.ToLower() == IOPType.ToLower()) * return MXParameter; * } * return null; //blah blah * * case "output": * * foreach (ModuleXmlInput MXInput in tempModuleXML.theModuleXmlInputs) * { * if (MXInput.InputType.ToLower() == IOPType.ToLower()) * return MXInput; * } * * // return null; //blah blah * * case "input": * * foreach (ModuleXmlOutput MXOutput in tempModuleXML.theModuleXmlOutputs) * { * if (MXOutput.OutputType.ToLower() == IOPType.ToLower()) * return MXOutput; * } * * return null; //blah blah * * //has to be some error here * } * return null; // blah blah * * } * * } */ #endregion // // basically i can use this to return whatever is necessary // either the Module or the specific thing. // but it will have to be cast first to be used. #endregion #region Constructors //Okay here is a constructor! // //Takes in Module XML string list //For each of these lists might do the following //1.) Interact with the EFI //2.) Just load them out of the directory for now. public ModuleDirectory(string[] UniqueEarlabModuleXMLs) { string LoadXmlItem; //string ModuleXMLDocument; //Sends the list of all the Modules we want. //theDescriptorList //Create the proper path as a //C:\Documents and Settings\Jon\My Documents\Visual Studio 2005\Projects\Earlab-SPG-Tester-JLW\WindowsApplication4\XML Docs\DataSource.xml'. //C:\Documents and Settings\Jon\My Documents\Visual Studio 2005\Projects\Runfile Editor\Runfile Editor\XML Docs //1.) Initize and Load XML Document int count = 0; //string ModuleXmlPathStart; //string ModuleXmlPath; //ModuleXmlPathStart = "C:\\Documents and Settings\\Jon\\My Documents\\Visual Studio 2005\\Projects\\Runfile Editor\\Runfile Editor\\XML Docs\\"; //+ LoadXmlItem.ToString() + ".xml"; //replace in foreach here is where we while (count < UniqueEarlabModuleXMLs.Length) { //1.) Get Name XmlDocument ModuleXMLDocument = new XmlDocument(); LoadXmlItem = UniqueEarlabModuleXMLs[count]; ////Create the proper path as a ////C:\Documents and Settings\Jon\My Documents\Visual Studio 2005\Projects\Earlab-SPG-Tester-JLW\WindowsApplication4\XML Docs\DataSource.xml'. //[Here is where We interact with the EFIInteraction] //ModuleXmlPath = ModuleXmlPathStart.ToString() + LoadXmlItem.ToString() + ".xml"; //efi rather than our path string ModuleXMLstr; //EFI.GetModuleXML(LoadXmlItem, out ModuleXMLstr); if (EFI.GetModuleXML(LoadXmlItem, out ModuleXMLstr)) { ModuleXMLDocument.Load(new StringReader(ModuleXMLstr)); } else { //error!!! } //Add try -- fail error //Load it from ModuleXML directory for now //(Problem is here now 3/31) //ModuleXMLDocument.Load(ModuleXmlPath); //2.) Load Document from Module Directory //ModuleXMLDocument.Load(LoadXmlItem); //2.) Add the Name ModuleXmlList.Add(new ModuleXML(ModuleXMLDocument)); ///----if not there, then put in as "null" count++; } }