Пример #1
0
 public BicepCompilationManager(ILanguageServerFacade server, ICompilationProvider provider, IWorkspace workspace, IFileResolver fileResolver, IModuleRestoreScheduler scheduler)
 {
     this.server       = server;
     this.provider     = provider;
     this.workspace    = workspace;
     this.fileResolver = fileResolver;
     this.scheduler    = scheduler;
 }
Пример #2
0
 public CompilationService(IDiagnosticLogger diagnosticLogger, IFileResolver fileResolver, InvocationContext invocationContext, IModuleRegistryProvider registryProvider)
 {
     this.diagnosticLogger  = diagnosticLogger;
     this.fileResolver      = fileResolver;
     this.moduleDispatcher  = new ModuleDispatcher(registryProvider);
     this.invocationContext = invocationContext;
     this.workspace         = new Workspace();
 }
Пример #3
0
 public TemplateDecompiler(IFeatureProvider features, INamespaceProvider namespaceProvider, IFileResolver fileResolver, IModuleRegistryProvider registryProvider, IConfigurationManager configurationManager)
 {
     this.features             = features;
     this.namespaceProvider    = namespaceProvider;
     this.fileResolver         = fileResolver;
     this.registryProvider     = registryProvider;
     this.configurationManager = configurationManager;
 }
Пример #4
0
 public SyntaxTreeGrouping(SyntaxTree entryPoint, ImmutableHashSet <SyntaxTree> syntaxTrees, ImmutableDictionary <ModuleDeclarationSyntax, SyntaxTree> moduleLookup, ImmutableDictionary <ModuleDeclarationSyntax, DiagnosticBuilder.ErrorBuilderDelegate> moduleFailureLookup, FileSystem.IFileResolver fileResolver)
 {
     EntryPoint          = entryPoint;
     SyntaxTrees         = syntaxTrees;
     ModuleLookup        = moduleLookup;
     ModuleFailureLookup = moduleFailureLookup;
     FileResolver        = fileResolver;
 }
 public UploadAvatarCommandHandler(IHandler handler, IMediatRBus mediatRBus,
                                   IAvatarService avatarService, IFileResolver fileResolver)
 {
     _handler       = handler.CheckIfNotEmpty();
     _mediatRBus    = mediatRBus.CheckIfNotEmpty();
     _avatarService = avatarService.CheckIfNotEmpty();
     _fileResolver  = fileResolver.CheckIfNotEmpty();
 }
Пример #6
0
        public static SourceFileGrouping CreateFromText(string text, IFileResolver fileResolver)
        {
            var entryFileUri = new Uri("file:///main.bicep");

            return(CreateForFiles(new Dictionary <Uri, string> {
                [entryFileUri] = text
            }, entryFileUri, fileResolver));
        }
        public static SourceFileGrouping CreateFromText(string text, IFileResolver fileResolver)
        {
            var entryFileUri = new Uri("file:///main.bicep");

            return(CreateForFiles(new Dictionary <Uri, string> {
                [entryFileUri] = text
            }, entryFileUri, fileResolver, BicepTestConstants.BuiltInConfigurationWithAnalyzersDisabled));
        }
Пример #8
0
 private TemplateConverter(Workspace workspace, IFileResolver fileResolver, Uri fileUri, JObject template)
 {
     this.workspace    = workspace;
     this.fileResolver = fileResolver;
     this.fileUri      = fileUri;
     this.template     = template;
     this.nameResolver = new UniqueNamingResolver();
 }
Пример #9
0
 public UploadAvatarHandler(IHandler handler, IBusClient bus,
                            IAvatarService avatarService, IFileResolver fileResolver)
 {
     _handler       = handler;
     _bus           = bus;
     _avatarService = avatarService;
     _fileResolver  = fileResolver;
 }
Пример #10
0
 private SyntaxTreeGroupingBuilder(IFileResolver fileResolver)
 {
     this.fileResolver           = fileResolver;
     this.moduleLookup           = new Dictionary <ModuleDeclarationSyntax, SyntaxTree>();
     this.moduleFailureLookup    = new Dictionary <ModuleDeclarationSyntax, DiagnosticBuilder.ErrorBuilderDelegate>();
     this.syntaxTrees            = new Dictionary <string, SyntaxTree>(fileResolver.PathComparer);
     this.syntaxTreeLoadFailures = new Dictionary <string, DiagnosticBuilder.ErrorBuilderDelegate>(fileResolver.PathComparer);
 }
