Ejemplo n.º 1
0
 public TagService(IConverterFactory factory, BaseProvider <Tag> provider,
                   BaseProvider <PhotoToTag> providerPhotoToTag, BaseProvider <Photo> providerPhoto)
 {
     _providerTag        = provider;
     _providerPhoto      = providerPhoto;
     _providerPhotoToTag = providerPhotoToTag;
     _factory            = factory;
     _converter          = _factory.GetConverter <ITagConverter>();
 }
Ejemplo n.º 2
0
 public PhotoService(IConverterFactory factory, BaseProvider <Photo> provider,
                     BaseProvider <Watermark> providerWatermark, BaseProvider <Tag> providerTag,
                     BaseProvider <PhotoToTag> providerPhotoToTag, BaseProvider <Album> providerAlbum)
 {
     _providerPhoto      = provider;
     _providerWatermark  = providerWatermark;
     _providerPhotoToTag = providerPhotoToTag;
     _providerTag        = providerTag;
     _factory            = factory;
     _providerAlbum      = providerAlbum;
     _converter          = _factory.GetConverter <IPhotoConverter>();
     _converterWatermark = _factory.GetConverter <IWatermarkConverter>();
     _converterTag       = _factory.GetConverter <ITagConverter>();
 }
Ejemplo n.º 3
0
 public T ConvertFromValue <T>(ITag property)
 {
     if (typeof(T).GetCustomAttributes(typeof(PersistentObjectAttribute), true).Length > 0)
     {
         return(PersistentObjectConverter.FromJson <T>(this, property));
     }
     foreach (KeyValuePair <Type, ITagConverter> converterPair in Converters)
     {
         if (converterPair.Key.IsAssignableFrom(typeof(T)))
         {
             ITagConverter converter = converterPair.Value;
             T             converted = converter.FromJson <T>(this, property);
             if (converted is TagCustom)
             {
                 throw new InvalidOperationException("Converter for type " + converterPair.Key.FullName + " does not convert to a valid value");
             }
             return(converted);
         }
     }
     throw new ArgumentException("No converter available for such type: " + typeof(T).FullName);
 }
Ejemplo n.º 4
0
 public ITag ConvertToValue(object value)
 {
     if (value.GetType().GetCustomAttributes(typeof(PersistentObjectAttribute), true).Length > 0)
     {
         return(PersistentObjectConverter.ToJson(this, value));
     }
     foreach (KeyValuePair <Type, ITagConverter> converterPair in Converters)
     {
         if (converterPair.Key.IsAssignableFrom(value.GetType()))
         {
             ITagConverter converter = converterPair.Value;
             ITag          converted = converter.ToJson(this, value);
             if (converted is TagCustom)
             {
                 throw new InvalidOperationException("Converter for type " + converterPair.Key.FullName + " does not convert to a valid value");
             }
             return(converted);
         }
     }
     throw new ArgumentException("No converter available for such type: " + value.GetType().FullName);
 }
Ejemplo n.º 5
0
 public void RegisterConverter(ITagConverter converter) => Converters[converter.GetWorkingType()] = converter;
 /// <summary>
 /// Initializes a new instance of the <see cref="OpenXmlTagExtractor"/> class with a specified <see cref="ITagConverter"/> and <see cref="IOpenXmlAssemblySearcher"/>.
 /// </summary>
 /// <param name="tagConverter">To convert the OpenXML elements to <see cref="Tag"/> objects.</param>
 /// <param name="openXmlAssemblySearcher">To search the assessbly for OpenXML elements.</param>
 public OpenXmlTagExtractor(ITagConverter tagConverter, IOpenXmlAssemblySearcher openXmlAssemblySearcher)
 {
     this.tagConverter            = tagConverter;
     this.openXmlAssemblySearcher = openXmlAssemblySearcher;
 }
Ejemplo n.º 7
0
 public void AddConverter(ITagConverter converter)
 {
     Converters.Add(converter);
 }
 public OpenXmlTagExtractor(ITagConverter tagConverter, IOpenXmlAssemblySearcher openXmlAssemblySearcher)
 {
     _tagConverter = tagConverter;
     _openXmlAssemblySearcher = openXmlAssemblySearcher;
 }
        protected override void SetUp()
        {
            base.SetUp();

            tagConverter = Container.Get<ITagConverter>();
        }
Ejemplo n.º 10
0
 internal TagInfo(ITagConverter tagConverter, StringBuilder text, int pos)
 {
     this.tagConverter = tagConverter;
     this.text         = text;
     Pos = pos;
 }
Ejemplo n.º 11
0
 public AdditionalParam(ITagConverter paramTagConverter)
 {
     this.paramTagConverter = paramTagConverter;
 }
 public ProblemConverter(ITextPreprocessor textPreprocessor, IFeatureVectorFactory featureVectorFactory, ITagConverter tagConverter)
 {
     this.textPreprocessor = textPreprocessor;
     this.featureVectorFactory = featureVectorFactory;
     this.tagConverter = tagConverter;
 }