public static MongoTestServer Start(UInt16 port) { var defaultFileSystem = new DefaultFileSystem(); var mongoExeLocator = new DefaultMongoExeLocator(defaultFileSystem); return(Start(port, mongoExeLocator, new DefaultProcessStarter(), defaultFileSystem)); }
/// <summary> /// 初始化对象 /// </summary> public WriterAppHost() { // 添加标准编辑器命令功能模块 this.CommandContainer.Modules.Add(new WriterCommandModuleBrowse()); this.CommandContainer.Modules.Add(new WriterCommandModuleEdit()); this.CommandContainer.Modules.Add(new WriterCommandModuleFile()); this.CommandContainer.Modules.Add(new WriterCommandModuleFormat()); this.CommandContainer.Modules.Add(new WriterCommandModuleInsert()); this.CommandContainer.Modules.Add(new WriterCommandModuleSecurity()); this.CommandContainer.Modules.Add(new WriterCommandModuleTools()); // 设置默认的调试输出对象 this.Services.Debugger = new WriterDebugger(); // 设置自己 this.Services.AddService(typeof(WriterAppHost), this); // 设置默认的文件系统对象 DefaultFileSystem fs = new DefaultFileSystem(); fs.OpenFileFilter = WriterStrings.XMLFilter; fs.SaveFileFilter = WriterStrings.XMLFilter; this.FileSystems[WriterConst.FS_KBLibrary] = fs; this.FileSystems[WriterConst.FS_KBListItem] = fs; fs = new DefaultFileSystem(); fs.OpenFileFilter = WriterStrings.StdOpenFileFilter; fs.SaveFileFilter = WriterStrings.StdSaveFileFilter; this.FileSystems[WriterConst.FS_Document] = fs; }
void Awake() { IFileSystem fileSystem; _mConsole = new MiniConsole(scrollRect, text, 100); _rt = ScriptEngine.CreateRuntime(); var fileResolver = new FileResolver(); fileResolver.AddSearchPath("node_modules"); if (fileLoader == FileLoader.Resources) { fileSystem = new ResourcesFileSystem(_mConsole); fileResolver.AddSearchPath("dist"); } else if (fileLoader == FileLoader.HMR) { Debug.LogWarningFormat("功能未完成"); fileSystem = new HttpFileSystem(_mConsole, baseUrl); } else { fileSystem = new DefaultFileSystem(_mConsole); fileResolver.AddSearchPath("Assets/Examples/Scripts/out"); // _rt.AddSearchPath("Assets/Examples/Scripts/dist"); } _rt.withStacktrace = stacktrace; if (sourceMap) { _rt.EnableSourceMap(); } _mConsole.Write(LogLevel.Info, "Init"); _rt.Initialize(fileSystem, fileResolver, this, _mConsole, new ByteBufferPooledAllocator()); }
static void Main(string[] args) { var logger = new DefaultScriptLogger(); var pathResolver = new PathResolver(); var fileSystem = new DefaultFileSystem(logger); var asyncManager = new DefaultAsyncManager(); var runtime = ScriptEngine.CreateRuntime(); runtime.AddModuleResolvers(); runtime.Initialize(new ScriptRuntimeArgs { fileSystem = fileSystem, pathResolver = pathResolver, asyncManager = asyncManager, logger = logger, byteBufferAllocator = new ByteBufferPooledAllocator(), binder = BindingManager.UnitylessReflectBind, }); runtime.AddSearchPath("./"); runtime.AddSearchPath("./node_modules"); runtime.EvalMain("main"); while (runtime.isRunning) { runtime.Update(1); Thread.Sleep(1); } runtime.Shutdown(); }
private void OnInit() { if (_runMode == RunMode.Playing) { return; } if (_runtime == null) { var logger = new DefaultScriptLogger(); var pathResolver = new PathResolver(); var fileSystem = new DefaultFileSystem(logger); var asyncManager = new DefaultAsyncManager(); _tick = Environment.TickCount; _runtime = ScriptEngine.CreateRuntime(true); _runtime.AddModuleResolvers(); _runtime.extraBinding = (runtime, register) => { FSWatcher.Bind(register); }; _runtime.Initialize(new ScriptRuntimeArgs { fileSystem = fileSystem, pathResolver = pathResolver, asyncManager = asyncManager, logger = logger, byteBufferAllocator = new ByteBufferPooledAllocator(), binder = DefaultBinder.GetBinder(_prefs.reflectBinding), }); _ready = true; } }
void Awake() { IFileSystem fileSystem; _mConsole = new MiniConsole(scrollRect, text, 100); _rt = ScriptEngine.CreateRuntime(); var asyncManager = new DefaultAsyncManager(); var pathResolver = new PathResolver(); pathResolver.AddSearchPath("node_modules"); if (fileLoader == FileLoader.Resources) { fileSystem = new ResourcesFileSystem(_mConsole); pathResolver.AddSearchPath("dist"); // 这里的路径相对于 Unity Resources 空间 } else if (fileLoader == FileLoader.HMR) { Debug.LogWarningFormat("功能未完成"); fileSystem = new HttpFileSystem(_mConsole, baseUrl); } else { // 演示了一般文件系统的访问, 实际项目中典型的情况需要自行实现基于 AssetBundle(或 7z/zip) 的文件访问层 fileSystem = new DefaultFileSystem(_mConsole); pathResolver.AddSearchPath("Scripts/out"); // pathResolver.AddSearchPath("../Scripts/out"); // _rt.AddSearchPath("Assets/Examples/Scripts/dist"); } _rt.withStacktrace = stacktrace; if (sourceMap) { _rt.EnableSourceMap(); } _rt.AddModuleResolvers(); _rt.extraBinding = (runtime, register) => { FSWatcher.Bind(register); QuickJS.Extra.WebSocket.Bind(register); QuickJS.Extra.XMLHttpRequest.Bind(register); if (!runtime.isWorker) { var uri = new Uri(baseUrl); QuickJS.Extra.DOMCompatibleLayer.Bind(register, uri); QuickJS.Extra.NodeCompatibleLayer.Bind(register); } }; _rt.Initialize(new ScriptRuntimeArgs { fileSystem = fileSystem, pathResolver = pathResolver, asyncManager = asyncManager, logger = _mConsole, byteBufferAllocator = new ByteBufferPooledAllocator(), binder = DefaultBinder.GetBinder(useReflectBind), }); _rt.EvalMain(entryFileName); }
public static void Initialize(this ScriptRuntime runtime, IScriptRuntimeListener listener) { var logger = new DefaultLogger(); var fileResolver = new PathResolver(); var fileSystem = new DefaultFileSystem(logger); runtime.AddModuleResolvers(); runtime.Initialize(fileSystem, fileResolver, listener, logger, new ByteBufferPooledAllocator()); }
public static int Main(string[] args) { var fileSystem = new DefaultFileSystem(); var command = new SpecCommand(args, new DefaultConsoleFormatterFactory(), new NUnitSpecificationReporter(), fileSystem, new DefaultConsoleWritterFactory(), new DefaultExpressionRunnerFactory(), new DefaultSpecificationFinder(fileSystem), new DefaultSpecificationRunnerFactory()); return command.Run(); }
public static int Main(string[] args) { var fileSystem = new DefaultFileSystem(); var command = new SpecCommand(args, new DefaultConsoleFormatterFactory(), new NUnitSpecificationReporter(), fileSystem, new DefaultConsoleWritterFactory(), new DefaultExpressionRunnerFactory(), new DefaultSpecificationFinder(fileSystem), new DefaultSpecificationRunnerFactory()); return(command.Run()); }
void Awake() { _rt = ScriptEngine.CreateRuntime(); var fileSystem = new DefaultFileSystem(); _rt.AddSearchPath("Assets"); _rt.AddSearchPath("node_modules"); _rt.EnableStacktrace(); if (sourceMap) { _rt.EnableSourceMap(); } _rt.Initialize(fileSystem, this, new UnityLogger(), new ByteBufferPooledAllocator()); }
void Awake() { IFileSystem fileSystem; _mConsole = new MiniConsole(scrollRect, text, 100); _rt = ScriptEngine.CreateRuntime(); var asyncManager = new DefaultAsyncManager(); var pathResolver = new PathResolver(); pathResolver.AddSearchPath("node_modules"); if (fileLoader == FileLoader.Resources) { fileSystem = new ResourcesFileSystem(_mConsole); pathResolver.AddSearchPath("dist"); // 这里的路径相对于 Unity Resources 空间 } else if (fileLoader == FileLoader.HMR) { Debug.LogWarningFormat("功能未完成"); fileSystem = new HttpFileSystem(_mConsole, baseUrl); } else { // 演示了一般文件系统的访问, 实际项目中典型的情况需要自行实现基于 AssetBundle(或 7z/zip) 的文件访问层 fileSystem = new DefaultFileSystem(_mConsole); pathResolver.AddSearchPath("Scripts/out"); // pathResolver.AddSearchPath("../Scripts/out"); // _rt.AddSearchPath("Assets/Examples/Scripts/dist"); } _rt.withStacktrace = stacktrace; if (sourceMap) { _rt.EnableSourceMap(); } _rt.Initialize(new ScriptRuntimeArgs { useReflectBind = useReflectBind, fileSystem = fileSystem, pathResolver = pathResolver, listener = this, asyncManager = asyncManager, logger = _mConsole, byteBufferAllocator = new ByteBufferPooledAllocator() }); }
private void OnInit() { if (_runMode == RunMode.Playing) { return; } _tick = Environment.TickCount; var logger = new UnityLogger(); var fileResolver = new FileResolver(); var fileSystem = new DefaultFileSystem(logger); fileResolver.AddSearchPath("Assets/Examples/Scripts/out/editor"); fileResolver.AddSearchPath("node_modules"); _runtime = ScriptEngine.CreateRuntime(true); _runtime.Initialize(fileSystem, fileResolver, this, logger, new ByteBufferPooledAllocator()); _runtime.OnDestroy += OnDestroy; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddAuthentication(IISDefaults.AuthenticationScheme); /*sharedOptions => * { * // sharedOptions.DefaultScheme = IISDefaults.AuthenticationScheme; * sharedOptions.DefaultAuthenticateScheme = IISDefaults.AuthenticationScheme; * });*/ // Add framework services. services.AddMvc(options => { options.EnableEndpointRouting = false; }); // Adds a default in-memory implementation of IDistributedCache. services.AddDistributedMemoryCache(); //services.AddSession(options => //{ // options.IdleTimeout = TimeSpan.FromHours(1); // options.Cookie.HttpOnly = true; // options.Cookie.IsEssential = true; //}); services.AddSpaStaticFiles(cfg => { cfg.RootPath = "wwwroot/app"; }); var fileSystem = new DefaultFileSystem(); var rep = new JsonFileRepository <Customer, string>(fileSystem); rep.Initialize("Data\\customers.json"); services // .AddScoped<ApiExceptionFilterAttribute>() // .AddScoped<IConfiguration>(prov => Configuration) .AddScoped <IDataQuery <Customer, string> >(prov => rep) .AddScoped <IDataCommand <Customer, string> >(prov => rep) ; }
public Task OpenAsync() { var repositoryName = GetRepositoryName(gitUrl); var repositoriesFolder = workingDirectory.CreateDirectory("repositories"); var repositoryFolder = repositoriesFolder.GetDirectory(repositoryName); if (repositoryFolder.Exists) { if (skipPull) { using (var repository = new Repository(repositoryFolder.FullName)) { var signature = new Signature("cli", "*****@*****.**", DateTimeOffset.UtcNow); LibGit2Sharp.Commands.Pull(repository, signature, new PullOptions()); } } } else { Repository.Clone(gitUrl, repositoryFolder.FullName); } if (!string.IsNullOrWhiteSpace(gitFolder)) { repositoryFolder = repositoryFolder.GetDirectory(gitFolder); } inner = new DefaultFileSystem(repositoryFolder) { Readonly = true }; return(Task.CompletedTask); }
private static void Main() { var fs = new DefaultFileSystem(); var uow = new MemoryUnitOfWork(fs); var storage = new BlogStorage(); var module = new BlogModule(uow, storage); var error = false; try { WriteLine("Creating a blogs..."); module.Blog.Create(new BlogDataModel { BlogUrl = "https://erlimar.wordpress.com", BlogTitle = "Erlimar Silva Campos" }); module.Blog.Create(new BlogDataModel { BlogUrl = "https://blog.jetbrains.com/dotnet", BlogTitle = "JetBrains .NET TOOLS BLOG" }); var db = uow.Session.Get <MemoryDatabase>(); WriteLine($" - Total of existing blogs: {db.Blog.Count}"); foreach (var blog in db.Blog) { WriteLine($" - {blog.BlogUrl} -> {blog.BlogTitle}"); } WriteLine(); WriteLine("Updating a blog name..."); module.Blog.Replace(new BlogDataModel { BlogUrl = "https://erlimar.wordpress.com", BlogTitle = "Erlimar Blog's" }); WriteLine($" - Total of existing blogs: {db.Blog.Count}"); foreach (var blog in db.Blog) { WriteLine($" - {blog.BlogUrl} -> {blog.BlogTitle}"); } WriteLine(); WriteLine("Removing a blog..."); module.Blog.Remove(new BlogDataModel { BlogUrl = "https://blog.jetbrains.com/dotnet" }); WriteLine($" - Total of existing blogs: {db.Blog.Count}"); foreach (var blog in db.Blog) { WriteLine($" - {blog.BlogUrl} -> {blog.BlogTitle}"); } } catch (Exception e) { error = true; WriteLine($"ERROR: {e.Message}"); } finally { if (!error) { uow.SaveWork(); } } }