Пример #1
0
        static void Main(string[] args)
        {
            bool   _found = false;
            string _file1 =
                System.IO.Path.Combine(
                                #if !NET_1_1
                    System.Configuration.ConfigurationManager.AppSettings
                                #else
                    System.Configuration.ConfigurationSettings.AppSettings
                                #endif
                    ["ogenPath"],

                    @"..\..\OGen-NTier_UTs\OGen-metadatas\MD_OGen-NTier_UTs.OGenXSD-metadata.xml"
                    )
            ;
            XS__RootMetadata _root = new XS__RootMetadata(
                _file1
                );

            Console.WriteLine(
                "null? '{0}'",
                (_root.Read_fromRoot(
                     "ROOT.metadataExtended[0].tables.table[0].tableSearches.tableSearch[0].name"
                     ) == null)
                );

            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[n].tables.table[n].tableSearches.tableSearch[n].tableSearchUpdates.tableSearchUpdate[n]",
                new OGen.lib.generator.utils.IterationFoundDelegate(notifyme),
                ref _found
                );
            Console.WriteLine(
                "found? '{0}'",
                _found
                );
            return;



            Console.WriteLine(
                "TableName: '{0}' : '{1}' : '{2}' : '{3}' : '{4}'",
                _root.Read_fromRoot("ROOT.metadataExtended[0].tables.table[0].name"),
                _root.Read_fromRoot("ROOT.metadataDB[0].tables.table[0].hasPK"),
                _root.Read_fromRoot("ROOT.metadataDB[0].tables.table[0].parallel_ref.name"),
                _root.Read_fromRoot("ROOT.metadataDB[0].tables.table[0].hasPK"),
                _root.Read_fromRoot("ROOT.metadataExtended[0].tables.table[0].parallel_ref.hasPK")
                );
            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[n].tables.table[n]",
                new OGen.lib.generator.utils.IterationFoundDelegate(notifyme),
                ref _found
                );
            Console.WriteLine((_found) ? "done!\n" : "nothing to do\n");

            Console.WriteLine(
                "SearchName: '{0}'",
                _root.Read_fromRoot("ROOT.metadataExtended[0].tables.table[0].tableSearches.tableSearch[0].name")
                );
            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[n].tables.table[n].tableSearches.tableSearch[n]",
                new OGen.lib.generator.utils.IterationFoundDelegate(notifyme),
                ref _found
                );
            Console.WriteLine((_found) ? "done!\n" : "nothing to do\n");


            Console.WriteLine();
            Console.ReadLine();
            return;

            #region             //test1...
            //string _file1 =
            //    System.IO.Path.Combine(
            //        #if !NET_1_1
            //        System.Configuration.ConfigurationManager.AppSettings
            //        #else
            //        System.Configuration.ConfigurationSettings.AppSettings
            //        #endif
            //            ["ogenPath"],

            //        //@"..\..\OGen-NTier_UTs\OGen-metadatas\MD_OGen-NTier_UTs.OGen-metadata.xml"
            //        @"..\..\OGen-NTier_UTs\OGen-metadatas\xxx_apagar.xml"
            //    )
            //;
            //string _file2 =
            //    System.IO.Path.Combine(
            //        #if !NET_1_1
            //        System.Configuration.ConfigurationManager.AppSettings
            //        #else
            //        System.Configuration.ConfigurationSettings.AppSettings
            //        #endif
            //            ["ogenPath"],

            //        //@"..\..\OGen-NTier_UTs\OGen-metadatas\MD0_OGen-NTier_UTs.OGen-metadata.xml"
            //        @"..\..\OGen-NTier_UTs\OGen-metadatas\xxx0_apagar.xml"
            //    )
            //;
            //DBServerTypes _aux_dbservertype = DBServerTypes.SQLServer;
            //cDBMetadata _aux_metadata;

            //_aux_metadata = new cDBMetadata();
            //#region //testings...
            ////_aux_metadata.LoadState_fromDB(
            ////    null,
            ////    DBServerTypes.SQLServer,
            ////    "server=127.0.0.1;uid=sa;pwd=passpub;database=OGen-NTier_UTs;",
            ////    "",
            ////    true
            ////);
            ////for (int t = 0; t < _aux_metadata.Tables.Count; t++) {
            ////    Console.WriteLine(_aux_metadata.Tables[t].Name);
            ////}
            ////return;
            //#endregion

            //_aux_metadata.LoadState_fromFile(
            //    _file1
            //);
            //Console.WriteLine("--- {0}", _aux_metadata.ApplicationName);
            //xpto(_aux_metadata);
            //_aux_metadata.SaveState_toFile(
            //    _file2
            //);

            //_aux_metadata = new cDBMetadata();
            //_aux_metadata.LoadState_fromFile(
            //    _file2
            //);
            //xpto(_aux_metadata);
            #endregion
        }
