public override bool TryCompare(IDateTimeDiffTO dateTimeDiffTo, out string result, out string error) { result = ""; error = ""; var dateTimeParser = DateTimeConverterFactory.CreateStandardParser(); var parsedCorreclty = DateTime.TryParseExact(dateTimeDiffTo.Input1, dateTimeDiffTo.InputFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate); if (parsedCorreclty) { _input1 = parsedDate; parsedCorreclty = DateTime.TryParseExact(dateTimeDiffTo.Input2, dateTimeDiffTo.InputFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate1); if (parsedCorreclty) { _input2 = parsedDate1; parsedCorreclty = OutputFormats.TryGetValue(dateTimeDiffTo.OutputType, out Func <DateTime, DateTime, double> returnedFunc); if (returnedFunc != null) { var tmpAmount = returnedFunc.Invoke(_input1, _input2); var wholeValue = Convert.ToInt64(Math.Floor(tmpAmount)); result = wholeValue.ToString(CultureInfo.InvariantCulture); } } return(parsedCorreclty); } error = ErrorResource.CannorParseInputDateTimeWithGivenFormat; return(parsedCorreclty); }
private WmsProvider(Client wmsClient, Func <string, Task <Stream> > getStreamAsync = null) { InitialiseGetStreamAsyncMethod(getStreamAsync); _wmsClient = wmsClient; TimeOut = 10000; ContinueOnError = true; if (OutputFormats.Contains("image/png")) { _mimeType = "image/png"; } else if (OutputFormats.Contains("image/gif")) { _mimeType = "image/gif"; } else if (OutputFormats.Contains("image/jpeg")) { _mimeType = "image/jpeg"; } else //None of the default formats supported - Look for the first supported output format { throw new ArgumentException( "None of the formates provided by the WMS service are supported"); } LayerList = new Collection <string>(); StylesList = new Collection <string>(); }
public static IOutputDescription CreateOutputDescription(OutputFormats format) { return new OutputDescription { Format = format, }; }
static void Main(string[] args) { try { String sourceDirectory = args[0]; String destDirectory = args[1]; OutputFormats outFormats = OutputFormats.Uncompressed; if (args.Length > 2) { Enum.TryParse(args[2], out outFormats); } int maxSize = int.MaxValue; if (args.Length > 3) { if (!int.TryParse(args[3], out maxSize)) { maxSize = int.MaxValue; } } Environment.CurrentDirectory = sourceDirectory; Logging.Log.Default.addLogListener(new Logging.LogConsoleListener()); WindowsRuntimePlatformInfo.Initialize(); PluginManager pluginManager = new PluginManager(new ConfigFile("woot.txt"), new ServiceCollection()); VirtualFileSystem.Instance.addArchive(destDirectory); TextureCompilerInterface.CompileTextures(sourceDirectory, destDirectory, pluginManager, outFormats, maxSize); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public MainViewModel(IEnumerable <IModelReaderAsync> readers, IEnumerable <IModelWriterAsync> writers) { if (!readers.Any()) { throw new ArgumentException(nameof(readers)); } if (!writers.Any()) { throw new ArgumentException(nameof(writers)); } _readers = readers; _writers = writers; OutputFormats = _writers.Select(w => w.FormatDescription).ToArray(); SelectedOutputFormat = OutputFormats.First(); BrowseInputFileCommand = new BasicCommand(DoBrowseInput); BrowseOutputFileCommand = new BasicCommand(DoBrowseOutput); ExitCommand = new BasicCommand(DoExit); _convertCommand = new AsyncCommand(Convert, CanConvert); CancelCommand = new BasicCommand(DoCancel); }
public static IOutputDescription CreateOutputDescription(OutputFormats format) { return(new OutputDescription { Format = format, }); }
private void PopulatePossibleOutputFormats(string inputDocument) { var outputFormats = new Dictionary <string, List <ListItem> >(); foreach (var format in DocumentUltimate.DocumentConverter.EnumeratePossibleOutputFormats(inputDocument)) { var formatInfo = DocumentFormatInfo.Get(format); List <ListItem> groupData; if (!outputFormats.TryGetValue(formatInfo.Group.Description, out groupData)) { groupData = new List <ListItem>(); outputFormats.Add(formatInfo.Group.Description, groupData); } groupData.Add(new ListItem(formatInfo.Description, formatInfo.Value.ToString())); } if (outputFormats.Count == 0) { outputFormats.Add("(not supported)", new List <ListItem>()); } OutputFormats.DataSource = outputFormats; OutputFormats.DataBind(); }
/// <summary> /// Sets the image type to use when requesting images from the WMS server /// </summary> /// <remarks> /// <para>See the <see cref="OutputFormats"/> property for a list of available mime types supported by the WMS server</para> /// </remarks> /// <exception cref="ArgumentException">Throws an exception if either the mime type isn't offered by the WMS /// or GDI+ doesn't support this mime type.</exception> /// <param name="mimeType">Mime type of image format</param> public void SetImageFormat(string mimeType) { if (!OutputFormats.Contains(mimeType)) { throw new ArgumentException("WMS service doesn't not offer mimetype '" + mimeType + "'"); } _mimeType = mimeType; }
/// <summary> /// Return a filename for the current image format (png,jpg etc) with the default file pattern /// that is specified in the configuration /// </summary> /// <param name="format">A string with the format</param> /// <param name="captureDetails"></param> /// <returns>The filename which should be used to save the image</returns> public static string GetFilename(OutputFormats format, ICaptureDetails captureDetails) { var pattern = CoreConfig.OutputFileFilenamePattern; if (string.IsNullOrEmpty(pattern?.Trim())) { pattern = "greenshot ${capturetime}"; } return(GetFilenameFromPattern(pattern, format, captureDetails)); }
/// <summary> /// Initializes a new layer, and downloads and parses the service description /// </summary> /// <param name="layername">Layername</param> /// <param name="url">Url of WMS server</param> /// <param name="cachetime">Time for caching Service Description (ASP.NET only)</param> /// <param name="proxy">Proxy</param> /// <param name="credentials"></param> public WmsLayer(string layername, string url, TimeSpan cachetime, WebProxy proxy, ICredentials credentials) { _Proxy = proxy; _TimeOut = 10000; LayerName = layername; _ContinueOnError = true; _Credentials = credentials; if (HttpContext.Current != null && HttpContext.Current.Cache["SharpMap_WmsClient_" + url] != null) { wmsClient = (Client)HttpContext.Current.Cache["SharpMap_WmsClient_" + url]; } else { wmsClient = new Client(url, _Proxy, _Credentials); if (HttpContext.Current != null) { HttpContext.Current.Cache.Insert("SharpMap_WmsClient_" + url, wmsClient, null, Cache.NoAbsoluteExpiration, cachetime); } } //Set default mimetype - We prefer compressed formats if (OutputFormats.Contains("image/jpeg")) { _MimeType = "image/jpeg"; } else if (OutputFormats.Contains("image/png")) { _MimeType = "image/png"; } else if (OutputFormats.Contains("image/gif")) { _MimeType = "image/gif"; } else //None of the default formats supported - Look for the first supported output format { bool formatSupported = false; foreach (ImageCodecInfo encoder in ImageCodecInfo.GetImageEncoders()) { if (OutputFormats.Contains(encoder.MimeType.ToLower())) { formatSupported = true; _MimeType = encoder.MimeType; break; } } if (!formatSupported) { throw new ArgumentException( "GDI+ doesn't not support any of the mimetypes supported by this WMS service"); } } _LayerList = new Collection <string>(); _StylesList = new Collection <string>(); }
public static object Execute(string strsql, OutputFormats output, object InputObject) { if (transaction) { sqls += strsql + "\n"; return(null); } else { return(_execute(strsql, output, InputObject)); } }
private static object _execute(string sql, OutputFormats output, object InputObject) { check_connection(); switch (output) { case OutputFormats.Nothing: { sqlclient.Execute(sql, null, null); return(null); } case OutputFormats.IEnumerableOfList: { ArrayList data = new ArrayList(); sqlclient.Execute(sql, (obj, ColumnNames, RowData) => { IList _data = obj as IList; _data.Add(RowData); return(0); }, data); return(data.Cast <IList>()); } case OutputFormats.DataTable: throw new NotImplementedException(); case OutputFormats.DataGridView: { sqlclient.Execute(sql, (obj, ColumnNames, RowData) => { System.Windows.Forms.DataGridView dg = (System.Windows.Forms.DataGridView)obj; if (dg == null) //make a new one! { dg = new System.Windows.Forms.DataGridView(); } if (dg.Columns.Count == 0) // add columns as necessary { System.Array.ForEach(ColumnNames, (s) => { dg.Columns.Add(s, s); }); } dg.Rows.Add(RowData); return(0); }, InputObject); return(InputObject); } default: throw new NotImplementedException(); } }
public Synthesizer(Uri endpointUri, OutputFormats outputFormats, AuthClient authorization) { SynthesizeQueue = new List <SynthesizeTask>(); EndpointUri = endpointUri; DescriptionAttribute[] attributes = (DescriptionAttribute[])outputFormats.GetType().GetField(outputFormats.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false); string description = attributes.Length > 0 ? attributes[0].Description : string.Empty; OutputFormat = description; AuthorizationClient = authorization; }
private void Initialize() { continueOnError = true; if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Cache["SharpMap_WmsClient_" + url] != null) { wmsClient = (SharpMap.Web.Wms.Client)System.Web.HttpContext.Current.Cache["SharpMap_WmsClient_" + url]; } else { wmsClient = new SharpMap.Web.Wms.Client(url, proxy); if (System.Web.HttpContext.Current != null) { System.Web.HttpContext.Current.Cache.Insert("SharpMap_WmsClient_" + url, wmsClient, null, System.Web.Caching.Cache.NoAbsoluteExpiration, cachetime); } } //Set default mimetype - We prefer compressed formats if (OutputFormats.Contains("image/jpeg")) { mimeType = "image/jpeg"; } else if (OutputFormats.Contains("image/png")) { mimeType = "image/png"; } else if (OutputFormats.Contains("image/gif")) { mimeType = "image/gif"; } else //None of the default formats supported - Look for the first supported output format { bool formatSupported = false; foreach (System.Drawing.Imaging.ImageCodecInfo encoder in System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()) { if (OutputFormats.Contains(encoder.MimeType.ToLower())) { formatSupported = true; mimeType = encoder.MimeType; break; } } if (!formatSupported) { throw new ArgumentException("GDI+ doesn't not support any of the mimetypes supported by this WMS service"); } } layerList = new Collection <string>(); stylesList = new Collection <string>(); }
public void Initialize(string[] args) { parser.Parse(args); if (showUsage) { throw new OperationCanceledException(); } if (!AssemblyFiles.Any()) { throw new OptionException("No assembly file is specified", null); } if (!OutputFormats.Any()) { throw new OptionException("No document format is specified", null); } }
private WmsProvider(Client wmsClient) { this.wmsClient = wmsClient; TimeOut = 10000; ContinueOnError = true; if (OutputFormats.Contains("image/png")) mimeType = "image/png"; else if (OutputFormats.Contains("image/gif")) mimeType = "image/gif"; else if (OutputFormats.Contains("image/jpeg")) mimeType = "image/jpeg"; else //None of the default formats supported - Look for the first supported output format { throw new ArgumentException( "None of the formates provided by the WMS service are supported"); } LayerList = new Collection<string>(); StylesList = new Collection<string>(); }
protected override bool ValidateValues() { // If nothing is set, default to ShowNonPortableApis if ((RequestFlags & (AnalyzeRequestFlags.ShowBreakingChanges | AnalyzeRequestFlags.ShowNonPortableApis)) == AnalyzeRequestFlags.None) { RequestFlags |= AnalyzeRequestFlags.ShowNonPortableApis; } // If no output formats have been supplied, default to Excel // TODO: Should probably get this from the service, not hard-coded if (!OutputFormats.Any()) { UpdateOutputFormats("Excel"); } return(InputAssemblies.Any()); }
private void PopulateOutputFormats() { var outputFormats = new Dictionary <string, List <ListItem> >(); foreach (var formatInfo in DocumentFormatInfo.Enumerate(DocumentFormatSupport.Save)) { List <ListItem> groupData; if (!outputFormats.TryGetValue(formatInfo.Group.Description, out groupData)) { groupData = new List <ListItem>(); outputFormats.Add(formatInfo.Group.Description, groupData); } groupData.Add(new ListItem(formatInfo.Description, formatInfo.Value.ToString())); OutputFormatCount++; } OutputFormats.DataSource = outputFormats; OutputFormats.DataBind(); }
public Log(FileInfo fileInfo, PriorityLevels filePriority = PriorityLevels.UltraLow, FileWriteModes writeMode = FileWriteModes.Overwrite, PriorityLevels debugPriority = PriorityLevels.UltraLow, PriorityLevels consolePriority = PriorityLevels.UltraLow, OutputFormats output = OutputFormats.File | OutputFormats.Debugger, bool enable = true) { FileInfo = fileInfo; FilePriority = filePriority; FileWriteMode = writeMode; DebuggerPriority = debugPriority; ConsolePriority = consolePriority; Output = output; IsEnabled = enable; WriteToFileCount = 0; Messages = new ConcurrentBag <LogMessage>(); _logCount++; if (_logCount == 1) { LogToFileBackgroundTask(); } }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="layername"></param> /// <param name="wmsClient"></param> public WmsLayer(string layername, Client wmsClient) : base(new Style(), new NullRenderer()) { _wmsClient = wmsClient; _continueOnError = true; LayerName = layername; //Set default mimetype - We prefer compressed formats if (OutputFormats.Contains("image/jpeg")) { _mimeType = "image/jpeg"; } else if (OutputFormats.Contains("image/png")) { _mimeType = "image/png"; } else if (OutputFormats.Contains("image/gif")) { _mimeType = "image/gif"; } else //None of the default formats supported - Look for the first supported output format { bool formatSupported = false; foreach (ImageCodecInfo encoder in ImageCodecInfo.GetImageEncoders()) { if (OutputFormats.Contains(encoder.MimeType.ToLower())) { formatSupported = true; _mimeType = encoder.MimeType; break; } } if (!formatSupported) { throw new ArgumentException( "GDI+ doesn't not support any of the mimetypes supported by this WMS service"); } } _layerList = new Collection <string>(); _stylesList = new Collection <string>(); }
public async Task <Stream> ParseCsvAsync(string csvUri, OutputFormats ouputFormat) { try { if (!Uri.IsWellFormedUriString(csvUri, UriKind.Absolute)) { Console.WriteLine("The Uri is not Well Formatted"); return(null); } bool isUriCreated = Uri.TryCreate(csvUri, UriKind.Absolute, out Uri uri); if (isUriCreated == false || uri == null) { Console.WriteLine("Invalid Uri"); return(null); } if (Path.GetExtension(csvUri) != ".csv") { Console.WriteLine("Invalid Csv file"); return(null); } return(await CsvParserService.ParseCsvAsync(csvUri, ouputFormat)); } catch (Exception e) { Logger.LogError($"Error: {e.Message}"); return(null); } }
public async Task Run(string ouputFormat) { Console.WriteLine("Enter The Uri for the Csv File"); string csvUri = Console.ReadLine(); Console.WriteLine(); if (string.IsNullOrEmpty(csvUri)) { Console.WriteLine("No Uri was provided for the Csv file"); return; } OutputFormats outputformat = OutputFormats.console; if (!string.IsNullOrEmpty(ouputFormat) && Enum.IsDefined(typeof(OutputFormats), ouputFormat.ToLower())) { outputformat = (OutputFormats)Enum.Parse(typeof(OutputFormats), ouputFormat.ToLower()); } using (Stream stream = await CsvParserLogic.ParseCsvAsync(csvUri, outputformat)) { if (stream != null) { StreamReader reader = new StreamReader(stream); Console.BufferHeight = short.MaxValue - 1; Console.WriteLine(await reader.ReadToEndAsync()); } else { Console.WriteLine("The Output stream is empty"); } } }
/// <summary> /// Sets the image type to use when requesting images from the WMS server /// </summary> /// <remarks> /// <para>See the <see cref="OutputFormats"/> property for a list of available mime types supported by the WMS server</para> /// </remarks> /// <exception cref="ArgumentException">Throws an exception if either the mime type isn't offered by the WMS /// or GDI+ doesn't support this mime type.</exception> /// <param name="mimeType">Mime type of image format</param> public void SetImageFormat(string mimeType) { if (!OutputFormats.Contains(mimeType)) { throw new ArgumentException("WMS service doesn't not offer mimetype '" + mimeType + "'"); } //Check whether SharpMap supports the specified mimetype bool formatSupported = false; foreach (ImageCodecInfo encoder in ImageCodecInfo.GetImageEncoders()) { if (encoder.MimeType.ToLower() == mimeType.ToLower()) { formatSupported = true; break; } } if (!formatSupported) { throw new ArgumentException("GDI+ doesn't not support mimetype '" + mimeType + "'"); } _MimeType = mimeType; }
/// <summary> /// Sets the image type to use when requesting images from the WMS server /// </summary> /// <remarks> /// <para>See the <see cref="OutputFormats"/> property for a list of available mime types supported by the WMS server</para> /// </remarks> /// <exception cref="ArgumentException">Throws an exception if either the mime type isn't offered by the WMS /// or GDI+ doesn't support this mime type.</exception> /// <param name="mimeType">Mime type of image format</param> public void SetImageFormat(string mimeType) { if (!OutputFormats.Contains(mimeType)) { throw new ArgumentException("WMS service doesn't not offer mimetype '" + mimeType + "'"); } //Check whether SharpMap supports the specified mimetype var formatSupported = false; foreach (var encoder in ImageCodecInfo.GetImageEncoders()) { if (string.Equals(encoder.MimeType, mimeType, StringComparison.CurrentCultureIgnoreCase)) { formatSupported = true; break; } } if (!formatSupported) { throw new ArgumentException("GDI+ doesn't not support mimetype '" + mimeType + "'"); } _mimeType = mimeType; }
public SurfaceOutputSettings(OutputFormats format, int quality, bool reduceColors) : this(format, quality) { ReduceColors = reduceColors; }
public SurfaceOutputSettings(OutputFormats format, int quality) : this(format) { JPGQuality = quality; }
public SurfaceOutputSettings(OutputFormats format) : this() { Format = format; }
public IApiDocumentation GetApiEntryPointDescription(OutputFormats format) { return(GetApiEntryPointDescription(OverrideAcceptedMediaType(format))); }
public static void DetectOutputFormat(string str, out OutputFormats outputFormat, out OutputDigitLanguages outputDigitLanguage) { outputFormat = OutputFormats.LettersWithSign; outputDigitLanguage = OutputDigitLanguages.None; int len = str.Length; if ((str[0] == '-' || str[0] == '+') && (len > 1 && Char.IsLetter(str[1]))) { outputDigitLanguage = OutputDigitLanguages.None; outputFormat = OutputFormats.LettersWithSign; return; } for (int i = 0; i < len; i++) { char ch = str[i]; if (ch == '/') { outputFormat = OutputFormats.Fractional; if (outputDigitLanguage != OutputDigitLanguages.None) { break; } } else if (Char.IsLetter(ch) && ch != 'e' && ch != 'E') { outputFormat = OutputFormats.Letters; outputDigitLanguage = OutputDigitLanguages.None; break; } //else if(StringUtil.IsDecimalSeparator(ch)) //{ // outputFormat = OutputFormats.FloatingPoint; // if(outputDigitLanguage != OutputDigitLanguages.None) // break; //} else if (StringUtil.IsThousandSeparator(ch)) { outputFormat = OutputFormats.FloatingPointWithSep; if (outputDigitLanguage != OutputDigitLanguages.None) { break; } } else if (Char.IsDigit(ch)) { if (StringUtil.IsPersianDigit(ch)) { outputDigitLanguage = OutputDigitLanguages.Persian; if (outputFormat != OutputFormats.LettersWithSign) { break; } } else { outputDigitLanguage = OutputDigitLanguages.English; if (outputFormat != OutputFormats.LettersWithSign) { break; } } } } if (outputFormat == OutputFormats.LettersWithSign) // i.e., it was not set in the loop above { outputFormat = OutputFormats.FloatingPoint; Debug.Assert(outputDigitLanguage != OutputDigitLanguages.None); } }
public static IOutputDescription CreateOutputDescription(OutputFormats format) => new OutputDescription { Format = format, };
public Log(PriorityLevels filePriority = PriorityLevels.UltraLow, FileWriteModes writeMode = FileWriteModes.Overwrite, PriorityLevels debugPriority = PriorityLevels.UltraLow, PriorityLevels consolePriority = PriorityLevels.UltraLow, OutputFormats output = OutputFormats.File | OutputFormats.Debugger, bool enable = true) : this(new FileInfo($@"{ AppDomain.CurrentDomain.BaseDirectory }\{ DefaultGlobalLogFilename }"), filePriority, writeMode, debugPriority, consolePriority, output, enable) { }