Пример #1
0
 public SqlPackage()
 {
     PackageId = "javascript_sql_factory";
     ScriptUri = "JavaScript.Manager.Sql.Scripts.sql.js";
     HostObjects.Add(new HostObject {
         Name = "xHost", Target = new ExtendedHostFunctions()
     });
 }
Пример #2
0
 public HttpPackage()
 {
     PackageId = "javascript_request_factory_http";
     HostObjects.Add(new HostObject {
         Name = "javascript_request_factory_http", Target = new NodeHttp()
     });
     //HostTypes.Add(new HostType{ Name="Buffer", Type = typeof(NodeBuffer)});
 }
Пример #3
0
 public TimerPackageExecutor()
 {
     PackageId = "javascript_timer_factory_timerExecutor";
     HostObjects.Add(new HostObject
     {
         Name   = "javascript_timer_factory_timerExecutor",
         Target = new TimerHelper()
     });
 }
Пример #4
0
 public HttpPackage()
 {
     PackageId = "http";
     HostObjects.Add(new HostObject {
         Name = "http", Target = new NodeHttp()
     });
     HostTypes.Add(new HostType {
         Name = "Buffer", Type = typeof(NodeBuffer)
     });
 }
Пример #5
0
 public LogExcutorPackage(object logExecutory = null)
 {
     PackageId = "javascript_log_factory_logExecutor";
     if (logExecutory != null)
     {
         var type = logExecutory as Type;
         if (type != null)
         {
             var isTarget = typeof(ILogExecutor).IsAssignableFrom(type);
             if (!isTarget)
             {
                 throw new NotSupportedException(type.Name + " is not implements ILogExecutor");
             }
             HostObjects.Add(new HostObject
             {
                 Name   = "javascript_log_factory_logExecutor",
                 Target = Activator.CreateInstance(type)
             });
         }
         else
         {
             var isTarget = typeof(AbstractLogExcutor).IsAssignableFrom(logExecutory.GetType());
             if (!isTarget)
             {
                 throw new NotSupportedException(logExecutory.GetType().Name + " is not implements AbstractLogExcutor");
             }
             HostObjects.Add(new HostObject
             {
                 Name   = "javascript_log_factory_logExecutor",
                 Target = logExecutory
             });
         }
     }
     else
     {
         HostObjects.Add(new HostObject {
             Name = "javascript_log_factory_logExecutor", Target = new ConsoleLogExecutor()
         });
     }
 }
Пример #6
0
        public WebViewExcutorPackage(object webViewExecutor)
        {
            PackageId = "javascript_webview_factory_webviewExecutor";
            var type = webViewExecutor as Type;

            if (type != null)
            {
                HostObjects.Add(new HostObject
                {
                    Name   = "javascript_webview_factory_webviewExecutor",
                    Target = Activator.CreateInstance(type)
                });
            }
            else
            {
                HostObjects.Add(new HostObject
                {
                    Name   = "javascript_webview_factory_webviewExecutor",
                    Target = webViewExecutor
                });
            }
        }
Пример #7
0
 public SqlExecutor(object sqlExecutory)
 {
     PackageId = "javascript_sql_factory_sqlExecutor";
     if (sqlExecutory != null)
     {
         var type = sqlExecutory as Type;
         if (type != null)
         {
             var isTarget = typeof(IDbExecutor).IsAssignableFrom(type);
             if (!isTarget)
             {
                 throw new NotSupportedException(type.Name + " is not implements IDbExecutor");
             }
             HostObjects.Add(new HostObject
             {
                 Name   = "javascript_sql_factory_sqlExecutor",
                 Target = Activator.CreateInstance(type)
             });
         }
         else
         {
             var isTarget = typeof(AbstractDbDefaultExecutor).IsAssignableFrom(sqlExecutory.GetType());
             if (!isTarget)
             {
                 throw new NotSupportedException(sqlExecutory.GetType().Name + " is not implements AbstractDbDefaultExecutor");
             }
             HostObjects.Add(new HostObject
             {
                 Name   = "javascript_sql_factory_sqlExecutor",
                 Target = sqlExecutory
             });
         }
     }
     else
     {
         throw new ArgumentException("sqlExecutory");
     }
 }