public DocCaseDO(DocFile docFile, GvaCaseType caseType) : this() { if (docFile != null) { this.DocFileId = docFile.DocFileId; this.Name = docFile.Name; this.File = new BlobDO() { Key = docFile.DocFileContentId, Name = docFile.DocFileName, RelativePath = "", //? }; this.DocFileKind = new NomValue() { NomValueId = docFile.DocFileKindId, Name = docFile.DocFileKind.Name, Alias = docFile.DocFileKind.Alias }; } this.CaseType = new NomValue() { NomValueId = caseType.GvaCaseTypeId, Name = caseType.Name, Alias = caseType.Alias }; }
public FileDataDO(DocFile docFile) { this.Name = docFile.DocFileName; this.Key = docFile.DocFileContentId; this.MimeType = MimeTypeHelper.GetFileMimeTypeByExtenstion(Path.GetExtension(docFile.DocFileName)); }
public ApplicationLotFileDO(GvaAppLotFile appFile, DocFile docFile) : this() { this.HasAppFile = appFile == null ? false : true; if (appFile != null) { this.GvaLotFileId = appFile.GvaLotFileId; this.PartIndex = appFile.GvaLotFile.LotPart.Index; this.SetPartName = appFile.GvaLotFile.LotPart.SetPart.Name; this.SetPartAlias = appFile.GvaLotFile.LotPart.SetPart.Alias; this.PageNumber = appFile.GvaLotFile.PageNumber; this.PageIndex = appFile.GvaLotFile.PageIndex; if (appFile.GvaLotFile.GvaCaseType != null) { this.GvaCaseTypeName = appFile.GvaLotFile.GvaCaseType.Name; } if (appFile.DocFile != null) { this.DocFileId = appFile.DocFile.DocFileId; this.DocFileKindId = appFile.DocFile.DocFileKindId; this.DocFileTypeId = appFile.DocFile.DocFileTypeId; this.DocId = appFile.DocFile.DocId; this.Name = appFile.DocFile.Name; this.File.Key = appFile.DocFile.DocFileContentId; this.File.Name = appFile.DocFile.DocFileName; } else if (appFile.GvaLotFile.GvaFile != null) { this.File.Key = appFile.GvaLotFile.GvaFile.FileContentId; this.File.Name = appFile.GvaLotFile.GvaFile.Filename; } else if (appFile.GvaLotFile.DocFile != null) { this.File.Key = appFile.GvaLotFile.DocFile.DocFileContentId; this.File.Name = appFile.GvaLotFile.DocFile.DocFileName; } } else if (docFile != null) { this.DocFileId = docFile.DocFileId; this.DocFileKindId = docFile.DocFileKindId; this.DocFileTypeId = docFile.DocFileTypeId; this.DocId = docFile.DocId; this.Name = docFile.Name; this.File.Key = docFile.DocFileContentId; this.File.Name = docFile.DocFileName; } }
public DocFileDO(DocFile d) : this() { if (d != null) { this.DocFileId = d.DocFileId; this.DocId = d.DocId; this.DocFileKindId = d.DocFileKindId; this.DocFileTypeId = d.DocFileTypeId; this.Name = d.Name; this.File.Key = d.DocFileContentId; this.File.Name = d.DocFileName; this.File.MimeType = MimeTypeHelper.GetFileMimeTypeByExtenstion(Path.GetExtension(d.DocFileName)); this.File.RelativePath = ""; //? this.DocFileUrl = string.Format( "api/file?fileKey={0}&fileName={1}&mimeType={2}", d.DocFileContentId, d.DocFileName, this.File.MimeType); if (d.DocFileKind != null) { this.DocFileKindAlias = d.DocFileKind.Alias; } if (d.DocFileType != null) { this.DocFileTypealias = d.DocFileType.Alias; } if (d.DocFileOriginType != null) { this.IsElectronicApplication = d.DocFileOriginType.Alias == "EApplication"; this.IsEditableFile = d.DocFileOriginType.Alias == "EditableFile"; } } }
/// <summary> /// Scans the text content of a file and removes any "internal" comments/references /// </summary> /// <param name="sourceFile">File.</param> /// <param name="destinationRoot"></param> /// <param name="page"></param> protected override async Task PublishFileToDestinationAsync(FileInfo sourceFile, DirectoryInfo destinationRoot, DocFile page) { this.LogMessage(new ValidationMessage(sourceFile.Name, "Scanning text file for internal content.")); var outputPath = this.GetPublishedFilePath(sourceFile, destinationRoot); var writer = new StreamWriter(outputPath, false, Encoding.UTF8) { AutoFlush = true }; StreamReader reader = new StreamReader(sourceFile.OpenRead()); long lineNumber = 0; string nextLine; while ( (nextLine = await reader.ReadLineAsync()) != null) { lineNumber++; if (this.IsDoubleBlockQuote(nextLine)) { this.LogMessage(new ValidationMessage(string.Concat(sourceFile, ":", lineNumber), "Removing DoubleBlockQuote: {0}", nextLine)); continue; } await writer.WriteLineAsync(nextLine); } writer.Close(); reader.Close(); }
protected virtual bool ShouldPublishFile(DocFile file) { if (null != this.Options.FilesToPublish && this.Options.FilesToPublish.Length > 0) { return this.Options.FilesToPublish.Any(filename => filename.Equals(file.DisplayName, StringComparison.OrdinalIgnoreCase)); } return true; }
/// <summary> /// Scans the text content of a file and removes any "internal" comments/references /// </summary> /// <param name="sourceFile">File.</param> /// <param name="destinationRoot"></param> /// <param name="page"></param> #pragma warning disable 1998 protected virtual async Task PublishFileToDestinationAsync(FileInfo sourceFile, DirectoryInfo destinationRoot, DocFile page, IssueLogger issues) #pragma warning restore 1998 { throw new NotImplementedException("This method is not implemented in the abstract class."); }
private DocFile CreateReceiptDocFile(int docFileKindId, Doc receiptDoc, Guid fileKey, bool isDocAcknowledged) { string docFileTypeAlias = isDocAcknowledged ? "ReceiptAcknowledgedMessage" : "ReceiptNotAcknowledgedMessage"; DocFile docFile = new DocFile(); docFile.Doc = receiptDoc; docFile.DocContentStorage = String.Empty; docFile.DocFileContentId = fileKey; docFile.DocFileTypeId = this.unitOfWork.DbContext.Set<DocFileType>().Single(e => e.Alias == docFileTypeAlias).DocFileTypeId; docFile.DocFileKindId = docFileKindId; docFile.Name = isDocAcknowledged ? "Съобщение, че получаването се потвърждава" : "Съобщение, че получаването не се потвърждава"; docFile.DocFileName = isDocAcknowledged ? "ReceiptAcknowledgedMessage.xml" : "ReceiptNotAcknowledgedMessage.xml"; docFile.DocFileOriginTypeId = this.unitOfWork.DbContext.Set<DocFileOriginType>().Single(e => e.Alias == "EApplication").DocFileOriginTypeId; docFile.IsPrimary = true; docFile.IsSigned = true; docFile.IsActive = true; return docFile; }
private DocFile CreateInitialDocFile(Doc doc, Guid fileKey, int docFileTypeId, int docFileKindId, DateTime? applicationSigningTime) { DocFile docFile = new DocFile(); docFile.DocFileContentId = fileKey; docFile.DocContentStorage = String.Empty; docFile.Doc = doc; docFile.DocFileTypeId = docFileTypeId; docFile.DocFileKindId = docFileKindId; docFile.Name = "Електронно заявление"; docFile.DocFileName = "E-Application.xml"; docFile.DocFileOriginTypeId = this.unitOfWork.DbContext.Set<DocFileOriginType>().Single(e => e.Alias == "EApplication").DocFileOriginTypeId; docFile.SignDate = applicationSigningTime; docFile.IsPrimary = true; docFile.IsSigned = true; docFile.IsActive = true; return docFile; }
private DocFile CreateEApplicationAttachDocFile(AttachedDocDo attachedDocument, Doc doc, int docFileKindId, Guid fileKey) { DocFile docFile = new DocFile(); docFile.Doc = doc; int docFileTypeId = docFileTypeId = this.unitOfWork.DbContext.Set<DocFileType>().SingleOrDefault(e => e.Alias.ToLower() == "UnknownBinary").DocFileTypeId; var fileExtension = MimeTypeHelper.GetFileExtenstionByMimeType(attachedDocument.MimeType); if (!String.IsNullOrWhiteSpace(fileExtension)) { fileExtension = fileExtension.Substring(1); var docFileType = this.unitOfWork.DbContext.Set<DocFileType>().SingleOrDefault(e => e.Alias.ToLower() == fileExtension); if (docFileType != null) { docFileTypeId = docFileType.DocFileTypeId; } } docFile.DocFileTypeId = docFileTypeId; docFile.DocFileKindId = docFileKindId; docFile.DocFileOriginTypeId = this.unitOfWork.DbContext.Set<DocFileOriginType>().Single(e => e.Alias == "EApplicationAttachedFile").DocFileOriginTypeId; docFile.Name = attachedDocument.DocKind; docFile.DocFileName = attachedDocument.AbbcdnInfo.AttachedDocumentFileName; docFile.DocContentStorage = String.Empty; docFile.DocFileContentId = fileKey; docFile.IsPrimary = false; docFile.IsSigned = false; docFile.IsActive = true; return docFile; }
protected bool IsDocFileInternal(DocFile file) { return this.IsRelativePathInternal(file.DisplayName); }
protected bool IsDocFileInternal(DocFile file) { return(this.IsRelativePathInternal(file.DisplayName)); }
public async Task ImportAllBranches() { var branches = await _githubDataRepository.GetBranches(); var versions = new List <DocVersion>(); DocVersion defaultVersion = null; foreach (var branch in branches) { _dataRepository.DeleteBranch(branch.Name); var version = new DocVersion(BranchNameToPathString(branch.Name), branch.Name); versions.Add(version); if (branch.IsDefault) { defaultVersion = version; } var archive = await _githubDataRepository.GetArchive(branch); using (var memoryStream = new MemoryStream(archive)) using (var gzipStream = new GZipStream(memoryStream, CompressionMode.Decompress)) using (var tarReader = new TarReader(gzipStream)) { string rootDirectory = null; while (tarReader.Next() is var entry && entry != null) { if (entry.Header.Flag == TarHeaderFlag.Directory && rootDirectory == null) { rootDirectory = entry.Header.Name; } if (entry.Header.Flag == TarHeaderFlag.NormalFile) { if (Path.GetExtension(entry.Header.Name) == ".md") { using (var streamReader = new StreamReader(entry)) { var markdown = streamReader.ReadToEnd(); var meta = ParseMeta(ref markdown); // Parse markdown var document = Markdig.Markdown.Parse(markdown, new MarkdownPipelineBuilder() .UseAdvancedExtensions() .UsePipeTables() .Build()); var sw = new StringWriter(); var renderer = new CustomHtmlRenderer(sw); renderer.Render(document); sw.Flush(); var html = sw.ToString(); var file = new DocFile { Content = html, Meta = meta }; var docPath = entry.Header.Name; if (rootDirectory != null && docPath.StartsWith(rootDirectory)) { docPath = docPath.Substring(rootDirectory.Length).TrimStart('/', '\\'); } var fileName = Path.GetFileNameWithoutExtension(docPath); docPath = Path.Combine(Path.GetDirectoryName(docPath), fileName); if (fileName == "index") { version.DefaultPage = meta.RedirectPage; } meta.LastModification = entry.Header.LastModification ?? DateTime.UtcNow; meta.EditUrl = $"{_githubDataRepository.PublicUrl}/blob/{branch.Name}/{docPath}.md"; meta.Title = meta.Title ?? fileName.Replace('-', ' '); _dataRepository.StoreDocFile(branch.Name, docPath, file); } } else { var assetPath = entry.Header.Name; if (rootDirectory != null && assetPath.StartsWith(rootDirectory)) { assetPath = assetPath.Substring(rootDirectory.Length).TrimStart('/', '\\'); } assetPath = assetPath.ToLower(); // Skip unaccepted asset types if (_options.Value.AcceptedAssets.Contains(Path.GetExtension(assetPath))) { _dataRepository.StoreAsset(branch.Name, assetPath, entry); } } } } } } var docConfig = new DocConfiguration { Versions = versions.ToArray(), DefaultVersion = defaultVersion }; _dataRepository.StoreDocConfiguration(docConfig); }
private string FolderRead(long DocPathID, string RealityPath, string FolderName) { var DirInfo = new DirectoryInfo(RealityPath); var EF = new EF(); //获取当前目录名记录 DocFolder DocFolder = null; if (FolderName == null) { //根目录 DocFolder = new DocFolder { ID = 0 }; } else { DocFolder = EF.DocFolder.Where(i => i.Name == FolderName).FirstOrDefault(); if (DocFolder == null) { EF.DocFolder.Add(DocFolder = new DocFolder { Name = FolderName, CreationTime = DirInfo.CreationTime, LastAccessTime = DirInfo.LastAccessTime }); EF.SaveChanges(); } else if (DocFolder.LastAccessTime == DirInfo.LastAccessTime) { //记录已经存在并且未变更,无需处理 return(null); } } //历遍子目录 foreach (DirectoryInfo Folder in DirInfo.GetDirectories()) { FolderRead(DocPathID, Folder.FullName, FolderName + Folder.Name + "/"); } //历遍文件 foreach (var iFile in DirInfo.GetFiles()) { var DocFile = EF.DocFile.Where(i => i.DocFolderID == DocFolder.ID && i.Name == iFile.Name).FirstOrDefault(); if (DocFile == null) { EF.DocFile.Add(DocFile = new DocFile { DocPathID = DocPathID, DocFolderID = DocFolder.ID, Name = iFile.Name, ExtNameID = SYS.DOC.GetFileExtName(iFile.Extension).ID, Length = iFile.Length, MIMEID = SYS.DOC.GetFileMIME(Utils.GetMime(Path.GetExtension(iFile.FullName).ToLower())).ID, CreationTime = iFile.CreationTime, LastAccessTime = iFile.LastWriteTime }); try { EF.SaveChanges(); } catch (DbEntityValidationException ex) { string error = ""; foreach (var item in ex.EntityValidationErrors) { foreach (var item2 in item.ValidationErrors) { error += string.Format("{0}:{1}\r\n", item2.PropertyName, item2.ErrorMessage); } } throw new Exception(error); } catch (Exception) { throw; } } else if (DocFile.LastAccessTime == iFile.LastAccessTime) { //记录已经存在并且未变更,无需处理 break; } //异步创建预览 FileSimpleHandler tFileSimpleHandler = new FileSimpleHandler(FileSimpleCreate); IAsyncResult asyncResult = tFileSimpleHandler.BeginInvoke(DocFile.ID, new AsyncCallback(FileSimpleCallback), DocFile); new LogManager().WriteLog("文件[" + DocFile.ID + "]创建预览开始。"); } EF.Dispose(); return(null); }
internal string RelativePathToFile(DocFile file, bool urlStyle = false) { return(RelativePathToFile(file.FullPath, this.SourceFolderPath, urlStyle)); }
public async Task <IHttpActionResult> Register(List <DocIn> lstDoc) { try { // DocRef,docFile,DocImage,DocType,Lang foreach (var model in lstDoc) { if (!ModelState.IsValid) { var modelErrors = new List <string>(); foreach (var modelState in ModelState.Values) { foreach (var modelError in modelState.Errors) { modelErrors.Add(modelError.ErrorMessage); } } return(Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), modelErrors[0].ToString()), new JsonMediaTypeFormatter())); } bool status = false; string ValidFrom = string.Empty; string ValidTo = string.Empty; string DocClass = string.Empty; var maxDocVersion = 0; if (model.DocType.ToString().ToLower() == "profilephoto") { status = true; string updateQuery = @"SELECT * From " + _bucket.Name + " as Users where meta().id ='" + model.IndivID + "'"; var userDocument = _bucket.Query <object>(updateQuery).ToList(); if (userDocument.Count > 0) { List <int> maxVersion = new List <int>(); if (((Newtonsoft.Json.Linq.JToken)userDocument[0]).Root["Users"]["documents"] != null) { var auditInfoVersion = ((Newtonsoft.Json.Linq.JToken)userDocument[0]).Root["Users"]["documents"]; foreach (var itemTD in auditInfoVersion) { if (itemTD["version"] != null) { maxVersion.Add(Convert.ToInt32(itemTD["version"])); } } } if (maxVersion.Count != 0) { maxDocVersion = 1 + maxVersion.Max(); } else { maxDocVersion = 1; } } if (maxDocVersion == 0) { maxDocVersion = 1; } DocClass = model.DocClass; ValidFrom = DataConversion.ConvertYMDHMS(DateTime.Now.ToString()); ValidTo = DataConversion.ConvertYMDHMS(DateTime.Now.AddDays(Convert.ToInt16(ConfigurationManager.AppSettings.Get("ValidToProfilePhotoDays"))).ToString()); } else { status = false; if (string.IsNullOrEmpty(model.ValidFrom)) { //return Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), "190-document valid from is required"), new JsonMediaTypeFormatter()); } if (string.IsNullOrEmpty(model.ValidTo)) { //return Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), "191-document valid to is required"), new JsonMediaTypeFormatter()); } ValidFrom = model.ValidFrom; ValidTo = model.ValidTo; } DocContent docContent = new DocContent(); if (model.DocContent != null) { docContent.Duration = model.DocContent.Duration; docContent.Fees = model.DocContent.Fees; } List <DocFile> lstDocFile = new List <DocFile>(); if (model.DocFile != null) { foreach (var df in model.DocFile) { DocFile docFile = new DocFile(); docFile.DocFormat = df.DocFormat; docFile.DocImage = df.DocImage; lstDocFile.Add(docFile); } } var docID = "DOCIN_" + GenerateRandamNumber(); var docInDocument = new Document <DocIn>() { Id = docID, Content = new DocIn { DocType = model.DocType.ToLower(), Version = maxDocVersion, DocRef = model.DocRef, Lang = model.Lang, Status = false, DateTime = DataConversion.ConvertYMDHMS(DateTime.Now.ToString()), DocClass = model.DocClass, ValidTo = ValidTo, ValidFrom = ValidFrom, RejReas = "", IndivID = model.IndivID, VehID = model.VehID, CompID = model.CompID, DocContent = docContent, DocFile = lstDocFile, Id = model.Id, IssueDate = model.IssueDate, ExpiryDate = model.ExpiryDate, Place = model.Place, Categories = model.Categories }, }; var result = await _bucket.InsertAsync(docInDocument); //if (!result.Success) //{ // return Content(HttpStatusCode.InternalServerError, MessageResponse.Message(HttpStatusCode.InternalServerError.ToString(), result.Message), new JsonMediaTypeFormatter()); //} /////////////////////////////////// add document in IndivID if (model.IndivID.Trim() != string.Empty) { string query1 = @"SELECT * From " + _bucket.Name + " as Individual where meta().id= 'individual_" + model.IndivID.Trim() + "'"; var individualDocument = _bucket.Query <object>(query1).ToList(); if (individualDocument.Count > 0) { Documents addnewDocument = new Documents(); addnewDocument.DocumentID = docID; // add document code string query = @"UPDATE " + _bucket.Name + " SET documents = ARRAY_APPEND(documents, " + Newtonsoft.Json.JsonConvert.SerializeObject(addnewDocument).ToString() + ") where meta().id='individual_" + model.IndivID.Trim() + "'"; var resultIndividual = _bucket.Query <object>(query); } } /////////////////////////////////// add document in CompID if (model.CompID != null) { if (model.CompID.Trim() != string.Empty) { var companyDocument = _bucket.Query <object>(@"SELECT * From " + _bucket.Name + " as Company where meta().id= 'company_" + model.CompID.Trim() + "'").ToList(); if (companyDocument.Count > 0) { Documents addnewDocument = new Documents(); addnewDocument.DocumentID = docID; // add document code string query = @"UPDATE " + _bucket.Name + " SET documents = ARRAY_APPEND(documents, " + Newtonsoft.Json.JsonConvert.SerializeObject(addnewDocument).ToString() + ") where meta().id='company_" + model.CompID.Trim() + "'"; var resultIndividual = _bucket.Query <object>(query); } } } } ///////////////////////////////// return(Content(HttpStatusCode.OK, MessageResponse.Message(HttpStatusCode.OK.ToString(), "Documents uploaded sucessfully"))); } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, MessageResponse.Message(HttpStatusCode.InternalServerError.ToString(), ex.StackTrace), new JsonMediaTypeFormatter())); } }
public static MethodDefinition FromRequest(string request, CodeBlockAnnotation annotation, DocFile source, IssueLogger issues) { var method = new MethodDefinition { Request = request, RequestMetadata = annotation, Identifier = annotation.MethodName?.FirstOrDefault(), SourceFile = source, RequiredScopes = annotation.RequiredScopes, RequiredApiVersions = annotation.RequiredApiVersions, RequiredTags = annotation.RequiredTags }; method.Title = method.Identifier; var methodIssues = issues.For(method.Identifier); try { HttpRequest requestExample; HttpParser.TryParseHttpRequest(request, out requestExample, methodIssues); if (!string.IsNullOrEmpty(requestExample?.Body) && requestExample.Body.Contains("{")) { if (string.IsNullOrEmpty(annotation.ResourceType)) { annotation.ResourceType = "requestBodyResourceFor." + method.Identifier; } var body = requestExample.Body; if (requestExample.ContentType.StartsWith(MimeTypeMultipartRelated, StringComparison.OrdinalIgnoreCase)) { var multipartContent = new MultipartMime.MultipartMimeContent(requestExample.ContentType, body); var part = multipartContent.PartWithId("<metadata>"); body = part.Body; } var requestBodyResource = new JsonResourceDefinition(annotation, body, source, methodIssues); if (requestBodyResource.Parameters != null) { method.RequestBodyParameters.AddRange(requestBodyResource.Parameters); } } } catch (Exception ex) { methodIssues.Warning(ValidationErrorCode.HttpParserError, "Unable to parse request body resource", ex); } return(method); }
/// <summary> /// Scans the text content of a file and removes any "internal" comments/references /// </summary> /// <param name="sourceFile">File.</param> /// <param name="destinationRoot"></param> /// <param name="page"></param> protected override async Task PublishFileToDestinationAsync(FileInfo sourceFile, DirectoryInfo destinationRoot, DocFile page) { this.LogMessage(new ValidationMessage(sourceFile.Name, "Scanning text file for internal content.")); var outputPath = this.GetPublishedFilePath(sourceFile, destinationRoot); var writer = new StreamWriter(outputPath, false, Encoding.UTF8) { AutoFlush = true }; StreamReader reader = new StreamReader(sourceFile.OpenRead()); long lineNumber = 0; string nextLine; while ((nextLine = await reader.ReadLineAsync()) != null) { lineNumber++; if (this.IsDoubleBlockQuote(nextLine)) { this.LogMessage(new ValidationMessage(string.Concat(sourceFile, ":", lineNumber), "Removing DoubleBlockQuote: {0}", nextLine)); continue; } await writer.WriteLineAsync(nextLine); } writer.Close(); reader.Close(); }
/// <summary> /// Scans the text content of a file and removes any "internal" comments/references /// </summary> /// <param name="sourceFile">File.</param> /// <param name="destinationRoot"></param> /// <param name="page"></param> #pragma warning disable 1998 protected virtual async Task PublishFileToDestinationAsync(FileInfo sourceFile, DirectoryInfo destinationRoot, DocFile page) #pragma warning restore 1998 { throw new NotImplementedException("This method is not implemented in the abstract class."); }
/// <summary> /// Convert a JSON string into an instance of this class /// </summary> /// <param name="json"></param> /// <returns></returns> public static CodeBlockAnnotation ParseMetadata(string json, MarkdownDeep.Block codeBlock = null, DocFile sourceFile = null) { var response = JsonConvert.DeserializeObject <CodeBlockAnnotation>(json); response.originalRawJson = json; response.sourceFile = sourceFile; // Check for Collection() syntax if (!string.IsNullOrEmpty(response.ResourceType)) { const string collectionPrefix = "collection("; const string collectionSuffix = ")"; if (response.ResourceType.StartsWith(collectionPrefix, StringComparison.OrdinalIgnoreCase) && response.ResourceType.EndsWith(collectionSuffix, StringComparison.OrdinalIgnoreCase)) { response.IsCollection = true; var newResourceType = response.ResourceType.Substring(collectionPrefix.Length); newResourceType = newResourceType.Substring(0, newResourceType.Length - collectionSuffix.Length); response.ResourceType = newResourceType; } } if (codeBlock != null) { // See if we can infer anything that's missing from response if (response.BlockType == CodeBlockType.Unknown) { response.BlockType = InferBlockType(codeBlock, response.ResourceType); } } return(response); }