示例#1
0
        public void OnGet(Guid id)
        {
            var service = new ExtensionService();

            Extension = service.GetExtension(id);
            var firstFile = Extension.Files.FirstOrDefault();

            FileContents = firstFile?.Contents;
        }
示例#2
0
        public void OnGet(Guid id, string filePath)
        {
            var service = new ExtensionService();

            Extension     = service.GetExtension(id);
            ExtensionFile = Extension.Files.First(
                x => String.Equals(x.FullPath, filePath, StringComparison.OrdinalIgnoreCase));
            FileContents = ExtensionFile?.Contents;
        }
示例#3
0
        public void OnPost(Guid id)
        {
            var service = new ExtensionService();

            Extension = service.GetExtension(id);
            var firstFile = Extension.Files.FirstOrDefault();

            if (firstFile == null)
            {
                firstFile = new ExtensionFile();
                Extension.Files.Add(firstFile);
            }
            firstFile.Contents = FileContents;
            service.SaveExtensions();
        }
示例#4
0
        public void OnGet(Guid id)
        {
            var service = new ExtensionService();

            Extension = service.GetExtension(id);
            var firstFile = Extension.Files.FirstOrDefault();

            if (firstFile != null && !string.IsNullOrEmpty(firstFile.Contents))
            {
                var result = _DynamicCodeService.GetAssemblyFromText(firstFile.Contents, Extension.ExtensionName);

                if (result.Succeeded)
                {
                    var extension = _DynamicCodeService.GetExtensionFromAssembly(result.Assembly);
                    Summary = extension.GetSummary();
                }
                else
                {
                    CompilerErrors = result.CompilerErrors;
                }
            }
        }