Пример #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine(
                System.Reflection.Assembly.GetExecutingAssembly().ImageRuntimeVersion
                );
            Console.ReadLine();
            return;

            Debug.Listeners.Add(new TextWriterTraceListener(System.Console.Out));

            //int x = 0;
            //Debug.WriteLine(x++);
            //Console.WriteLine(x);
            //return;

            bool   _found = false;
            string _file1 =
                System.IO.Path.Combine(
                                #if !NET_1_1
                    System.Configuration.ConfigurationManager.AppSettings
                                #else
                    System.Configuration.ConfigurationSettings.AppSettings
                                #endif
                    ["ogenPath"],

                    @"..\..\OGen-NTier_UTs\OGen-metadatas\MD_OGen-NTier_UTs.OGenXSD-metadata.xml"
                    )
            ;
            XS__RootMetadata _root = new XS__RootMetadata(
                _file1
                );

            string _aux;

            Console.WriteLine(
                "null? {0} \t\t '{1}'",
                ((_aux = _root.Read_fromRoot(
                      "ROOT.metadataExtended[0].tables.table[0].tableSearches.tableSearch[0].name"
                      )) == null),
                _aux
                );
            Console.WriteLine("-------------------------------------------------------------");

            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[0].tables.table[n].tableSearches.tableSearch[n].tableSearchUpdates.tableSearchUpdate[n]",
                delegate(string message_in) {
                Console.WriteLine("'{0}'", message_in);
            },
                ref _found
                );
            Console.WriteLine("-------------------------------------------------------------");

            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[n].tables.table[n].tableSearches.tableSearch[n].tableSearchUpdates.tableSearchUpdate[n]",
                delegate(string message_in) {
                Console.WriteLine("'{0}'", message_in);
            },
                ref _found
                );
            Console.WriteLine(
                "found? '{0}'",
                _found
                );
            Console.WriteLine("-------------------------------------------------------------");

            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[0].tables.table[n]",
                delegate(string message_in) {
                Console.WriteLine(
                    "{0}.name: '{1}'",
                    message_in,
                    _root.Read_fromRoot(
                        message_in + ".name"
                        )
                    );
            },
                ref _found
                );
            Console.WriteLine("-------------------------------------------------------------");

            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[0].tables.table[n].tableSearches.tableSearch[n]",
                delegate(string message_in) {
                Console.WriteLine("'{0}'", message_in);
            },
                ref _found
                );
            Console.WriteLine("-------------------------------------------------------------");
            return;



            Console.WriteLine(
                "TableName: '{0}' : '{1}' : '{2}' : '{3}' : '{4}'",
                _root.Read_fromRoot("ROOT.metadataExtended[0].tables.table[0].name"),
                _root.Read_fromRoot("ROOT.metadataDB[0].tables.table[0].hasPK"),
                _root.Read_fromRoot("ROOT.metadataDB[0].tables.table[0].parallel_ref.name"),
                _root.Read_fromRoot("ROOT.metadataDB[0].tables.table[0].hasPK"),
                _root.Read_fromRoot("ROOT.metadataExtended[0].tables.table[0].parallel_ref.hasPK")
                );
            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[n].tables.table[n]",
                delegate(string message_in) {
                Console.WriteLine(message_in);
            },
                ref _found
                );
            Console.WriteLine((_found) ? "done!\n" : "nothing to do\n");

            Console.WriteLine(
                "SearchName: '{0}'",
                _root.Read_fromRoot("ROOT.metadataExtended[0].tables.table[0].tableSearches.tableSearch[0].name")
                );
            _root.IterateThrough_fromRoot(
                "ROOT.metadataExtended[n].tables.table[n].tableSearches.tableSearch[n]",
                delegate(string message_in) {
                Console.WriteLine(message_in);
            },
                ref _found
                );
            Console.WriteLine((_found) ? "done!\n" : "nothing to do\n");


            Console.WriteLine();
            Console.ReadLine();
            return;

            #region             //test1...
            //string _file1 =
            //    System.IO.Path.Combine(
            //        #if !NET_1_1
            //        System.Configuration.ConfigurationManager.AppSettings
            //        #else
            //        System.Configuration.ConfigurationSettings.AppSettings
            //        #endif
            //            ["ogenPath"],

            //        //@"..\..\OGen-NTier_UTs\OGen-metadatas\MD_OGen-NTier_UTs.OGen-metadata.xml"
            //        @"..\..\OGen-NTier_UTs\OGen-metadatas\xxx_apagar.xml"
            //    )
            //;
            //string _file2 =
            //    System.IO.Path.Combine(
            //        #if !NET_1_1
            //        System.Configuration.ConfigurationManager.AppSettings
            //        #else
            //        System.Configuration.ConfigurationSettings.AppSettings
            //        #endif
            //            ["ogenPath"],

            //        //@"..\..\OGen-NTier_UTs\OGen-metadatas\MD0_OGen-NTier_UTs.OGen-metadata.xml"
            //        @"..\..\OGen-NTier_UTs\OGen-metadatas\xxx0_apagar.xml"
            //    )
            //;
            //DBServerTypes _aux_dbservertype = DBServerTypes.SQLServer;
            //cDBMetadata _aux_metadata;

            //_aux_metadata = new cDBMetadata();
            //#region //testings...
            ////_aux_metadata.LoadState_fromDB(
            ////    null,
            ////    DBServerTypes.SQLServer,
            ////    "server=127.0.0.1;uid=sa;pwd=passpub;database=OGen-NTier_UTs;",
            ////    "",
            ////    true
            ////);
            ////for (int t = 0; t < _aux_metadata.Tables.Count; t++) {
            ////    Console.WriteLine(_aux_metadata.Tables[t].Name);
            ////}
            ////return;
            //#endregion

            //_aux_metadata.LoadState_fromFile(
            //    _file1
            //);
            //Console.WriteLine("--- {0}", _aux_metadata.ApplicationName);
            //xpto(_aux_metadata);
            //_aux_metadata.SaveState_toFile(
            //    _file2
            //);

            //_aux_metadata = new cDBMetadata();
            //_aux_metadata.LoadState_fromFile(
            //    _file2
            //);
            //xpto(_aux_metadata);
            #endregion
        }
