Пример #1
0
 static void Main(string[] args)
 {
     SetConsoleCtrlHandler(_handle, true);
     //AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
     //YarSystem.Init("YarApp.config");
     YarSystem.Init(YarSystem.AppModelEnum.Local, Path.GetDirectoryName(typeof(YarSystem).Assembly.CodeBase).Replace(@"file:\", ""), null);
     YarSystem.WriteLog("--------------------------------------------");
     YarSystem.Current.Start();
     CommandLine();
     YarSystem.Current.Stop();
 }
Пример #2
0
        protected void Application_Start()
        {
            YarSystem.Init(YarSystem.AppModelEnum.Web, Server.MapPath("~/"), null);
            var site = System.Web.Hosting.HostingEnvironment.ApplicationHost.GetVirtualPath();

            YarSystem.Current.ViewSite = site.TrimEnd('/');
            YarSystem.WriteLog("--------------------------------------------");
            YarSystem.Current.Start();

            Yar.Service.HttpApi.HttpApiServerUtils.RegisterWebApiForAspNet(GlobalConfiguration.Configuration);
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            if (YarSystem.Current.AppSettings["runtype"] == "release")
            {
                BundleTable.EnableOptimizations = true;
            }
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Пример #3
0
        // Control Event Handler
        public static bool OnControlEvent(ConsoleEvent consoleEvent)
        {
            bool handled = false;

            switch (consoleEvent)
            {
            case ConsoleEvent.CTRL_SHUTDOWN:
            case ConsoleEvent.CTRL_CLOSE:
                try
                {
                    YarSystem.Current.Stop(); handled = true;
                }
                catch (Exception ex)
                {
                    YarSystem.WriteLog(ex.ToString());
                }
                break;

            default:
                return(handled);
            }
            return(handled);
        }