Example #1
0
        /// <summary>
        /// This is the default constructor.
        /// </summary>
        /// <param name="ass">The assembly.</param>
        /// <param name="defaultPath">This is the default path to where the files are located in the assembly.</param>
        /// <param name="compressed">This property specifies whether the files are compressed using 7zip compression.</param>
        public ResourceSourceDataCollection(ResourceManager man)
        {
            mResMan = man;

            Names
            .Where(i => mResMan.GetObject(i.Value) != null)
            .ForEach(i => mStreams.Add(i.Key, ((Func <string, Stream>)GetStream).Curry()(i.Value)));

            var missing = Required.Except(mStreams.Keys);

            if (missing.Count() > 0)
            {
                throw new ArgumentOutOfRangeException("Missing mandatory data.");
            }
        }
Example #2
0
        public AzureStorageSourceDataCollection(CloudBlobContainer container, string blobRootPath)
        {
            mContainer    = container;
            mBlobRootPath = blobRootPath;

            Names
            .Where(i => mContainer.GetBlobReference(mBlobRootPath + "/" + i.Value + ".txt") != null)
            .ForEach(i => mStreams.Add(i.Key, ((Func <string, Stream>)GetStream).Curry()(i.Value)));

            var missing = Required.Except(mStreams.Keys);

            if (missing.Count() > 0)
            {
                throw new ArgumentOutOfRangeException("Missing mandatory data.");
            }
        }
        public DictionarySourceDataCollection(Dictionary <string, Stream> data)
        {
            mData = data;

            Names
            .Where(i => mData.Keys.Contains(i.Value) == true)
            .ForEach(i => mStreams.Add(i.Key, ((Func <string, Stream>)GetStream).Curry()(i.Value)));

            var missing = Required.Except(mStreams.Keys);

            if (missing.Count() > 0)
            {
                if (!(missing.Count() == 1 && missing.Contains(TransitFileType.Calendar) == true))
                {
                    throw new ArgumentOutOfRangeException("Missing mandatory data.");
                }
            }
        }
Example #4
0
        /// <summary>
        /// Comapares list of required properties of this model
        /// </summary>
        /// <param name="context">Comaprision Context</param>
        /// <param name="priorSchema">Schema of the old model</param>
        private void CompareRequired(ComparisonContext <ServiceDefinition> context, Schema priorSchema)
        {
            if (Required == null)
            {
                return;
            }

            if (Required != null && priorSchema.Required == null)
            {
                context.LogBreakingChange(ComparisonMessages.AddedRequiredProperty, String.Join(", ", Required));
                return;
            }

            List <string> addedRequiredProperties = Required.Except(priorSchema.Required).ToList();

            if (addedRequiredProperties.Count > 0)
            {
                context.LogBreakingChange(ComparisonMessages.AddedRequiredProperty, String.Join(", ", addedRequiredProperties));
            }
        }