Beispiel #1
0
        public void TestExe_gescom()
        {
            var st = System.Diagnostics.Stopwatch.StartNew();

            //string appAspNetPath = GetUserFolder() + @"\Source\Repos\jsnet\ContosoUniversity\bin\ContosoUniversity.dll";
            //@"D:\Utilisateurs\diphap\Downloads\BookService-master\BookService-master\BookService\bin\BookService.dll";
            //string appAspNetPath =  GetUserFolder() + @"\Source\Repos\jsnet\TestJsNetBridgeApp\bin\TestJsNetBridgeApp.dll";
            string appAspNetPath = "";

            //appAspNetPath = @"D:\Source\Repos\jsnet\WebApplication_vide\bin\WebApplication_vide.dll";
            //appAspNetPath = @"D:\Source\Quadratus\QuadraEden.m\QuadraEden - Copie\QuadraEdenMVC_UI\bin\QuadraEdenMVC_UI.dll";
            appAspNetPath = @"d:\source\quadratus\quadraedenmrtui - copie\quadraedenmvc_ui\bin\QuadraEdenMVC_UI.dll";
            AspMvcInfo api = new AspMvcInfo(appAspNetPath);

            string repertoire_destination = @"D:\Source\Repos";

            //api.WriteAllText(
            //    repertoire_destination + @"\jsnet\UnitTest_JsNetBridge\Users\Ceanota\test.js",
            //    repertoire_destination + @"\jsnet\UnitTest_JsNetBridge\Users\Ceanota\test.d.ts");

            api.WriteAllText(
                @"D:\Source\Repos\jsnet\WebApplication_vide\scripts\Diphap.JsNetBridge\Diphap.JsNetBridge.js",
                @"D:\Source\Repos\jsnet\WebApplication_vide\scripts\Diphap.JsNetBridge\Diphap.JsNetBridge.d.ts");
            st.Stop();
        }
Beispiel #2
0
        public void TestExeCore()
        {
            string appAspNetPath = "";

            appAspNetPath = @"D:\Source\Repos\jsnet\WebApplicationWinCore\bin\Release\net452\win7-x64\WebApplicationWinCore.exe";
            appAspNetPath = @"D:\Source\Repos\jsnet\WebApplicationWinCore\bin\Debug\net452\win7-x64\WebApplicationWinCore.exe";
            //appAspNetPath = @"D:\Source\Repos\jsnet\WebApplicationWinCore\bin\Debug\net452\WebApplicationWinCore.exe";
            AspMvcInfo api = new AspMvcInfo(appAspNetPath, true);
        }
Beispiel #3
0
        public void TestExe()
        {
            //string appAspNetPath = GetUserFolder() + @"\Source\Repos\jsnet\ContosoUniversity\bin\ContosoUniversity.dll";
            //@"D:\Utilisateurs\diphap\Downloads\BookService-master\BookService-master\BookService\bin\BookService.dll";
            //string appAspNetPath =  GetUserFolder() + @"\Source\Repos\jsnet\TestJsNetBridgeApp\bin\TestJsNetBridgeApp.dll";
            string     appAspNetPath = @"C:\tfs_cegid\Nouvelle_Gamme\QuadraEden - Copie\QuadraEdenMVC_UI\bin\QuadraEdenMVC_UI.dll";
            AspMvcInfo api           = new AspMvcInfo(appAspNetPath);

            //File.WriteAllText(GetUserFolder() + @"\Source\Repos\jsnet\UnitTest_JsNetBridge\Users\Ceanota\test.d.ts", api.ToTS());

            //api.WriteAllText(
            //    GetUserFolder() + @"\Source\Repos\jsnet\UnitTest_JsNetBridge\Users\Ceanota\test.js",
            //    GetUserFolder() + @"\Source\Repos\jsnet\UnitTest_JsNetBridge\Users\Ceanota\test.d.ts");

            api.WriteAllText(
                @"C:\tfs_cegid\Nouvelle_Gamme\QuadraEden - Copie\QuadraEdenMVC_UI\Scripts\Diphap.JsNetBridge\Diphap.JsNetBridge.js",
                @"C:\tfs_cegid\Nouvelle_Gamme\QuadraEden - Copie\QuadraEdenMVC_UI\Scripts\Diphap.JsNetBridge\Diphap.JsNetBridge.d.ts");
        }
