public void AddDocumentAttach(DocumentAttach attach) { string localPath = string.Empty; bool forceDelete = false; string localFilePath = string.Empty; CheckPrerequisite(attach); attach.IdDocument = attach.IdDocumentAttach; if (ConfigurationManager.AppSettings["PathCache"] != null && !string.IsNullOrEmpty(ConfigurationManager.AppSettings["PathCache"].ToString())) { localFilePath = CacheService.AddCache(attach, attach.Content, attach.Name, ""); } if (string.IsNullOrEmpty(localFilePath)) { forceDelete = true; localPath = Path.GetTempPath(); localFilePath = Path.Combine(localPath, attach.IdDocumentAttach.ToString() + Path.GetExtension(attach.Name)); } try { //Document.StorageArea = DocumentService.GetStorageArea(Document, AttributeValues); // File.WriteAllBytes(localFilePath, attach.Content.Blob); // //Document.Content = new DocumentContent(GetByteArrayFromFile(localFilePath)); //Save the document on the storageArea attach.Size = SaveDocument(localFilePath, attach.Storage, attach.StorageArea, attach, null); StorageService.UpdateStorageAreaSize(attach.StorageArea.IdStorageArea, (long)attach.Size); attach.Status = new Status((short)DocumentTarnsitoStatus.StorageProcessing); //Update the calculated value. //TODO Update del Attach //DocumentService.UpdateDocumentAttach(attach)); if (attach.Storage.EnableFulText) { SaveSearchableDocument(attach); } } finally { if (forceDelete) { try { File.Delete(localFilePath); } catch (Exception ex) { logger.Error(ex); } } } }
public RuneLiteAPI() { services = new ServiceManager <IService>(); CacheService cacheService = new CacheService(); cacheService.AddCache <MemoryCache>().AddCache <FileCache>(); services.Register(cacheService); LatestPriceService = new LatestPriceService(services); Last5MinutePriceService = new Last5MinutePriceService(services); MappingService = new MappingService(services); VolumeService = new VolumeService(services); }