public static string Convert_NType( RootMetadata root_ref_in, string xsdType_in, out bool isStandardNType_out ) { isStandardNType_out = true; switch (xsdType_in) { case "xs:string": return "string"; case "xs:decimal": return "decimal"; case "xs:integer": return "int"; case "xs:boolean": return "bool"; case "xs:time": case "xs:date": return "DateTime"; default: isStandardNType_out = false; return string.Format( "{0}{1}", root_ref_in.ExtendedMetadata.Prefix, (root_ref_in == null) ? xsdType_in : root_ref_in.ExtendedMetadata.CaseTranslate(xsdType_in) ); } }
public static string Convert_NType( RootMetadata root_ref_in, string xsdType_in ) { bool isStandardNType_out; return Convert_NType( root_ref_in, xsdType_in, out isStandardNType_out ); }
// #region Methods... #region //public void New(...); // public void New( // string applicationPath_in, //string documentationName_in, // dNotifyBack notifyBack_in // ) { // if (notifyBack_in != null) notifyBack_in("creating...", true); // #region XS_Schema _metadata_temp = new XS_Schema(); ...; // XS_Schema _metadata_temp = new XS_Schema(); // _metadata_temp.DocumentationName = documentationName_in; // #endregion // // if (notifyBack_in != null) notifyBack_in("- generating xml file", true); // #region string _xmlfile = ...; // string _xmlfile = string.Format( // "{0}{1}OGenXSD-metadatas{1}MD_{2}.OGenXSD-metadata.xml", // /*0*/applicationPath_in, // /*1*/System.IO.Path.DirectorySeparatorChar, // /*2*/documentationName_in // ); // #endregion // _metadata_temp.SaveState_toFile(_xmlfile); // // if (notifyBack_in != null) notifyBack_in("... finished!", true); // if (notifyBack_in != null) notifyBack_in("", true); // // Open( // _xmlfile, // true, // notifyBack_in // ); // } #endregion // #region public void Open(...); public void Open( string filenameextendedmetadata_in, bool force_doNOTsave_in, dNotifyBack notifyBack_in ) { #region Checking... if (this.hasChanges) { if (!force_doNOTsave_in) { throw new Exception(string.Format("{0}.{1}.Open(): - must save before open", this.GetType().Namespace, this.GetType().Name)); } } #endregion filenameextendedmetadata_ = filenameextendedmetadata_in; if (notifyBack_in != null) notifyBack_in("opening...", true); if (notifyBack_in != null) notifyBack_in("- reading metadata from xml files", true); rootmetadata_ = RootMetadata.Load_fromFile( filenameextendedmetadata_, false ); if (notifyBack_in != null) notifyBack_in("... finished", true); }
public static RootMetadata Load_fromFile( string metadataFilepath_in, bool useMetacache_in ) { #region string _key = metadataFilepath_in; string _key = (useMetacache_in) ? metadataFilepath_in : null; #endregion if ( useMetacache_in && (metacache__ != null) && Metacache.Contains(_key) ) { return (RootMetadata)RootMetadata.Metacache[_key]; } else { RootMetadata _rootmetadata = new RootMetadata( metadataFilepath_in ); if (useMetacache_in) { RootMetadata.Metacache.Add( _key, _rootmetadata ); } return _rootmetadata; } }
public static ExtendedMetadata Load_fromFile( string filePath_in, RootMetadata root_ref_in ) { FileStream _stream = new FileStream( filePath_in, FileMode.Open, FileAccess.Read, FileShare.Read ); ExtendedMetadata _output; try { _output = (ExtendedMetadata)new XmlSerializer(typeof(ExtendedMetadata)).Deserialize( _stream ); } catch (Exception _ex) { throw new Exception(string.Format( "\n---\n{0}.{1}.Load_fromFile(): - ERROR READING XML:\n{2}\n---\n{3}", typeof(ExtendedMetadata).Namespace, typeof(ExtendedMetadata).Name, filePath_in, _ex.Message )); } _output.parent_ref = root_ref_in; // ToDos: now! if (root_ref_in != null) _output.root_ref = root_ref_in; return _output; }
public static XS_Schema[] Load_fromFile( RootMetadata root_ref_in, params string[] filePath_in ) { FileStream _stream; XS_Schema[] _output = new XS_Schema[filePath_in.Length]; for (int i = 0; i < filePath_in.Length; i++) { _stream = new FileStream( filePath_in[i], FileMode.Open, FileAccess.Read, FileShare.Read ); try { _output[i] = (XS_Schema)new XmlSerializer(typeof(XS_Schema)).Deserialize( _stream ); _output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]"; } catch (Exception _ex) { throw new Exception(string.Format( "\n---\n{0}.{1}.Load_fromFile(): - ERROR READING XML:\n{2}\n---\n{3}", typeof(XS_Schema).Namespace, typeof(XS_Schema).Name, filePath_in[i], _ex.Message )); } _output[i].parent_ref = root_ref_in; // ToDos: now! if (root_ref_in != null) _output[i].root_ref = root_ref_in; } return _output; }