Beispiel #4
0
        public void Test_()
        {
            List <AssemblySet> typeSetList = new List <Diphap.JsNetBridge.AssemblySet>();

            {
                string assemblyPath = @"C:\Users\diphap\Source\Repos\jsnet\SingleAppExample\bin\SingleAppExample.dll"; //@"C:\Users\diphap\Source\Repos\jsnet\ContosoUniversity\bin\ContosoUniversity.dll";

                AspMvcInfo api = new AspMvcInfo(assemblyPath, typeSetList);

                string jsCore = api.ToJS();

                StringBuilder sb = new StringBuilder();
                sb.AppendLine(File.ReadAllText(@"C:\Users\diphap\Source\Repos\jsnet\NuGet.Packager\content\Scripts\Diphap.JsNetBridge\arrayFactory.js"));
                sb.AppendLine(File.ReadAllText(@"C:\Users\diphap\Source\Repos\jsnet\NuGet.Packager\content\Scripts\Diphap.JsNetBridge\circularReferenceManagerFactory.js"));
                sb.AppendLine(jsCore);

                File.WriteAllText(@"C:\Users\diphap\Source\Repos\jsnet\UnitTest_JsNetBridge\Users\Ceanota\test.js", sb.ToString());
            }
        }
Beispiel #5
0
        public static void MainCore(string[] args)
        {
            try
            {
                Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
                Console.WriteLine(string.Format("{0}: BEGIN [{1}]", config.file_name_exe, DateTimeOffset.Now));
                
                Console.WriteLine(Assembly.GetExecutingAssembly().FullName);
                Console.WriteLine(Assembly.GetAssembly(typeof(Diphap.JsNetBridge.Data.ModelInfo)).FullName);
                Console.WriteLine(Assembly.GetAssembly(typeof(Diphap.JsNetBridge.Mvc.AspMvcInfo)).FullName);
                Console.WriteLine(Assembly.GetAssembly(typeof(Diphap.JsNetBridge.Mvc.Proxy.AssemblyInfoWrapper)).FullName);

                #region "First argument"
                string js_config = null;

                if (args.Length > 0)
                {
                    js_config = args[0];
                }
                #endregion

                config _config = config.ResolveAbsolutePathes(js_config);

                #region "validation"
                if (Directory.Exists(Path.GetDirectoryName(_config.file_js_absolute)) == false)
                {
                    var ex = new DirectoryNotFoundException("DirectoryNotFoundException =>" + Path.GetDirectoryName(_config.file_js_absolute));
                    Console.WriteLine(ex.Message);
                    throw ex;
                }

                if (File.Exists(_config.dll_asp_absolute) == false)
                {
                    var ex = new FileNotFoundException("FileNotFoundException =>" + _config.dll_asp_absolute, _config.dll_asp_absolute);
                    Console.WriteLine(ex.Message);
                    throw ex;
                }
                #endregion


                try
                {
                    Console.WriteLine(string.Format("Generate JS code - Begin  [{0}]", sw.Elapsed.TotalSeconds));


                    List<AssemblySet> assemblySetList = new List<Diphap.JsNetBridge.AssemblySet>();

                    if (_config.dll_set != null)
                    {
                        foreach (AssemblyConfig dto in _config.dll_set)
                        {
                            dto.validate(_config.asp_bin_absolute);
                            assemblySetList.Add(new AssemblySet(dto.file, dto.whitens_filters, dto.blackns_filters));
                        }
                    }

                    AspMvcInfo api = new AspMvcInfo(_config.dll_asp_absolute, assemblySetList, _config.isAspNetCoreWindows);
                    Console.WriteLine(string.Format("Instanciate AspMvcInfo - End [{0}]", sw.Elapsed.TotalSeconds));

                    #region "Generate Script codes"
                    //-- ts and js code.
                    api.WriteAllText(_config.file_js_absolute, _config.file_ts_absolute);
                    Console.WriteLine(string.Format("Generate JS and TS codes - api.WriteAllText({0}, {1}); - End [{2}]", 
                        _config.file_js_absolute, _config.file_ts_absolute, sw.Elapsed.TotalSeconds));
                    #endregion
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    throw ex;
                }
                sw.Stop();
                Console.WriteLine(string.Format("{0}: SUCCESS [{1} sec]", config.file_name_exe, sw.Elapsed.TotalSeconds));

            }
            catch (ReflectionTypeLoadException ex)
            {
                Console.WriteLine(DateTime.Now);
                foreach (var item in ex.LoaderExceptions)
                {
                    Console.WriteLine(item.Message);
                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
                throw ex;
            }



        }