コード例 #1
0
ファイル: JobsProvider.cs プロジェクト: allanx2000/Watcher
        protected override List <IDataItem> GetNewItems(ISource source)
        {
            JobsSource js = JobsSource.CreateFrom(source);

            switch (js.Source)
            {
            case SourceNames.Dice:
                return(DiceProvider.GetNewItems(source));

            //case SourceNames.Monster:
            //    return MonsterProvider.GetNewItems(source);
            default:
                throw new Exception("Unrecognized source: " + js.Source);
            }
        }
コード例 #2
0
ファイル: SourceFactory.cs プロジェクト: allanx2000/Watcher
        /// <summary>
        /// Passes the call to the actual Provider that creates it
        /// </summary>
        /// <param name="name"></param>
        /// <param name="metaData"></param>
        /// <returns></returns>
        public static ISource CreateSource(string name, List <IMetaDataObject> metaData)
        {
            var type = metaData.FirstOrDefault(x => x.ID == JobsProvider.META_SOURCE);

            if (type == null)
            {
                throw new Exception("Source is was not specified");
            }

            string typeString = type.Value.ToString();

            switch (typeString)
            {
            case JobsProvider.SourceNames.Dice:
                return(DiceProvider.DoCreateNewSource(name, null, metaData));

            /*
             * case JobsProvider.SourceNames.Monster:
             *  return MonsterProvider.DoCreateNewSource(name, null, metaData);
             */
            default:
                throw new NotSupportedException(typeString);
            }
        }