public static Image GetDICImageResource(string locationIdentifier, string otherLocationParameter, ResourceAccessType tipoAcesso) { Image imageResource = null; try { var location = tipoAcesso == ResourceAccessType.DICAnexo ? DocInPortoHelper.getDocInPortoAnexo(locationIdentifier, otherLocationParameter) : DocInPortoHelper.getDocInPortoConteudo(locationIdentifier); if (location == null || location.Length == 0) { return(null); } var splits = location.Split('.'); var extension = splits[splits.Length - 1]; if (!(isValidImageFileExtension(extension))) { System.Diagnostics.Trace.WriteLine("extension: " + extension); imageResource = GetFileIcon(location); } else { FileStream resourceStream = new FileStream(locationIdentifier, FileMode.Open, FileAccess.Read); imageResource = Image.FromStream(resourceStream); resourceStream.Close(); } } catch (ForbiddenResourceException ex) { Trace.WriteLine(ex); imageResource = null; // accept "forbidden" responses, as they might be dued to our // system's limitations towards using authentication mecanisms // (ie, of a "foreign" web application) } catch (Exception ex) { imageResource = null; Trace.WriteLine(ex); throw new UnretrievableResourceException("The image resource is unavailable", ex); } return(imageResource); }
public virtual List <DocumentoInfoArquivoGeral> GetDocumentosEnviadosParaArquivoGeral(DateTime timeStamp, int maxDocs) { //return GetWSRecordsFromSerializedSource(@"Database\HistoricalData\20100503-dipExamples.bin"); return(DocInPortoHelper.GetListaDocumentosArquivoGeral(timeStamp, maxDocs)); }
public virtual List <MoradaRecord> GetMoradas(IEnumerable <string> iEnumerable) { //return GetWSToponimiasFromSerializedSource(@"Database\HistoricalData\20100503-dipMoradasExamples.bin"); return(DocInPortoHelper.GetMoradas(iEnumerable)); }
private void ShellOpenImg() { if (this.pictImagem == null) { return; } this.Cursor = Cursors.WaitCursor; try { string sUrl = null; System.Diagnostics.Process p = new System.Diagnostics.Process(); switch (TipoAcessoRecurso) { case ResourceAccessType.Web: if (((GISADataset.GlobalConfigRow)(GisaDataSetHelper.GetInstance().GlobalConfig.Select()[0])).URLBaseActivo) { sUrl = string.Format(((GISADataset.GlobalConfigRow)(GisaDataSetHelper.GetInstance().GlobalConfig.Select()[0])).URLBase.Replace("<id>", "{0}"), SourceLocation); } else { sUrl = SourceLocation; } break; case ResourceAccessType.Smb: sUrl = SourceLocation; break; case ResourceAccessType.Fedora: var configRow = GisaDataSetHelper.GetInstance().GlobalConfig.Cast <GISADataset.GlobalConfigRow>().Single(); var qualidade = configRow.IsQualidadeImagemNull() ? Quality.Low : FedoraHelper.TranslateQualityEnum(configRow.QualidadeImagem); bool success; string errorMessage; sUrl = SessionHelper.AppConfiguration.GetCurrentAppconfiguration().FedoraHelperSingleton.GetDisseminatorByUrl(SourceLocation, qualidade, out success, out errorMessage); if (String.IsNullOrEmpty(sUrl) || !File.Exists(sUrl) || !success) { sUrl = null; } if (!success) { MessageBox.Show(errorMessage, "Repositório Digital", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case ResourceAccessType.DICAnexo: sUrl = DocInPortoHelper.getDocInPortoAnexo(SourceLocation, OtherLocationParams); // break; case ResourceAccessType.DICConteudo: sUrl = DocInPortoHelper.getDocInPortoConteudo(SourceLocation); break; } if (sUrl != null && sUrl.Length > 0) { p = System.Diagnostics.Process.Start(sUrl); } } catch (Win32Exception ex) { Trace.WriteLine(ex.ToString()); if (ex.NativeErrorCode == 2) { //ERROR FILE NOT FOUND MessageBox.Show("O caminho especificado não é válido.", "Imagem", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.Cursor = Cursors.Default; }