コード例 #1
0
        public ProvidersAdapter(V1.AbstractProvider provider) : base(provider.ProviderId)
        {
            this.provider = provider;

            var so = provider.GetSourceOptions();

            this.HasUniqueName = so.HasUniqueName;
            this.HasUrlField   = so.HasURLField;
        }
コード例 #2
0
ファイル: SourceAdapter.cs プロジェクト: allanx2000/Watcher
        public static SourceAdapter CreateSourceAdapter(V1.AbstractSource src, V1.AbstractProvider provider)
        {
            string strDisabled = src.GetMetaDataValue(AbstractSource.DISABLED);
            bool   disabled    = strDisabled == null ? false : Convert.ToBoolean(strDisabled);

            GenericSource gs = new GenericSource(src.SourceName, src.ProviderID, disabled);

            //Update Meta
            Dictionary <string, MetaDataObject> newMeta = new Dictionary <string, MetaDataObject>();

            List <string> providerMeta = provider.GetMetaFields();

            {
                foreach (string name in providerMeta)
                {
                    var mdo = new MetaDataObject(name, name);
                    if (src.GetMetaData().ContainsKey(name))
                    {
                        mdo.SetValue(src.GetMetaDataValue(name));
                    }

                    newMeta.Add(mdo.ID, mdo);
                }
            }

            gs.SetMetaData(newMeta);

            if (src.ID.HasValue)
            {
                gs.SetID(src.ID.Value);
            }

            var sa = new SourceAdapter(gs);


            return(sa);
        }