public static XS__documentation[] Load_fromURI( XS__RootMetadata root_ref_in, params Uri[] filePath_in ) { XS__documentation[] _output = new XS__documentation[filePath_in.Length]; for (int i = 0; i < filePath_in.Length; i++) { if (filePath_in[i].IsFile) { _output[i] = XS__documentation.Load_fromFile( filePath_in[i].LocalPath )[0]; // no need! everything's been taken care at: XS__documentation.Load_fromFile(...) //_output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + i + "]"; //_output[i].parent_ref = root_ref_in; // ToDos: now! //if (root_ref_in != null) _output[i].root_ref = root_ref_in; } else { try { _output[i] = (XS__documentation) new XmlSerializer(typeof(XS__documentation)).Deserialize( OGen.Libraries.PresentationLayer.WebForms.Utilities.ReadURL( filePath_in[i].ToString() ) ); } catch (Exception _ex) { throw new Exception(string.Format( System.Globalization.CultureInfo.CurrentCulture, "\n---\n{0}.{1}.Load_fromURI():\nERROR READING XML:\n{2}\n---\n{3}", typeof(XS__documentation).Namespace, typeof(XS__documentation).Name, //(filePath_in[i].IsFile) // ? filePath_in[i].LocalPath // : filePath_in[i].ToString(), _ex.Message )); } _output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + i + "]"; _output[i].parent_ref = root_ref_in; // ToDos: now! if (root_ref_in != null) { _output[i].root_ref = root_ref_in; } } } return(_output); }
public XS__RootMetadata( #endif string metadataFilePath_in ) { string _metadataPath = System.IO.Path.GetDirectoryName(metadataFilePath_in); this.metadatafiles_ = Metadatas.Load_fromFile(metadataFilePath_in); #region int _total_xxx = ...; int _total_documentation = 0; for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++) { switch (this.metadatafiles_.MetadataFiles[f].XMLFileType) { case XS__documentation.DOCUMENTATION: _total_documentation++; break; } } #endregion #region string[] _xxxFilePath = new string[_total_xxx]; string[] _documentationFilePath = new string[ _total_documentation ]; #endregion _total_documentation = 0; for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++) { switch (this.metadatafiles_.MetadataFiles[f].XMLFileType) { case XS__documentation.DOCUMENTATION: _documentationFilePath[_total_documentation] = System.IO.Path.Combine( _metadataPath, this.metadatafiles_.MetadataFiles[f].XMLFileName ); _total_documentation++; break; } } this.documentationcollection_ = new XS__documentationCollection( XS__documentation.Load_fromFile( (XS__RootMetadata)this, _documentationFilePath ) ); }
public static XS__documentation[] Load_fromFile( XS__RootMetadata root_ref_in, params string[] filePath_in ) { FileStream _stream; XS__documentation[] _output = new XS__documentation[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__documentation) new XmlSerializer(typeof(XS__documentation)).Deserialize( _stream ); _stream.Close(); #if !NET_1_1 _stream.Dispose(); #endif } catch (Exception _ex) { throw new Exception(string.Format( System.Globalization.CultureInfo.CurrentCulture, "\n---\n{0}.{1}.Load_fromFile():\nERROR READING XML:\n{2}\n---\n{3}\n---\n{4}\n---\n", typeof(XS__documentation).Namespace, typeof(XS__documentation).Name, filePath_in[i], _ex.Message, _ex.InnerException )); } _output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + i + "]"; _output[i].parent_ref = root_ref_in; // ToDos: now! if (root_ref_in != null) { _output[i].root_ref = root_ref_in; } } return(_output); }
public static XS__documentation[] Load_fromFile( XS__RootMetadata root_ref_in, params string[] filePath_in ) { FileStream _stream; XS__documentation[] _output = new XS__documentation[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__documentation)new XmlSerializer(typeof(XS__documentation)).Deserialize( _stream ); _stream.Close(); #if !NET_1_1 _stream.Dispose(); #endif } catch (Exception _ex) { throw new Exception(string.Format( System.Globalization.CultureInfo.CurrentCulture, "\n---\n{0}.{1}.Load_fromFile():\nERROR READING XML:\n{2}\n---\n{3}\n---\n{4}\n---\n", typeof(XS__documentation).Namespace, typeof(XS__documentation).Name, filePath_in[i], _ex.Message, _ex.InnerException )); } _output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + i + "]"; _output[i].parent_ref = root_ref_in; // ToDos: now! if (root_ref_in != null) _output[i].root_ref = root_ref_in; } return _output; }
public static string translate( string text_in, XS__documentation root_in //DocMetadata root_in ) { string translate_out = text_in; string _translation; Match _matchingfields; while (( _matchingfields = fields_reg.Match(translate_out) ).Success) { switch (_matchingfields.Groups["command"].Value.ToLower()) { case "config": { _translation = root_in.Configs.ConfigCollection[ _matchingfields.Groups["params"].Value ].Value; break; } case "code": { _translation = "<div class='code'><pre>" + root_in.CodeSamples.CodeSampleCollection[ _matchingfields.Groups["params"].Value ].Code + "</pre></div>"; break; } case "link-external": { XS_linkType _link = root_in.Links.LinkCollection[ _matchingfields.Groups["params"].Value ]; _translation = string.Format( "<a href='{0}'>{1}</a>", _link.URL, _link.Name ); break; } default: { throw new Exception(string.Format( "unknown command: {0}", _matchingfields.Groups["command"].Value )); } } translate_out = _matchingfields.Groups["before"].Value + _translation + _matchingfields.Groups["after"].Value ; } return translate_out; // string translate_out = text_in; // int b, bb, be, e, eb, ee, m; // // e = -1; // while ((b = translate_out.IndexOf("${", e + 1)) >= 0) { // be = b + 2; // bb = b - 1; // // e = translate_out.IndexOf("}", be); // eb = e - 1; // // m = translate_out.IndexOf( // "::", // be, // eb - be + 1 // ); // // translate_out // = (b != 0) ? translate_out.Substring(0, b - 1) : "" // + "<" + m + ">" // + translate_out.Substring(e + 1); // } // // return translate_out; }
public static XS__documentation[] Load_fromURI( XS__RootMetadata root_ref_in, params Uri[] filePath_in ) { XS__documentation[] _output = new XS__documentation[filePath_in.Length]; for (int i = 0; i < filePath_in.Length; i++) { if (filePath_in[i].IsFile) { _output[i] = XS__documentation.Load_fromFile( filePath_in[i].LocalPath )[0]; // no need! everything's been taken care at: XS__documentation.Load_fromFile(...) //_output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + i + "]"; //_output[i].parent_ref = root_ref_in; // ToDos: now! //if (root_ref_in != null) _output[i].root_ref = root_ref_in; } else { try { _output[i] = (XS__documentation)new XmlSerializer(typeof(XS__documentation)).Deserialize( OGen.lib.presentationlayer.webforms.utils.ReadURL( filePath_in[i].ToString() ) ); } catch (Exception _ex) { throw new Exception(string.Format( "\n---\n{0}.{1}.Load_fromURI():\nERROR READING XML:\n{2}\n---\n{3}", typeof(XS__documentation).Namespace, typeof(XS__documentation).Name, //(filePath_in[i].IsFile) // ? filePath_in[i].LocalPath // : filePath_in[i].ToString(), _ex.Message )); } _output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + i + "]"; _output[i].parent_ref = root_ref_in; // ToDos: now! if (root_ref_in != null) _output[i].root_ref = root_ref_in; } } return _output; }
public XS__documentationCollection( XS__documentation[] documentationcollection_in ) : base ( documentationcollection_in ) { }
public XS__documentationCollection( #endif XS__documentation[] documentationcollection_in ) { documentationcollection_ = documentationcollection_in; }
public static string translate( string text_in, XS__documentation root_in //DocMetadata root_in ) { string translate_out = text_in; string _translation; Match _matchingfields; while (( _matchingfields = fields_reg.Match(translate_out) ).Success) { switch (_matchingfields.Groups["command"].Value.ToLower()) { case "config": { _translation = root_in.Configs.ConfigCollection[ _matchingfields.Groups["params"].Value ].Value; break; } case "code": { _translation = "<div class='code'><pre>" + root_in.CodeSamples.CodeSampleCollection[ _matchingfields.Groups["params"].Value ].Code + "</pre></div>"; break; } case "link-external": { XS_linkType _link = root_in.Links.LinkCollection[ _matchingfields.Groups["params"].Value ]; _translation = string.Format( "<a href='{0}'>{1}</a>", _link.URL, _link.Name ); break; } default: { throw new Exception(string.Format( "unknown command: {0}", _matchingfields.Groups["command"].Value )); } } translate_out = _matchingfields.Groups["before"].Value + _translation + _matchingfields.Groups["after"].Value ; } return(translate_out); // string translate_out = text_in; // int b, bb, be, e, eb, ee, m; // // e = -1; // while ((b = translate_out.IndexOf("${", e + 1)) >= 0) { // be = b + 2; // bb = b - 1; // // e = translate_out.IndexOf("}", be); // eb = e - 1; // // m = translate_out.IndexOf( // "::", // be, // eb - be + 1 // ); // // translate_out // = (b != 0) ? translate_out.Substring(0, b - 1) : "" // + "<" + m + ">" // + translate_out.Substring(e + 1); // } // // return translate_out; }