/// <summary> /// Initializes a new instance of the <see cref="ReportGenerator" /> class. /// </summary> /// <param name="parser">The IParser to use.</param> /// <param name="assemblyFilter">The assembly filter.</param> /// <param name="classFilter">The class filter.</param> /// <param name="renderers">The renderers.</param> internal ReportGenerator(IParser parser, IFilter assemblyFilter, IFilter classFilter, IEnumerable<IReportBuilder> renderers) { if (parser == null) { throw new ArgumentNullException("parser"); } if (assemblyFilter == null) { throw new ArgumentNullException("assemblyFilter"); } if (classFilter == null) { throw new ArgumentNullException("classFilter"); } if (renderers == null) { throw new ArgumentNullException("renderers"); } this.parser = parser; this.assemblyFilter = assemblyFilter; this.classFilter = classFilter; this.renderers = renderers; }
public CecilSymbolManager(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategy[] trackedMethodStrategies) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategies = trackedMethodStrategies; }
internal EditCombinedFilter(CombinedFilter targetFilter, string newName, IFilter newFilter1, IFilter newFilter2) { _targetFilter = targetFilter; _newFilter1 = newFilter1; _newFilter2 = newFilter2; _newName = newName; }
public InstrumentationModelBuilderFactory(ICommandLine commandLine, IFilter filter, ILog logger, IEnumerable<ITrackedMethodStrategy> trackedMethodStrategies) { _commandLine = commandLine; _filter = filter; _logger = logger; MethodStrategies = trackedMethodStrategies; }
public ConsoleAppender(ISubmitConsoleLogEntry consoleLogEntrySubmitter, bool forceConsoleOutput, IFilter filter, IColorSchema colorSchema) { m_consoleLogEntrySubmitter = consoleLogEntrySubmitter; m_colorSchema = colorSchema; m_filter = filter; if (forceConsoleOutput) { m_isConsoleOutputAvaliable = true; } else { if (IsRunningOnMono) { m_isConsoleOutputAvaliable = true; } else // Windows { IntPtr iStdOut = GetStdHandle(STD_OUTPUT_HANDLE); if (iStdOut == IntPtr.Zero) { m_isConsoleOutputAvaliable = false; } else { m_isConsoleOutputAvaliable = true; } } } }
public override ICollection<FilterValue> GetAvailableValues(IEnumerable<Guid> necessaryMIATypeIds, IFilter selectAttributeFilter, IFilter filter) { IServerConnectionManager serverConnectionManager = ServiceRegistration.Get<IServerConnectionManager>(); IServerController serverController = serverConnectionManager.ServerController; if (serverController == null) throw new NotConnectedException("The MediaLibrary is not connected"); IDictionary<string, string> systemNames = new Dictionary<string, string>(); foreach (MPClientMetadata client in serverController.GetAttachedClients()) systemNames.Add(client.SystemId, client.LastClientName); systemNames.Add(serverConnectionManager.HomeServerSystemId, serverConnectionManager.LastHomeServerName); IContentDirectory cd = ServiceRegistration.Get<IServerConnectionManager>().ContentDirectory; if (cd == null) return new List<FilterValue>(); HomogenousMap valueGroups = cd.GetValueGroups(ProviderResourceAspect.ATTR_SYSTEM_ID, null, ProjectionFunction.None, necessaryMIATypeIds, filter, true); IList<FilterValue> result = new List<FilterValue>(valueGroups.Count); int numEmptyEntries = 0; foreach (KeyValuePair<object, object> group in valueGroups) { string name = group.Key as string ?? string.Empty; name = name.Trim(); if (name == string.Empty) numEmptyEntries += (int) group.Value; else { string systemName; if (systemNames.TryGetValue(name, out systemName) && !string.IsNullOrEmpty(systemName)) name = systemName; result.Add(new FilterValue(name, new RelationalFilter(ProviderResourceAspect.ATTR_SYSTEM_ID, RelationalOperator.EQ, group.Key), null, (int) group.Value, this)); } } if (numEmptyEntries > 0) result.Insert(0, new FilterValue(Consts.RES_VALUE_EMPTY_TITLE, new EmptyFilter(ProviderResourceAspect.ATTR_SYSTEM_ID), null, numEmptyEntries, this)); return result; }
/// <summary> /// This method returns the query string for 'GetFeature'. /// </summary> /// <param name="featureTypeInfo">A <see cref="WfsFeatureTypeInfo"/> instance providing metadata of the featuretype to query</param> /// <param name="labelProperty"></param> /// <param name="boundingBox">The bounding box of the query</param> /// <param name="filter">An instance implementing <see cref="IFilter"/></param> public string GetFeatureGETRequest(WfsFeatureTypeInfo featureTypeInfo, string labelProperty, BoundingBox boundingBox, IFilter filter) { string qualification = string.IsNullOrEmpty(featureTypeInfo.Prefix) ? string.Empty : featureTypeInfo.Prefix + ":"; string filterString = string.Empty; if (filter != null) { filterString = filter.Encode(); filterString = filterString.Replace("<", "%3C"); filterString = filterString.Replace(">", "%3E"); filterString = filterString.Replace(" ", ""); filterString = filterString.Replace("*", "%2a"); filterString = filterString.Replace("#", "%23"); filterString = filterString.Replace("!", "%21"); } var filterBuilder = new StringBuilder(); filterBuilder.Append("&filter=%3CFilter%20xmlns=%22" + NSOGC + "%22%20xmlns:gml=%22" + NSGML + "%22%3E%3CBBOX%3E%3CPropertyName%3E"); filterBuilder.Append(qualification).Append(featureTypeInfo.Geometry.GeometryName); filterBuilder.Append("%3C/PropertyName%3E%3Cgml:Box%20srsName=%22" + featureTypeInfo.SRID + "%22%3E"); filterBuilder.Append("%3Cgml:coordinates%3E"); filterBuilder.Append(XmlConvert.ToString(boundingBox.Left) + ","); filterBuilder.Append(XmlConvert.ToString(boundingBox.Bottom) + "%20"); filterBuilder.Append(XmlConvert.ToString(boundingBox.Right) + ","); filterBuilder.Append(XmlConvert.ToString(boundingBox.Top)); filterBuilder.Append("%3C/gml:coordinates%3E%3C/gml:Box%3E%3C/BBOX%3E"); filterBuilder.Append(filterString); filterBuilder.Append("%3C/Filter%3E"); return "?SERVICE=WFS&Version=1.0.0&REQUEST=GetFeature&TYPENAME=" + qualification + featureTypeInfo.Name + "&SRS =" + featureTypeInfo.SRID + filterBuilder; }
public SerfidCore(IListener listener, IFilter filter, IStorage storage, IUser user) { _listener = listener; _filter = filter; _storage = storage; _user = user; }
/// <summary> /// Createa a new <see cref="DynamicApiActionInfo"/> object. /// </summary> /// <param name="actionName">Name of the action in the controller</param> /// <param name="verb">The HTTP verb that is used to call this action</param> /// <param name="method">The method which will be invoked when this action is called</param> public DynamicApiActionInfo(string actionName, HttpVerb verb, MethodInfo method, IFilter[] filters = null) { ActionName = actionName; Verb = verb; Method = method; Filters = filters ?? new IFilter[] { }; //Assigning or initialzing the action filters. }
private static void SerializeProperty(JsonWriter writer, JsonSerializer serializer , IFilter filter, string field, object value) { if ((field.IsNullOrEmpty() || value == null)) return; writer.WritePropertyName(field); serializer.Serialize(writer, value); }
private static void WriteProperty(JsonWriter writer, IFilter filter, string field, object value) { if ((field.IsNullOrEmpty() || value == null)) return; writer.WritePropertyName(field); writer.WriteValue(value); }
public override ICollection<FilterValue> GetAvailableValues(IEnumerable<Guid> necessaryMIATypeIds, IFilter selectAttributeFilter, IFilter filter) { IContentDirectory cd = ServiceRegistration.Get<IServerConnectionManager>().ContentDirectory; if (cd == null) throw new NotConnectedException("The MediaLibrary is not connected"); HomogenousMap valueGroups = cd.GetValueGroups(MediaAspect.ATTR_RECORDINGTIME, null, ProjectionFunction.DateToYear, necessaryMIATypeIds, filter, true); IList<FilterValue> result = new List<FilterValue>(valueGroups.Count); int numEmptyEntries = 0; foreach (KeyValuePair<object, object> group in valueGroups) { int? year = (int?) group.Key; if (year.HasValue) { result.Add(new FilterValue(year.Value.ToString(), new BooleanCombinationFilter(BooleanOperator.And, new IFilter[] { new RelationalFilter(MediaAspect.ATTR_RECORDINGTIME, RelationalOperator.GE, new DateTime(year.Value, 1, 1)), new RelationalFilter(MediaAspect.ATTR_RECORDINGTIME, RelationalOperator.LT, new DateTime(year.Value + 1, 1, 1)), }), null, (int) group.Value, this)); } else numEmptyEntries += (int) group.Value; } if (numEmptyEntries > 0) result.Insert(0, new FilterValue(Consts.RES_VALUE_EMPTY_TITLE, new EmptyFilter(MediaAspect.ATTR_RECORDINGTIME), null, numEmptyEntries, this)); return result; }
public Closing(short[,] se) { this.errosion = new Erosion(); this.dilatation = new Dilatation(); this.errosion = new Erosion(se); this.dilatation = new Dilatation(se); }
IFilter rr; // 特性 Hrr を持つフィルタ。 #endregion #region コンストラクタ /// <summary> /// Hll, Hlr, Hrl, Hrr を別個に指定。 /// </summary> /// <param name="ll">特性 Hll を持つフィルタ</param> /// <param name="lr">特性 Hlr を持つフィルタ</param> /// <param name="rl">特性 Hrl を持つフィルタ</param> /// <param name="rr">特性 Hrr を持つフィルタ</param> public CrossStereoFilter(IFilter ll, IFilter lr, IFilter rl, IFilter rr) { this.ll = ll; this.lr = lr; this.rl = rl; this.rr = rr; }
/// <summary> /// Hll = Hrr, Hlr = Hrlの場合。 /// </summary> /// <param name="ll">特性 Hll を持つフィルタ</param> /// <param name="lr">特性 Hlr を持つフィルタ</param> public CrossStereoFilter(IFilter ll, IFilter lr) { this.ll = ll; this.lr = lr; this.rl = (IFilter)lr.Clone(); this.rr = (IFilter)ll.Clone(); }
/// <summary> /// Releases a filter instance /// </summary> /// <param name="filter">The filter instance</param> public virtual void Release(IFilter filter) { if (logger.IsDebugEnabled) { logger.Debug("Releasing filter " + filter); } }
// Constructor public PolarFilterForm( bool toPolar, Size originalSize ) { InitializeComponent( ); this.toPolar = toPolar; if ( toPolar ) { Text = "Transform To Polar"; filter = new TransformToPolar( ); ( (TransformToPolar) filter ).UseOriginalImageSize = false; colorButton.BackColor = ( (TransformToPolar) filter ).FillColor; } else { Text = "Transform From Polar"; filter = new TransformFromPolar( ); ( (TransformFromPolar) filter ).UseOriginalImageSize = false; fillColorLabel.Visible = false; colorButton.Visible = false; } offsetAngleUpDown.Value = 0; circleDepthUpDown.Value = 1; newWidthUpDown.Value = originalSize.Width; newHeightUpDown.Value = originalSize.Height; mapBackwardsCheck.Checked = false; mapFromTopCheck.Checked = true; }
private static void FillFilterParameterAttributes(FilterSerializerData filterSerializerData, IFilter filter, Type filterType, FilterBindingContext context) { var propertyInfos = filterType.GetProperties().ToList(); foreach (var propertyInfo in propertyInfos) { var filterParameterAttribute = AttributeRetrieval.GetAttribute<FilterParameterAttribute>(propertyInfo); if (filterParameterAttribute == null) { continue; } //get the value set or bound to the parameter var value = GetFilterSerializationBindingValue(filterParameterAttribute, propertyInfo, context, filter); //run validation on the parameter to ensure that it meets all standards RunFilterSerializationValidation(filterType, propertyInfo, value); //run formatter on the validated value var filterPropertyFormattedValue = RunFilterSerializationFormat(filterParameterAttribute, filterType, propertyInfo, value); var filterPropertyIsDefault = filterParameterAttribute.Default != null && value != null && filterParameterAttribute.Default.Equals(value); filterSerializerData.Parameters.Add(new FilterSerializerDataParameter { Name = filterParameterAttribute.Name, Value = filterPropertyFormattedValue, Parameter = filterParameterAttribute, IsDefault = filterPropertyIsDefault }); } }
public SlicePicker(IFilter grayscaleFilter, IInPlaceFilter edgeDetectionFilter, SliceRatingCalculator ratingCalculator, ThumbnailGeneratorUtilities thumbnailGeneratorUtilities) { this.grayscaleFilter = grayscaleFilter; this.edgeDetectionFilter = edgeDetectionFilter; this.ratingCalculator = ratingCalculator; this.thumbnailGeneratorUtilities = thumbnailGeneratorUtilities; }
public void AddChild(TextMatchFilter filter) { if (child != null) throw new InvalidFilterException("only one child allowed"); child = filter; }
// Apply filter on the image private static void ApplyFilter(IFilter filter, ref Bitmap image) { if (filter is IFilterInformation) { IFilterInformation filterInfo = (IFilterInformation)filter; if (!filterInfo.FormatTransalations.ContainsKey(image.PixelFormat)) { if (filterInfo.FormatTransalations.ContainsKey(PixelFormat.Format24bppRgb)) { MessageBox.Show("The selected image processing routine may be applied to color image only.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show( "The selected image processing routine may be applied to grayscale or binary image only.\n\nUse grayscale (and threshold filter if required) before.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } } try { // apply filter to the image image = filter.Apply(image); } catch { MessageBox.Show("Error occured applying selected filter to the image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public FilterValue(string title, IFilter filter, IFilter selectAttributeFilter, MLFilterCriterion criterion) { _title = title; _filter = filter; _selectAttributeFilter = selectAttributeFilter; _criterion = criterion; }
public FilteredSerializationDataProvider(string connectionStringName, IFilter filter) : base(connectionStringName) { Assert.ArgumentNotNull(filter, "filter"); _filter = filter; }
protected virtual bool MatchesFilterConditions(LoggingEvent loggingEvent, IFilter filter) { if (filter.MinLevel != LoggingEventLevel.None && loggingEvent.Level < filter.MinLevel) return false; if (filter.MaxLevel != LoggingEventLevel.None && loggingEvent.Level > filter.MaxLevel) return false; if (!filter.LogKeyContains.IsNullOrEmpty() && loggingEvent.LogKey.IndexOf(filter.LogKeyContains, StringComparison.OrdinalIgnoreCase) < 0) return false; if (!filter.LogKeyStartsWith.IsNullOrEmpty() && !loggingEvent.LogKey.StartsWith(filter.LogKeyStartsWith, StringComparison.OrdinalIgnoreCase)) return false; if (!filter.TextContains.IsNullOrEmpty() && loggingEvent.Text.IndexOf(filter.TextContains, StringComparison.OrdinalIgnoreCase) < 0) return false; if (!filter.TextStartsWith.IsNullOrEmpty() && !loggingEvent.Text.StartsWith(filter.TextStartsWith, StringComparison.OrdinalIgnoreCase)) return false; if (filter.MinValue.HasValue && loggingEvent.Value.HasValue && loggingEvent.Value.Value < filter.MinValue.Value) return false; if (filter.MaxValue.HasValue && loggingEvent.Value.HasValue && loggingEvent.Value.Value > filter.MaxValue.Value) return false; if (!filter.TagsContains.IsNullOrEmpty()) { var requiredTags = TagHelpers.Clean(filter.TagsContains); if (!requiredTags.All(x => loggingEvent.Tags.Contains(x, StringComparer.OrdinalIgnoreCase))) return false; } return true; }
public CecilSymbolManager(ICommandLine commandLine, IFilter filter, ILog logger, IEnumerable<ITrackedMethodStrategy> trackedMethodStrategies) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategies = trackedMethodStrategies ?? new ITrackedMethodStrategy[0]; }
public InstrumentationModelBuilderFactory(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategyManager trackedMethodStrategyManager) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategyManager = trackedMethodStrategyManager; }
private void SetFilter(string propertyName, IFilter filter) { if (updateFilterTimer != null) { updateFilterTimer.Dispose(); updateFilterTimer = null; } if (filters.ContainsKey(propertyName)) { if (filter == null) filters.Remove(propertyName); else filters[propertyName] = filter; } else { if (filter != null) filters.Add(propertyName, filter); } updateFilterTimer = new Timer((s) => { var scheduler = (TaskScheduler)s; updateFilterTimer.Dispose(); updateFilterTimer = null; Task.Factory.StartNew(() => Source.SetFilter(filters.Select(f => new PropertyFilter(f.Key, f.Value)).ToArray(), CancellationToken.None), CancellationToken.None, TaskCreationOptions.None, scheduler); }, TaskScheduler.FromCurrentSynchronizationContext(), TimeSpan.FromMilliseconds(200), TimeSpan.FromTicks(0)); }
private void ApplyFilter(IFilter filter) { try { // set wait cursor this.Cursor = Cursors.WaitCursor; // apply filter to the image Bitmap newImage = filter.Apply((Bitmap)this.Image.Image); if (backup == null) { backup = this.Image.Image; } this.Image.Image = newImage; } catch (ArgumentException) { MessageBox.Show("Selected filter can not be applied to the image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
/// <summary> /// 初始化一个新的<see cref="DynamicApiActionInfo"/>实例 /// </summary> /// <param name="actionName">Action 名称</param> /// <param name="verb">HTTP Verb</param> /// <param name="method">一个方法信息,随着 Action 的调用而调用</param> /// <param name="filters">用于 Controller Action 的动态筛选器</param> public DynamicApiActionInfo(string actionName, HttpVerbs verb, MethodInfo method, IFilter[] filters = null) { ActionName = actionName; Verb = verb; Method = method; Filters = filters ?? new IFilter[] { }; }
public void AddChild(IsNotDefinedFilter filter) { if (child != null) throw new InvalidFilterException("only one child allowed"); child = filter; }
public static int Invoke(bool debug, bool verbose, string encoding, string imagePath, bool longFormat, string @namespace, string options) { MainClass.PrintCopyright(); if (debug) { AaruConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; } if (verbose) { AaruConsole.VerboseWriteLineEvent += System.Console.WriteLine; } AaruConsole.DebugWriteLine("Ls command", "--debug={0}", debug); AaruConsole.DebugWriteLine("Ls command", "--encoding={0}", encoding); AaruConsole.DebugWriteLine("Ls command", "--input={0}", imagePath); AaruConsole.DebugWriteLine("Ls command", "--options={0}", options); AaruConsole.DebugWriteLine("Ls command", "--verbose={0}", verbose); Statistics.AddCommand("ls"); var filtersList = new FiltersList(); IFilter inputFilter = filtersList.GetFilter(imagePath); Dictionary <string, string> parsedOptions = Core.Options.Parse(options); AaruConsole.DebugWriteLine("Ls command", "Parsed options:"); foreach (KeyValuePair <string, string> parsedOption in parsedOptions) { AaruConsole.DebugWriteLine("Ls command", "{0} = {1}", parsedOption.Key, parsedOption.Value); } parsedOptions.Add("debug", debug.ToString()); if (inputFilter == null) { AaruConsole.ErrorWriteLine("Cannot open specified file."); return((int)ErrorNumber.CannotOpenFile); } Encoding encodingClass = null; if (encoding != null) { try { encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding); if (verbose) { AaruConsole.VerboseWriteLine("Using encoding for {0}.", encodingClass.EncodingName); } } catch (ArgumentException) { AaruConsole.ErrorWriteLine("Specified encoding is not supported."); return((int)ErrorNumber.EncodingUnknown); } } PluginBase plugins = GetPluginBase.Instance; try { IMediaImage imageFormat = ImageFormat.Detect(inputFilter); if (imageFormat == null) { AaruConsole.WriteLine("Image format not identified, not proceeding with analysis."); return((int)ErrorNumber.UnrecognizedFormat); } if (verbose) { AaruConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name, imageFormat.Id); } else { AaruConsole.WriteLine("Image format identified by {0}.", imageFormat.Name); } try { if (!imageFormat.Open(inputFilter)) { AaruConsole.WriteLine("Unable to open image format"); AaruConsole.WriteLine("No error given"); return((int)ErrorNumber.CannotOpenFormat); } AaruConsole.DebugWriteLine("Ls command", "Correctly opened image file."); AaruConsole.DebugWriteLine("Ls command", "Image without headers is {0} bytes.", imageFormat.Info.ImageSize); AaruConsole.DebugWriteLine("Ls command", "Image has {0} sectors.", imageFormat.Info.Sectors); AaruConsole.DebugWriteLine("Ls command", "Image identifies disk type as {0}.", imageFormat.Info.MediaType); Statistics.AddMediaFormat(imageFormat.Format); Statistics.AddMedia(imageFormat.Info.MediaType, false); Statistics.AddFilter(inputFilter.Name); } catch (Exception ex) { AaruConsole.ErrorWriteLine("Unable to open image format"); AaruConsole.ErrorWriteLine("Error: {0}", ex.Message); return((int)ErrorNumber.CannotOpenFormat); } List <Partition> partitions = Core.Partitions.GetAll(imageFormat); Core.Partitions.AddSchemesToStats(partitions); if (partitions.Count == 0) { AaruConsole.DebugWriteLine("Ls command", "No partitions found"); partitions.Add(new Partition { Description = "Whole device", Length = imageFormat.Info.Sectors, Offset = 0, Size = imageFormat.Info.SectorSize * imageFormat.Info.Sectors, Sequence = 1, Start = 0 }); } AaruConsole.WriteLine("{0} partitions found.", partitions.Count); for (int i = 0; i < partitions.Count; i++) { AaruConsole.WriteLine(); AaruConsole.WriteLine("Partition {0}:", partitions[i].Sequence); AaruConsole.WriteLine("Identifying filesystem on partition"); Core.Filesystems.Identify(imageFormat, out List <string> idPlugins, partitions[i]); if (idPlugins.Count == 0) { AaruConsole.WriteLine("Filesystem not identified"); } else { IReadOnlyFilesystem plugin; Errno error; if (idPlugins.Count > 1) { AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach (string pluginName in idPlugins) { if (plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin)) { AaruConsole.WriteLine($"As identified by {plugin.Name}."); var fs = (IReadOnlyFilesystem)plugin.GetType().GetConstructor(Type.EmptyTypes)?. Invoke(new object[] {}); if (fs == null) { continue; } error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); if (error == Errno.NoError) { ListFilesInDir("/", fs, longFormat); Statistics.AddFilesystem(fs.XmlFsType.Type); } else { AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } } } else { plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin); if (plugin == null) { continue; } AaruConsole.WriteLine($"Identified by {plugin.Name}."); var fs = (IReadOnlyFilesystem)plugin.GetType().GetConstructor(Type.EmptyTypes)?. Invoke(new object[] {}); if (fs == null) { continue; } error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); if (error == Errno.NoError) { ListFilesInDir("/", fs, longFormat); Statistics.AddFilesystem(fs.XmlFsType.Type); } else { AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } } } } catch (Exception ex) { AaruConsole.ErrorWriteLine($"Error reading file: {ex.Message}"); AaruConsole.DebugWriteLine("Ls command", ex.StackTrace); return((int)ErrorNumber.UnexpectedException); } return((int)ErrorNumber.NoError); }
public override ICollection <FilterValue> GroupValues(ICollection <Guid> necessaryMIATypeIds, IFilter selectAttributeFilter, IFilter filter) { return(null); }
public override ICollection <FilterValue> GetAvailableValues(IEnumerable <Guid> necessaryMIATypeIds, IFilter selectAttributeFilter, IFilter filter) { IContentDirectory cd = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory; if (cd == null) { throw new NotConnectedException("The MediaLibrary is not connected"); } Guid? userProfile = null; IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>(); if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser) { userProfile = userProfileDataManagement.CurrentUser.ProfileId; } IEnumerable <Guid> mias = new[] { MediaAspect.ASPECT_ID, ProviderResourceAspect.ASPECT_ID, EpisodeAspect.ASPECT_ID }.Concat(necessaryMIATypeIds); MediaItemQuery query = new MediaItemQuery(mias, filter) { SortInformation = new List <SortInformation> { new SortInformation(EpisodeAspect.ATTR_EPISODE, SortDirection.Ascending) } }; var items = cd.Search(query, true, userProfile, ShowVirtualSetting.ShowVirtualMedia(necessaryMIATypeIds)); IList <FilterValue> result = new List <FilterValue>(items.Count); foreach (var item in items) { string title; MediaItemAspect.TryGetAttribute(item.Aspects, MediaAspect.ATTR_TITLE, out title); // TODO: Now what? There's no values for an episode result.Add(new FilterValue(title, null, null, item, null)); } return(result); }
public FilterCollection Add(IFilter filter) { _filters.Add(filter); return(this); }
public void Run(string name, IFilter filter, Sketching.Numerics.Rectangle target) { CheckCorrect(name, filter, target); }
public async Task <Tuple <int, List <Spectator> > > SearchSpectatorAsync(Pagination pagination, IFilter <Spectator> filter) { try { return(await m_repository.SearchAsync(pagination, filter)); } catch (Exception e) { m_logger.LogCritical(e, "Unexpected Exception while trying to search for Spectators"); throw; } }
private Bitmap ApplyFilter(IFilter filter, Bitmap image) { return(filter.Apply(image)); }
private static void PatchAddresses(this Core2User user, PatchOperation operation) { if (null == operation) { return; } if ( !string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Addresses, operation.Path.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return; } if (null == operation.Path.ValuePath) { return; } if (string.IsNullOrWhiteSpace(operation.Path.ValuePath.AttributePath)) { return; } IFilter subAttribute = operation.Path.SubAttributes.SingleOrDefault(); if (null == subAttribute) { return; } if ( ( operation.Value != null && operation.Value.Count != 1 ) || ( null == operation.Value && operation.Name != OperationName.Remove ) ) { return; } if ( !string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Type, subAttribute.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return; } Address address; Address addressExisting; if (user.Addresses != null) { addressExisting = address = user .Addresses .SingleOrDefault( (Address item) => string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)); } else { addressExisting = null; address = new Address() { ItemType = subAttribute.ComparisonValue }; } string value; if (string.Equals(Address.Work, subAttribute.ComparisonValue, StringComparison.Ordinal)) { if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Country, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Country, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Country = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Locality, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Locality, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Locality = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.PostalCode, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.PostalCode, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.PostalCode = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Region, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Region, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Region = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.StreetAddress, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.StreetAddress, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.StreetAddress = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Formatted, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Formatted, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Formatted = value; } } if (string.Equals(Address.Other, subAttribute.ComparisonValue, StringComparison.Ordinal)) { if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Country, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Country, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Country = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Locality, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Locality, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Locality = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.PostalCode, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.PostalCode, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.PostalCode = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Region, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Region, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Region = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.StreetAddress, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.StreetAddress, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.StreetAddress = value; } if ( string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Formatted, operation.Path.ValuePath.AttributePath, StringComparison.Ordinal) ) { value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, address.Formatted, StringComparison.OrdinalIgnoreCase) ) { value = null; } address.Formatted = value; } } if ( string.IsNullOrWhiteSpace(address.Country) && string.IsNullOrWhiteSpace(address.Locality) && string.IsNullOrWhiteSpace(address.PostalCode) && string.IsNullOrWhiteSpace(address.Region) && string.IsNullOrWhiteSpace(address.StreetAddress) && string.IsNullOrWhiteSpace(address.Formatted) ) { if (addressExisting != null) { user.Addresses = user .Addresses .Where( (Address item) => !string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)) .ToArray(); } return; } if (addressExisting != null) { return; } IEnumerable <Address> addresses = new Address[] { address }; if (null == user.Addresses) { user.Addresses = addresses; } else { user.Addresses = user.Addresses.Union(addresses).ToArray(); } }
private static void PatchPhoneNumbers(this Core2User user, PatchOperation operation) { if (null == operation) { return; } if ( !string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.PhoneNumbers, operation.Path.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return; } if (null == operation.Path.ValuePath) { return; } if (string.IsNullOrWhiteSpace(operation.Path.ValuePath.AttributePath)) { return; } IFilter subAttribute = operation.Path.SubAttributes.SingleOrDefault(); if (null == subAttribute) { return; } if ( ( operation.Value != null && operation.Value.Count != 1 ) || ( null == operation.Value && operation.Name != OperationName.Remove ) ) { return; } if ( !string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Type, subAttribute.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return; } string phoneNumberType = subAttribute.ComparisonValue; if ( !string.Equals(phoneNumberType, PhoneNumber.Fax, StringComparison.Ordinal) && !string.Equals(phoneNumberType, PhoneNumber.Mobile, StringComparison.Ordinal) && !string.Equals(phoneNumberType, PhoneNumber.Work, StringComparison.Ordinal) ) { return; } PhoneNumber phoneNumber; PhoneNumber phoneNumberExisting; if (user.PhoneNumbers != null) { phoneNumberExisting = phoneNumber = user .PhoneNumbers .SingleOrDefault( (PhoneNumber item) => string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)); } else { phoneNumberExisting = null; phoneNumber = new PhoneNumber() { ItemType = subAttribute.ComparisonValue }; } string value = operation.Value != null?GetSingleValue(operation) : null; if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, phoneNumber.Value, StringComparison.OrdinalIgnoreCase) ) { value = null; } phoneNumber.Value = value; if (string.IsNullOrWhiteSpace(phoneNumber.Value)) { if (phoneNumberExisting != null) { user.PhoneNumbers = user .PhoneNumbers .Where( (PhoneNumber item) => !string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)) .ToArray(); } return; } if (phoneNumberExisting != null) { return; } IEnumerable <PhoneNumber> phoneNumbers = new PhoneNumber[] { phoneNumber }; if (null == user.PhoneNumbers) { user.PhoneNumbers = phoneNumbers; } else { user.PhoneNumbers = user.PhoneNumbers.Union(phoneNumbers).ToArray(); } }
internal static IEnumerable <ElectronicMailAddress> PatchElectronicMailAddresses( IEnumerable <ElectronicMailAddress> electronicMailAddresses, PatchOperation operation) { if (null == operation) { return(electronicMailAddresses); } if ( !string.Equals( AttributeNames.ElectronicMailAddresses, operation.Path.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return(electronicMailAddresses); } if (null == operation.Path.ValuePath) { return(electronicMailAddresses); } if (string.IsNullOrWhiteSpace(operation.Path.ValuePath.AttributePath)) { return(electronicMailAddresses); } IFilter subAttribute = operation.Path.SubAttributes.SingleOrDefault(); if (null == subAttribute) { return(electronicMailAddresses); } if ( ( operation.Value != null && operation.Value.Count != 1 ) || ( null == operation.Value && operation.Name != OperationName.Remove ) ) { return(electronicMailAddresses); } if ( !string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.Type, subAttribute.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return(electronicMailAddresses); } string electronicMailAddressType = subAttribute.ComparisonValue; if ( !string.Equals(electronicMailAddressType, ElectronicMailAddress.Home, StringComparison.Ordinal) && !string.Equals(electronicMailAddressType, ElectronicMailAddress.Work, StringComparison.Ordinal) ) { return(electronicMailAddresses); } ElectronicMailAddress electronicMailAddress; ElectronicMailAddress electronicMailAddressExisting; if (electronicMailAddresses != null) { electronicMailAddressExisting = electronicMailAddress = electronicMailAddresses .SingleOrDefault( (ElectronicMailAddress item) => string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)); } else { electronicMailAddressExisting = null; electronicMailAddress = new ElectronicMailAddress() { ItemType = electronicMailAddressType }; } string value = operation.Value?.Single()["value"].ToString(); if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, electronicMailAddress.Value, StringComparison.OrdinalIgnoreCase) ) { value = null; } electronicMailAddress.Value = value; IEnumerable <ElectronicMailAddress> result; if (string.IsNullOrWhiteSpace(electronicMailAddress.Value)) { if (electronicMailAddressExisting != null) { result = electronicMailAddresses .Where( (ElectronicMailAddress item) => !string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)) .ToArray(); } else { result = electronicMailAddresses; } return(result); } if (electronicMailAddressExisting != null) { return(electronicMailAddresses); } result = new ElectronicMailAddress[] { electronicMailAddress }; if (null == electronicMailAddresses) { return(result); } result = electronicMailAddresses.Union(electronicMailAddresses).ToArray(); return(result); }
public Duplicati.Library.Interface.IBackupResults Backup(string[] inputsources, IFilter filter = null) { Library.UsageReporter.Reporter.Report("USE_BACKEND", new Library.Utility.Uri(m_backend).Scheme); Library.UsageReporter.Reporter.Report("USE_COMPRESSION", m_options.CompressionModule); Library.UsageReporter.Reporter.Report("USE_ENCRYPTION", m_options.EncryptionModule); return(RunAction(new BackupResults(), ref inputsources, ref filter, (result) => { var bModulesFiles = false; foreach (var mx in m_options.LoadedModules) { if (mx.Key && mx.Value is Library.Interface.IGenericSourceModule) { if (!bModulesFiles) { bModulesFiles = ((Library.Interface.IGenericSourceModule)mx.Value).ContainFiles(m_options.RawOptions); } } } if (!bModulesFiles && (inputsources == null || inputsources.Length == 0)) { throw new Exception(Strings.Controller.NoSourceFoldersError); } var sources = new List <string>(inputsources); //Make sure they all have the same format and exist for (int i = 0; i < sources.Count; i++) { try { sources[i] = System.IO.Path.GetFullPath(sources[i]); } catch (Exception ex) { throw new ArgumentException(Strings.Controller.InvalidPathError(sources[i], ex.Message), ex); } var fi = new System.IO.FileInfo(sources[i]); var di = new System.IO.DirectoryInfo(sources[i]); if (!(fi.Exists || di.Exists) && !m_options.AllowMissingSource) { throw new System.IO.IOException(Strings.Controller.SourceIsMissingError(sources[i])); } if (!fi.Exists) { sources[i] = Library.Utility.Utility.AppendDirSeparator(sources[i]); } } //Sanity check for duplicate files/folders var pathDuplicates = sources.GroupBy(x => x, Library.Utility.Utility.ClientFilenameStringComparer) .Where(g => g.Count() > 1).Select(y => y.Key).ToList(); foreach (var pathDuplicate in pathDuplicates) { result.AddVerboseMessage(string.Format("Removing duplicate source: {0}", pathDuplicate)); } sources = sources.Distinct(Library.Utility.Utility.ClientFilenameStringComparer).OrderBy(a => a).ToList(); //Sanity check for multiple inclusions of the same folder for (int i = 0; i < sources.Count; i++) { for (int j = 0; j < sources.Count; j++) { if (i != j && sources[i].StartsWith(sources[j], Library.Utility.Utility.ClientFilenameStringComparision)) { if (filter != null) { bool includes; bool excludes; FilterExpression.AnalyzeFilters(filter, out includes, out excludes); // If there are no excludes, there is no need to keep the folder as a filter if (excludes) { result.AddVerboseMessage("Removing source \"{0}\" because it is a subfolder of \"{1}\", and using it as an include filter", sources[i], sources[j]); filter = Library.Utility.JoinedFilterExpression.Join(new FilterExpression(sources[i]), filter); } else { result.AddVerboseMessage("Removing source \"{0}\" because it is a subfolder or subfile of \"{1}\"", sources[i], sources[j]); } } else { result.AddVerboseMessage("Removing source \"{0}\" because it is a subfolder or subfile of \"{1}\"", sources[i], sources[j]); } sources.RemoveAt(i); i--; break; } } } using (var h = new Operation.BackupHandler(m_backend, m_options, result)) h.Run(sources.ToArray(), filter); Library.UsageReporter.Reporter.Report("BACKUP_FILECOUNT", result.ExaminedFiles); Library.UsageReporter.Reporter.Report("BACKUP_FILESIZE", result.SizeOfExaminedFiles); Library.UsageReporter.Reporter.Report("BACKUP_DURATION", (long)result.Duration.TotalSeconds); })); }
internal static IEnumerable <Role> PatchRoles(IEnumerable <Role> roles, PatchOperation operation) { if (null == operation) { return(roles); } if ( !string.Equals( Microsoft.AzureAD.Provisioning.ScimReference.Api.Schemas.AttributeNames.PhoneNumbers, operation.Path.AttributePath, StringComparison.OrdinalIgnoreCase) ) { return(roles); } if (null == operation.Path.ValuePath) { return(roles); } if (string.IsNullOrWhiteSpace(operation.Path.ValuePath.AttributePath)) { return(roles); } IFilter subAttribute = operation.Path.SubAttributes.SingleOrDefault(); if (null == subAttribute) { return(roles); } if ( ( operation.Value != null && operation.Value.Count != 1 ) || ( null == operation.Value && operation.Name != OperationName.Remove ) ) { return(roles); } Role role; Role roleAddressExisting; if (roles != null) { roleAddressExisting = role = roles .SingleOrDefault( (Role item) => string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)); } else { roleAddressExisting = null; role = new Role() { Primary = true }; } string value = operation.Value?.Single()["value"].ToString(); if ( value != null && OperationName.Remove == operation.Name && string.Equals(value, role.Value, StringComparison.OrdinalIgnoreCase) ) { value = null; } role.Value = value; IEnumerable <Role> result; if (string.IsNullOrWhiteSpace(role.Value)) { if (roleAddressExisting != null) { result = roles .Where( (Role item) => !string.Equals(subAttribute.ComparisonValue, item.ItemType, StringComparison.Ordinal)) .ToArray(); } else { result = roles; } return(result); } if (roleAddressExisting != null) { return(roles); } result = new Role[] { role }; if (null == roles) { return(result); } result = roles.Union(roles).ToArray(); return(result); }
public CustomFiltersScoreQuery AddBoostedFilter(IFilter filter, double boost) { Filters.Add(filter, boost); return(this); }
private void SetupCommonOptions(ISetCommonOptions result, ref string[] paths, ref IFilter filter) { m_options.MainAction = result.MainOperation; result.MessageSink = m_messageSink; switch (m_options.MainAction) { case OperationMode.Backup: break; default: //It only makes sense to enable auto-creation if we are writing files. if (!m_options.RawOptions.ContainsKey("disable-autocreate-folder")) { m_options.RawOptions["disable-autocreate-folder"] = "true"; } break; } //Load all generic modules m_options.LoadedModules.Clear(); foreach (Library.Interface.IGenericModule m in DynamicLoader.GenericLoader.Modules) { m_options.LoadedModules.Add(new KeyValuePair <bool, Library.Interface.IGenericModule>(Array.IndexOf <string>(m_options.DisableModules, m.Key.ToLower()) < 0 && (m.LoadAsDefault || Array.IndexOf <string>(m_options.EnableModules, m.Key.ToLower()) >= 0), m)); } var conopts = new Dictionary <string, string>(m_options.RawOptions); var qp = new Library.Utility.Uri(m_backend).QueryParameters; foreach (var k in qp.Keys) { conopts[(string)k] = qp[(string)k]; } // Make the filter read-n-write able in the generic modules var pristinefilter = conopts["filter"] = string.Join(System.IO.Path.PathSeparator.ToString(), FilterExpression.Serialize(filter)); foreach (var mx in m_options.LoadedModules) { if (mx.Key) { if (mx.Value is Library.Interface.IConnectionModule) { mx.Value.Configure(conopts); } else { mx.Value.Configure(m_options.RawOptions); } if (mx.Value is Library.Interface.IGenericSourceModule) { var sourceoptions = ((Library.Interface.IGenericSourceModule)mx.Value).ParseSource(ref paths, ref pristinefilter, m_options.RawOptions); foreach (var sourceoption in sourceoptions) { m_options.RawOptions[sourceoption.Key] = sourceoption.Value; } } if (mx.Value is Library.Interface.IGenericCallbackModule) { ((Library.Interface.IGenericCallbackModule)mx.Value).OnStart(result.MainOperation.ToString(), ref m_backend, ref paths); } } } // If the filters were changed, read them back in if (pristinefilter != conopts["filter"]) { filter = FilterExpression.Deserialize(pristinefilter.Split(new string[] { System.IO.Path.PathSeparator.ToString() }, StringSplitOptions.RemoveEmptyEntries)); } OperationRunning(true); if (m_options.HasLoglevel) { Library.Logging.Log.LogLevel = m_options.Loglevel; } if (!string.IsNullOrEmpty(m_options.Logfile)) { m_hasSetLogging = true; var path = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(m_options.Logfile)); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } Library.Logging.Log.CurrentLog = new Library.Logging.StreamLog(m_options.Logfile); } result.VerboseErrors = m_options.DebugOutput; result.VerboseOutput = m_options.Verbose; if (m_options.HasTempDir) { Library.Utility.TempFolder.SystemTempPath = m_options.TempDir; if (Library.Utility.Utility.IsClientLinux) { m_resetKeys["TMPDIR"] = Environment.GetEnvironmentVariable("TMPDIR"); Environment.SetEnvironmentVariable("TMPDIR", m_options.TempDir); } else { m_resetKeys["TMP"] = Environment.GetEnvironmentVariable("TMP"); m_resetKeys["TEMP"] = Environment.GetEnvironmentVariable("TEMP"); Environment.SetEnvironmentVariable("TMP", m_options.TempDir); Environment.SetEnvironmentVariable("TEMP", m_options.TempDir); } } if (m_options.HasForcedLocale) { try { var locale = m_options.ForcedLocale; DoGetLocale(out m_resetLocale, out m_resetLocaleUI); m_doResetLocale = true; // Wrap the call to avoid loading issues for the setLocale method DoSetLocale(locale, locale); } catch (Exception ex) // or only: MissingMethodException { Library.Logging.Log.WriteMessage(Strings.Controller.FailedForceLocaleError(ex.Message), Logging.LogMessageType.Warning); m_doResetLocale = false; m_resetLocale = m_resetLocaleUI = null; } } if (!string.IsNullOrEmpty(m_options.ThreadPriority)) { m_resetPriority = System.Threading.Thread.CurrentThread.Priority; System.Threading.Thread.CurrentThread.Priority = Library.Utility.Utility.ParsePriority(m_options.ThreadPriority); } if (string.IsNullOrEmpty(m_options.Dbpath)) { m_options.Dbpath = DatabaseLocator.GetDatabasePath(m_backend, m_options); } ValidateOptions(result); Library.Logging.Log.WriteMessage(Strings.Controller.StartingOperationMessage(m_options.MainAction), Logging.LogMessageType.Information); }
public override IQueryable <EmergencyHistoryModel> ApplyFilterPagination(IQueryable <EmergencyHistory> query, IFilter filter) { throw new NotImplementedException(); }
/// <summary> /// Updates the GUI data for a filter values selection screen which reflects the available filter values for /// the current base view specification of our <see cref="AbstractScreenData._navigationData"/>. /// </summary> protected void ReloadFilterValuesList(bool createNewList) { MediaLibraryQueryViewSpecification currentVS = _navigationData.BaseViewSpecification as MediaLibraryQueryViewSpecification; if (currentVS == null) { // Should never happen ServiceRegistration.Get <ILogger>().Error("FilterScreenData: Wrong type of media library view '{0}'", _navigationData.BaseViewSpecification); return; } // Control other threads reentering this method lock (_syncObj) { if (_buildingList) { // Another thread is already building the items list - mark it as dirty and let the other thread // rebuild it. _listDirty = true; return; } // Mark the list as being built _buildingList = true; _listDirty = false; } try { ItemsList items; if (createNewList) { items = new ItemsList(); } else { items = _items; items.Clear(); } try { Display_ListBeingBuilt(); bool grouping = true; int numItems = 0; ICollection <FilterValue> fv = _clusterFilter == null? _filterCriterion.GroupValues(currentVS.NecessaryMIATypeIds, _clusterFilter, currentVS.Filter) : null; if (fv != null) { numItems = fv.Select(filterValue => filterValue.NumItems).Select(num => num.HasValue ? num.Value : 0).Sum(); } if (fv == null || numItems <= Consts.MAX_NUM_ITEMS_VISIBLE) { fv = _filterCriterion.GetAvailableValues(currentVS.NecessaryMIATypeIds, _clusterFilter, currentVS.Filter); grouping = false; } if (fv.Count > Consts.MAX_NUM_ITEMS_VISIBLE) { Display_TooManyItems(fv.Count); } else { lock (_syncObj) if (_listDirty) { goto RebuildView; } int totalNumItems = 0; // Build collection of available (filter/display) screens which will remain in the next view - that is all currently // available screens without the screen which equals this current screen. But we cannot simply remove "this" // from the collection, because "this" could be a derived screen (in case our base screen showed groups). // So we need an equality criterion when the screen to be removed is equal to this screen in terms of its // filter criterion. But with the given data, we actually cannot derive that equality. // So we simply use the MenuItemLabel, which should be the same in this and the base screen of the same filter. ICollection <AbstractScreenData> remainingScreens = new List <AbstractScreenData>( _navigationData.AvailableScreens.Where(screen => screen.MenuItemLabel != MenuItemLabel)); foreach (FilterValue filterValue in fv) { string filterTitle = filterValue.Title; IFilter selectAttributeFilter = filterValue.SelectAttributeFilter; MediaLibraryQueryViewSpecification subVS = currentVS.CreateSubViewSpecification(filterTitle, filterValue.Filter); T filterValueItem = new T { SimpleTitle = filterTitle, NumItems = filterValue.NumItems, Command = grouping ? new MethodDelegateCommand(() => NavigateToGroup(subVS, selectAttributeFilter)) : new MethodDelegateCommand(() => NavigateToSubView(subVS, remainingScreens)) }; items.Add(filterValueItem); if (filterValue.NumItems.HasValue) { totalNumItems += filterValue.NumItems.Value; } } Display_Normal(items.Count, totalNumItems == 0 ? new int?() : totalNumItems); } } catch (Exception e) { ServiceRegistration.Get <ILogger>().Warn("AbstractFiltersScreenData: Error creating filter values list", e); Display_ItemsInvalid(); } RebuildView: if (_listDirty) { lock (_syncObj) _buildingList = false; ReloadFilterValuesList(createNewList); } else { _items = items; _items.FireChange(); } } finally { lock (_syncObj) _buildingList = false; } }
public void AddChild(IContainer container, IFilter filter) { filter.FilterContainer_ID = container.ID; filter.SaveToDatabase(); }
public override Result <List <EmergencyHistoryModel> > FindAll(IFilter filter) { throw new NotImplementedException(); }
public IFilter CreateFilter(IFilter original, IFilter initial) { IFilter lab; IFilter result = initial; // Calculate Sizes var inputSize = original.OutputSize; var targetSize = TargetSize(); string macroDefinitions = ""; if (IsIntegral(Strength)) { macroDefinitions += String.Format("strength = {0};", Strength); } if (IsIntegral(Softness)) { macroDefinitions += String.Format("softness = {0};", Softness); } // Compile Shaders var Diff = CompileShader("Diff.hlsl") .Configure(format: TextureFormat.Float16); var SuperRes = CompileShader("SuperResEx.hlsl", macroDefinitions: macroDefinitions) .Configure( arguments: new[] { Strength, Softness } ); var GammaToLab = CompileShader("../Common/GammaToLab.hlsl"); var LabToGamma = CompileShader("../Common/LabToGamma.hlsl"); var LinearToGamma = CompileShader("../Common/LinearToGamma.hlsl"); var GammaToLinear = CompileShader("../Common/GammaToLinear.hlsl"); var LabToLinear = CompileShader("../Common/LabToLinear.hlsl"); var LinearToLab = CompileShader("../Common/LinearToLab.hlsl"); // Skip if downscaling if (targetSize.Width <= inputSize.Width && targetSize.Height <= inputSize.Height) { return(original); } // Initial scaling if (initial != original) { original = new ShaderFilter(GammaToLab, original); // Always correct offset (if any) if (initial is ResizeFilter) { ((ResizeFilter)initial).ForceOffsetCorrection(); } lab = new ShaderFilter(GammaToLab, initial.SetSize(targetSize)); } else { original = new ShaderFilter(GammaToLab, original); lab = new ResizeFilter(original, targetSize); } for (int i = 1; i <= Passes; i++) { IFilter diff, linear; // Downscale and Subtract linear = new ShaderFilter(LabToLinear, lab); linear = new ResizeFilter(linear, inputSize, m_Upscaler, m_Downscaler); // Downscale result diff = new ShaderFilter(Diff, linear, original); // Compare with original // Update result lab = new ShaderFilter(SuperRes, lab, diff); result = new ShaderFilter(LabToGamma, lab); } return(result); }
/// <summary> /// Configures for WFS 'GetFeature' request using an instance implementing <see cref="SharpMap.Utilities.Wfs.IWFS_TextResources"/>. /// The <see cref="SharpMap.Utilities.Wfs.HttpClientUtil"/> instance is returned for immediate usage. /// </summary> internal HttpClientUtil configureForWfsGetFeatureRequest(HttpClientUtil httpClientUtil, WfsFeatureTypeInfo featureTypeInfo, string labelProperty, BoundingBox boundingBox, IFilter filter, bool GET) { httpClientUtil.Reset(); httpClientUtil.Url = featureTypeInfo.ServiceURI; if (GET) { /* HTTP-GET */ httpClientUtil.Url += _WfsTextResources.GetFeatureGETRequest(featureTypeInfo, boundingBox, filter); return(httpClientUtil); } /* HTTP-POST */ httpClientUtil.PostData = _WfsTextResources.GetFeaturePOSTRequest(featureTypeInfo, labelProperty, boundingBox, filter); httpClientUtil.AddHeader(HttpRequestHeader.ContentType.ToString(), "text/xml"); return(httpClientUtil); }
public bool Matches(string entry, out bool result, out IFilter match) { return First.Matches(entry, out result, out match) || Second.Matches(entry, out result, out match); }
public FilterBucketAggregation(string name, IFilter filter) : base("filter", name) { _filter = filter; }
protected override SqlParameter[] BuildParameters(IFilter IFilter, string strCommand) { throw new NotImplementedException(); }
public override IFilter CreateFilter(IFilter input) { return(CreateFilter(input, input + SelectedOption)); }
public string Upload(IPhoto photo, IFilter filter, bool is_public, bool is_family, bool is_friend) { if (accessToken == null) { throw new Exception("Must Login First"); } // FIXME flickr needs rotation string error_verbose; using (FilterRequest request = new FilterRequest(photo.DefaultVersion.Uri)) { try { string tags = null; filter.Convert(request); string path = request.Current.LocalPath; if (ExportTags && photo.Tags != null) { var taglist = new StringBuilder(); Core.Tag [] t = photo.Tags; Core.Tag tag_iter = null; for (int i = 0; i < t.Length; i++) { if (i > 0) { taglist.Append(","); } taglist.Append(string.Format("\"{0}\"", t [i].Name)); // Go through the tag parents if (ExportTagHierarchy) { tag_iter = t [i].Category; while (tag_iter != App.Instance.Database.Tags.RootCategory && tag_iter != null) { // Skip top level tags because they have no meaning in a linear tag database if (ExportIgnoreTopLevel && tag_iter.Category == App.Instance.Database.Tags.RootCategory) { break; } // FIXME Look if the tag is already there! taglist.Append(","); taglist.Append(string.Format("\"{0}\"", tag_iter.Name)); tag_iter = tag_iter.Category; } } } tags = taglist.ToString(); } try { string photoid = flickr.UploadPicture(path, photo.Name, photo.Description, tags, is_public, is_family, is_friend); return(photoid); } catch (FlickrException ex) { Log.Error("Problems uploading picture: " + ex.Message); error_verbose = ex.ToString(); } } catch (Exception e) { // FIXME we need to distinguish between file IO errors and xml errors here throw new Exception("Error while uploading", e); } } throw new Exception(error_verbose); }
public JoinedFilterExpression(IFilter first, IFilter second) { this.First = first ?? new FilterExpression(); this.Second = second ?? new FilterExpression(); }
public FilteredStats(string filter) : base(new Storage()) { _filter = Filter.Create(new SessionStatsTester(), filter); }
/// <summary> /// Processes a Filter /// </summary> /// <param name="filter">Filter</param> /// <param name="context">SPARQL Evaluation Context</param> public override BaseMultiset ProcessFilter(IFilter filter, SparqlEvaluationContext context) { return(this.ExplainAndEvaluate <IFilter>(filter, context, base.ProcessFilter)); }
/// <summary> /// Initializes a new instance of the <see cref="MProfParser" /> class. /// </summary> /// <param name="assemblyFilter">The assembly filter.</param> /// <param name="classFilter">The class filter.</param> /// <param name="fileFilter">The file filter.</param> internal MProfParser(IFilter assemblyFilter, IFilter classFilter, IFilter fileFilter) : base(assemblyFilter, classFilter, fileFilter) { }
// Due to .cue format, this method must parse whole file, ignoring errors (those will be thrown by OpenImage()). public bool Identify(IFilter imageFilter) { _cdrwinFilter = imageFilter; try { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); byte[] testArray = new byte[512]; imageFilter.GetDataForkStream().Read(testArray, 0, 512); imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin bool twoConsecutiveNulls = false; for (int i = 0; i < 512; i++) { if (i >= imageFilter.GetDataForkStream().Length) { break; } if (testArray[i] == 0) { if (twoConsecutiveNulls) { return(false); } twoConsecutiveNulls = true; } else { twoConsecutiveNulls = false; } if (testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) { return(false); } } _cueStream = new StreamReader(_cdrwinFilter.GetDataForkStream()); while (_cueStream.Peek() >= 0) { string line = _cueStream.ReadLine(); var sr = new Regex(REGEX_SESSION); var rr = new Regex(REGEX_COMMENT); var cr = new Regex(REGEX_MCN); var fr = new Regex(REGEX_FILE); var tr = new Regex(REGEX_CDTEXT); // First line must be SESSION, REM, CATALOG, FILE or CDTEXTFILE. Match sm = sr.Match(line ?? throw new InvalidOperationException()); Match rm = rr.Match(line); Match cm = cr.Match(line); Match fm = fr.Match(line); Match tm = tr.Match(line); return(sm.Success || rm.Success || cm.Success || fm.Success || tm.Success); } return(false); } catch (Exception ex) { AaruConsole.ErrorWriteLine("Exception trying to identify image file {0}", _cdrwinFilter); AaruConsole.ErrorWriteLine("Exception: {0}", ex.Message); AaruConsole.ErrorWriteLine("Stack trace: {0}", ex.StackTrace); return(false); } }