Пример #11
0
 private SyntaxTreeGroupingBuilder(IFileResolver fileResolver, IReadOnlyWorkspace workspace)
 {
     this.fileResolver           = fileResolver;
     this.workspace              = workspace;
     this.moduleLookup           = new Dictionary <ModuleDeclarationSyntax, SyntaxTree>();
     this.moduleFailureLookup    = new Dictionary <ModuleDeclarationSyntax, DiagnosticBuilder.ErrorBuilderDelegate>();
     this.syntaxTrees            = new Dictionary <Uri, SyntaxTree>();
     this.syntaxTreeLoadFailures = new Dictionary <Uri, DiagnosticBuilder.ErrorBuilderDelegate>();
 }
Пример #12
0
        public TypeManager(IFeatureProvider features, IBinder binder, IFileResolver fileResolver)
        {
            // bindings will be modified by name binding after this object is created
            // so we can't make an immutable copy here
            // (using the IReadOnlyDictionary to prevent accidental mutation)
            this.typeAssignmentVisitor = new TypeAssignmentVisitor(this, features, binder, fileResolver);

            this.declaredTypeManager = new DeclaredTypeManager(this, binder);
        }
Пример #13
0
        public static SyntaxTreeGrouping BuildWithPreloadedFile(IFileResolver fileResolver, string entryFileName, string fileContents)
        {
            var builder            = new SyntaxTreeGroupingBuilder(fileResolver);
            var normalizedFileName = fileResolver.GetNormalizedFileName(entryFileName);

            builder.AddSyntaxTree(normalizedFileName, fileContents);

            return(builder.Build(normalizedFileName));
        }
        public static ProgramSyntax DecompileTemplate(Workspace workspace, IFileResolver fileResolver, Uri fileUri, string content)
        {
            var instance = new TemplateConverter(workspace, fileResolver, fileUri, JObject.Parse(content, new JsonLoadSettings
            {
                CommentHandling  = CommentHandling.Ignore,
                LineInfoHandling = LineInfoHandling.Load,
            }));

            return(instance.Parse());
        }
Пример #15
0
 private static ObjectType GetSubscriptionReturnType(IBinder binder, IFileResolver fileResolver, IDiagnosticWriter diagnostics, ImmutableArray <FunctionArgumentSyntax> arguments, ImmutableArray <TypeSymbol> argumentTypes)
 {
     return(new SubscriptionScopeType(arguments, new[]
     {
         new TypeProperty("id", LanguageConstants.String),
         new TypeProperty("subscriptionId", LanguageConstants.String),
         new TypeProperty("tenantId", LanguageConstants.String),
         new TypeProperty("displayName", LanguageConstants.String),
     }));
 }
Пример #16
0
 public BicepBuildCommandHandler(ICompilationManager compilationManager, ISerializer serializer, EmitterSettings emitterSettings, INamespaceProvider namespaceProvider, IFileResolver fileResolver, IModuleDispatcher moduleDispatcher, IConfigurationManager configurationManager)
     : base(LanguageConstants.Build, serializer)
 {
     this.compilationManager   = compilationManager;
     this.emitterSettings      = emitterSettings;
     this.namespaceProvider    = namespaceProvider;
     this.fileResolver         = fileResolver;
     this.moduleDispatcher     = moduleDispatcher;
     this.configurationManager = configurationManager;
 }
Пример #17
0
        public override Sound GetSound(string fileId, IFileResolver fileResolver)
        {
            IntPtr chunk = SDL_mixer.Mix_LoadWAV(fileResolver.Resolve(fileId));

            if (!chunk.Equals(IntPtr.Zero))
            {
                return(new SDLSound(fileId, chunk));
            }
            return(null);
        }
Пример #18
0
        public override Music GetMusic(string fileId, IFileResolver fileResolver)
        {
            IntPtr chunk = SDL_mixer.Mix_LoadMUS(fileResolver.Resolve(fileId));

            if (!chunk.Equals(IntPtr.Zero))
            {
                return(new SDLMusic(fileId, chunk));
            }
            return(null);
        }
Пример #19
0
        public FileGadget(Gadget parent, IFileResolver fileResolver)
            : base(parent)
        {
            this.fileResolver = fileResolver;
            layout            = new BoxLayout(Orientation.Vertical, Alignment.Fill);
            table             = new TableGadget(this)
            {
                EvenColumns = false,
                SelectedCellChangedEvent = (o, i) => { TableSelectedChanged(); }
            };
            table.AddColumn("Name", -1);
            table.AddColumn("Size", 64);
            table.AddColumn("Date", 130);
            table.AddColumn("Comment", 140);
            var dirBox = new BoxGadget(this, Orientation.Horizontal, Alignment.Fill);

            new LabelGadget(dirBox, "Drawer")
            {
                FixedWidth = 100
            };
            dirName = new StrGadget(dirBox)
            {
                FixedWidth = 300
            };

            var fileBox = new BoxGadget(this, Orientation.Horizontal, Alignment.Fill);

            new LabelGadget(fileBox, "File")
            {
                FixedWidth = 100
            };
            fileName = new StrGadget(fileBox)
            {
                FixedWidth = 300
            };
            var buttonBox = new BoxGadget(this, Orientation.Horizontal, Alignment.Fill, 0, 100);

            butOk = new ButtonGadget(buttonBox, "Open")
            {
                GadgetUpEvent = (o, i) => { Ok(); }
            };
            butVolumes = new ButtonGadget(buttonBox, "Volumes")
            {
                GadgetUpEvent = (o, i) => { Volumes(); }
            };
            butParent = new ButtonGadget(buttonBox, "Parent")
            {
                GadgetUpEvent = (o, i) => { GoToParent(); }
            };
            butCancel = new ButtonGadget(buttonBox, "Cancel")
            {
                GadgetUpEvent = (o, i) => { Cancel(); }
            };
        }