Пример #3
0
        static void Main(string[] args)
        {
            XS__RootMetadata _rootmetadata = XS__RootMetadata.Load_fromFile(
                System.IO.Path.Combine(
                                        #if !NET_1_1
                    System.Configuration.ConfigurationManager.AppSettings
                                        #else
                    System.Configuration.ConfigurationSettings.AppSettings
                                        #endif
                    ["ogenPath"],

                    @"..\..\OGen-NTier\OGen-NTier-Doc\OGenDoc-metadatas\MD_OGen.OGenDoc-metadata.xml"
                    ),
                false
                );

            Console.WriteLine(_rootmetadata.Read_fromRoot(
                                  //"ROOT.documentation[0].subjects.subject.Count"
                                  //"ROOT.documentation[0].documentationName"
                                  //"ROOT.documentation[0].subjects.subject[0].description"
                                  //"ROOT.documentation[0].subjects.subject[2].idSubject"
                                  //"ROOT.documentation[0].subjects.subject[18].documents.document[2].idDocument"
                                  "ROOT.documentation[0].subjects.subject[19].documents.document[1].document"

                                  ));
            _rootmetadata.IterateThrough_fromRoot(
                "ROOT.documentation[n].faqSubjects.faqSubject[n]",
                //"ROOT.documentation[n].subjects.subject[n]",
                Iteration_found
                );


//			#region test3 - translate bug...
//Console.WriteLine(OGen.Doc.lib.metadata.utils.translate(
//	@"---${code::1}
//---
//${code::1}
//---
//${code::1}
//---",
//	rootmetadata_.DocumentationCollection[0]
//));
//
//			return;
//			#endregion

            #region             //test2 - performance tweaks...
//			long _begin_ticks = DateTime.Now.Ticks;
//
//			string filename_
//				= System.IO.Path.Combine(
//					#if !NET_1_1
//					System.Configuration.ConfigurationManager.AppSettings
//					#else
//					System.Configuration.ConfigurationSettings.AppSettings
//					#endif
//						["ogenPath"],
//
//					@"..\..\OGen-NTier\OGen-NTier-Doc\OGenDoc-metadatas\MD_OGen.OGenDoc-metadata.xml"
//				);
//			string _outputDir = System.IO.Directory.GetParent(
//				Path.GetDirectoryName(filename_)
//			).FullName;
//
//			XS__RootMetadata rootmetadata_ = XS__RootMetadata.Load_fromFile(
//				filename_,
//				false
//			);
//
//			Console.WriteLine(
//				"--- instance:  -------------------------------\n{0}\n----------------------------------------------",
//				//rootmetadata_.DocumentationCollection[0].Subjects.SubjectCollection.Count
//				//rootmetadata_.DocumentationCollection[0].DocumentationName
//				//rootmetadata_.DocumentationCollection[0].Subjects.SubjectCollection[0].Description
//				//rootmetadata_.DocumentationCollection[0].Subjects.SubjectCollection[2].IDSubject
//				//rootmetadata_.DocumentationCollection[0].Subjects.SubjectCollection[18].Documents.DocumentCollection[2].IDDocument
//				rootmetadata_.DocumentationCollection[0].Subjects.SubjectCollection[19].Documents.DocumentCollection[1].Document
//			);
//			Console.WriteLine(
//				"--- reflection: ------------------------------\n{0}\n----------------------------------------------",
//				rootmetadata_.Read_fromRoot(
//					//"ROOT.documentation[0].subjects.subject.Count"
//					//"ROOT.documentation[0].documentationName"
//					//"ROOT.documentation[0].subjects.subject[0].description"
//					//"ROOT.documentation[0].subjects.subject[2].idSubject"
//					//"ROOT.documentation[0].subjects.subject[18].documents.document[2].idDocument"
//					"ROOT.documentation[0].subjects.subject[19].documents.document[1].document"
//				)
//			);
//			rootmetadata_.IterateThrough_fromRoot(
//				"ROOT.documentation[n].subjects.subject[n]",
//				//"ROOT.documentation[n].subjects.subject[n].documents.document[n]",
//				Iteration_found
//			);
//
//			Console.WriteLine("time: {0}", new DateTime(DateTime.Now.Ticks - _begin_ticks).ToString("HH'H' mm'm' ss's' fff"));
//			return;
            #endregion
            #region             //test1 - generator...
//			MetaFile[] _metafiles = new MetaFile[rootmetadata_.MetadataFiles.MetadataFiles.Count];
//			for (int i = 0; i < rootmetadata_.MetadataFiles.MetadataFiles.Count; i++) {
//				_metafiles[i] = new MetaFile(
//					Path.Combine(
//						Path.GetDirectoryName(filename_),
//						rootmetadata_.MetadataFiles.MetadataFiles[i].XMLFilename
//					),
//					XS__documentation.DOCUMENTATION
//				);
//			}
//			cGenerator _generator = new cGenerator(
//				#if !NET_1_1
//				System.Configuration.ConfigurationManager.AppSettings
//				#else
//				System.Configuration.ConfigurationSettings.AppSettings
//				#endif
//					["Templates"],
//				_outputDir,
//				_metafiles
//			);
//			_generator.Build(
//				Notify,
//				rootmetadata_
//			);
//			return;
            #endregion
        }