Пример #1
0
        public static void UseMyVueFiles(this IApplicationBuilder app, IHostingEnvironment HostingEnvironment,
                                         ILogger logger)
        {
            var bagsHolder = BagsHolder.Resolve();
            var myApp      = bagsHolder.GetBag("myApp", true);

            var vueComponents = myApp.MyGetIf("vueComponents", BagsHelper.Create(), true);
            //find *.vue auto register => wwwroot,
            var webRootPath     = HostingEnvironment.WebRootPath;     // => base/wwwroot
            var contentRootPath = HostingEnvironment.ContentRootPath; // => base
            //var areasPath = System.IO.Path.Combine(HostingEnvironment.ContentRootPath, "Areas"); // => base/Areas
            var vueFiles = Directory.GetFiles(contentRootPath, "*.vue", SearchOption.AllDirectories);

            foreach (var vueFile in vueFiles)
            {
                var fileInfo    = new FileInfo(vueFile);
                var requestPath = fileInfo.FullName
                                  .Replace(webRootPath, string.Empty, StringComparison.OrdinalIgnoreCase)
                                  .Replace(contentRootPath, string.Empty, StringComparison.OrdinalIgnoreCase)
                                  .Replace('\\', '/')
                                  .TrimEnd('/')
                                  .TrimStart('/');

                var componentKey = System.IO.Path.GetFileNameWithoutExtension(fileInfo.Name);

                vueComponents.MySet(componentKey, "/" + requestPath);
                //todo: support register by theme
                //todo: check same key and throws
                //todo: fix linux path case in boots static file logic
            }
        }
Пример #2
0
        public ClientConnection()
        {
            //Groups = new List<string>();
            var now = GetDateNow();

            CreateAt     = now;
            LastUpdateAt = now;
            ClientType   = string.Empty;
            Bags         = BagsHelper.Create();
        }
Пример #3
0
 public ClientMethodInvoke()
 {
     MethodArgs = new List <object>().ToArray();
     Bags       = BagsHelper.Create();
 }