Пример #20
0
        private bool _isValid; // destroy 调用后立即 = false

        public ScriptRuntime()
        {
            _isValid      = true;
            _fileResolver = new FileResolver();
            _mainThreadId = Thread.CurrentThread.ManagedThreadId;
            _timerManager = new TimerManager();
            _rt           = JSApi.JS_NewRuntime();
            JSApi.JS_SetModuleLoaderFunc(_rt, module_normalize, module_loader, IntPtr.Zero);
            _mainContext = CreateContext();
            JSApi.JS_NewClass(_rt, JSApi.JSB_GetBridgeClassID(), "CSharpClass", JSApi.class_finalizer);
        }
Пример #21
0
 private TemplateConverter(IFileResolver fileResolver, Uri fileUri, string content)
 {
     this.fileResolver = fileResolver;
     this.fileUri      = fileUri;
     this.template     = JObject.Parse(content, new JsonLoadSettings
     {
         CommentHandling  = CommentHandling.Ignore,
         LineInfoHandling = LineInfoHandling.Load,
     });
     this.nameResolver = new UniqueNamingResolver();
 }
 public BicepForceModulesRestoreCommandHandler(ICompilationManager compilationManager, ISerializer serializer, IFeatureProvider features, EmitterSettings emitterSettings, INamespaceProvider namespaceProvider, IFileResolver fileResolver, IModuleDispatcher moduleDispatcher, IConfigurationManager configurationManager)
     : base(LangServerConstants.ForceModulesRestoreCommand, serializer)
 {
     this.compilationManager   = compilationManager;
     this.emitterSettings      = emitterSettings;
     this.features             = features;
     this.namespaceProvider    = namespaceProvider;
     this.fileResolver         = fileResolver;
     this.moduleDispatcher     = moduleDispatcher;
     this.configurationManager = configurationManager;
 }
Пример #23
0
 private SourceFileGroupingBuilder(IFileResolver fileResolver, IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace)
 {
     this.fileResolver     = fileResolver;
     this.moduleDispatcher = moduleDispatcher;
     this.workspace        = workspace;
     this.sourceFilesByModuleDeclaration   = new();
     this.errorBuildersByModuleDeclaration = new();
     this.modulesToInit      = new();
     this.sourceFilesByUri   = new();
     this.errorBuildersByUri = new();
 }
Пример #24
0
        public void Initialize(IFileSystem fileSystem, IFileResolver resolver, IScriptRuntimeListener listener, IScriptLogger logger, IO.IByteBufferAllocator byteBufferAllocator)
        {
            if (logger == null)
            {
                throw new NullReferenceException(nameof(logger));
            }

            if (fileSystem == null)
            {
                throw new NullReferenceException(nameof(fileSystem));
            }

            MethodInfo bindAll = null;

            if (!isWorker)
            {
                if (listener == null)
                {
                    throw new NullReferenceException(nameof(listener));
                }

                bindAll = typeof(Values).GetMethod("BindAll", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                if (bindAll == null)
                {
                    throw new Exception("Generate binding code before run");
                }
            }
            _listener            = listener;
            _fileResolver        = resolver;
            _byteBufferAllocator = byteBufferAllocator;
            _autorelease         = new Utils.AutoReleasePool();
            _fileSystem          = fileSystem;
            _logger       = logger;
            _timerManager = new TimerManager(_logger);
            _typeDB       = new TypeDB(this, _mainContext);

            var register = new TypeRegister(this, _mainContext);

            register.RegisterType(typeof(ScriptBridge));
            // await Task.Run(() => runner.OnBind(this, register));
            if (bindAll != null)
            {
                bindAll.Invoke(null, new object[] { register });
            }
            listener.OnBind(this, register);
            if (!_isWorker)
            {
                JSWorker.Bind(register);
            }
            TimerManager.Bind(register);
            ScriptContext.Bind(register);
            register.Finish();
            listener.OnComplete(this);
        }
        /// <summary>
        /// Loads in a .kpdl file using a resolver from outside the instance
        /// </summary>
        /// <param name="path"></param>
        /// <param name="resolver"></param>
        public void Load(string file, IFileResolver resolver)
        {
            string path;

            if (!resolver.TryResolve(file, out path))
            {
                throw new FileNotFoundException($"Unable to locate file {file}");
            }

            Load(path);
        }
Пример #26
0
 private SourceFileGroupingBuilder(IFileResolver fileResolver, IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace, RootConfiguration configuration)
 {
     this.fileResolver     = fileResolver;
     this.moduleDispatcher = moduleDispatcher;
     this.workspace        = workspace;
     this.configuration    = configuration;
     this.sourceFilesByModuleDeclaration   = new();
     this.errorBuildersByModuleDeclaration = new();
     this.modulesToRestore   = new();
     this.sourceFilesByUri   = new();
     this.errorBuildersByUri = new();
 }
Пример #27
0
        private SourceFileGroupingBuilder(IFileResolver fileResolver, IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace, SourceFileGrouping current)
        {
            this.fileResolver     = fileResolver;
            this.moduleDispatcher = moduleDispatcher;
            this.workspace        = workspace;

            this.sourceFilesByModuleDeclaration   = new(current.SourceFilesByModuleDeclaration);
            this.errorBuildersByModuleDeclaration = new(current.ErrorBuildersByModuleDeclaration);

            this.modulesToInit = new();

            this.sourceFilesByUri   = current.SourceFiles.ToDictionary(tree => tree.FileUri);
            this.errorBuildersByUri = new();
        }
Пример #28
0
 public BicepDefinitionHandler(
     ISymbolResolver symbolResolver,
     ICompilationManager compilationManager,
     IFileResolver fileResolver,
     IWorkspace workspace,
     ILanguageServerFacade languageServer,
     IModuleDispatcher moduleDispatcher) : base()
 {
     this.symbolResolver     = symbolResolver;
     this.compilationManager = compilationManager;
     this.fileResolver       = fileResolver;
     this.workspace          = workspace;
     this.languageServer     = languageServer;
     this.moduleDispatcher   = moduleDispatcher;
 }
Пример #29
0
        public ClosureScope(EvaluationContext context, IFileResolver fileFileResolver, Scope closure, Scope overlay, IEnumerable <VariableDeclaration> localVariables)
            : base(context, fileFileResolver, overlay.Selectors)
        {
            this.closure = closure;

            Parent = overlay;

            if (localVariables != null)
            {
                foreach (var variableDeclaration in localVariables)
                {
                    base.DeclareVariable(variableDeclaration);
                }
            }
        }
Пример #30
0
 public CompilationService(
     IDiagnosticLogger diagnosticLogger,
     IFileResolver fileResolver,
     InvocationContext invocationContext,
     IModuleDispatcher moduleDispatcher,
     IConfigurationManager configurationManager,
     TemplateDecompiler decompiler)
 {
     this.diagnosticLogger     = diagnosticLogger;
     this.fileResolver         = fileResolver;
     this.moduleDispatcher     = moduleDispatcher;
     this.configurationManager = configurationManager;
     this.invocationContext    = invocationContext;
     this.workspace            = new Workspace();
     this.decompiler           = decompiler;
 }
        public UrlRequestConfiguration IgnoreFiles(IFileResolver fileResolver = null)
        {
            if (fileResolver == null)
            {
                fileResolver = new DefaultFileFileResolver();
            }

            var rule = new UrlRequestRule("Ignore files on disk", request =>
            {
                var result = new UrlRequestRuleResult();

                var path = VirtualPathUtility.ToAbsolute($"~{request.ProcessedUrl.Uri.AbsolutePath}");
                if (fileResolver.FileExists(path))
                {
                    result.StopProcessing = true;
                }
                return result;
            });

            Rules.Add(rule);

            return this;
        }
Пример #32
0
 public ConfigurationParser(IFileResolver fileResolver, string mainFileExtension, string subFileExtension)
 {
     _fileResolver = fileResolver;
     _mainFileExtension = mainFileExtension;
     _subFileExtension = subFileExtension;
 }
Пример #33
0
 public ConfigurationParser(IFileResolver fileResolver, string mainFileExtension)
     : this(fileResolver, mainFileExtension, mainFileExtension)
 {
 }
Пример #34
0
 public AspCache(IHttp http, IFileResolver fileResolver)
 {
     _http = http;
     _fileResolver = fileResolver;
 }
Пример #35
0
 public CssAssetsFileHasher(string hashQueryStringKeyName, IFileResolver fileResolver, IHasher hasher)
 {
     HashQueryStringKeyName = hashQueryStringKeyName;
     FileResolver = fileResolver;
     Hasher = hasher;
 }