Ejemplo n.º 1
0
        /// <inheriteddoc />
        protected override void OnGetCategoryNames(ICollection <IEnumerable <char> > names)
        {
            IEnumerable <string> catNames = this._INNER_CONF
                                            .GetCategoryNames() ?? CollectionHelper.Empty <string>();

            CollectionHelper.AddRange(names,
                                      CollectionHelper.Cast <IEnumerable <char> >(catNames));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts the items of a sequence of objects to a sequence of console arguments.
        /// </summary>
        /// <param name="args">The input arguments.</param>
        /// <returns>The parsed argument list.</returns>
        protected virtual IEnumerable ToConsoleArguments(IEnumerable args)
        {
            if (args == null)
            {
                return(new object[] { null });
            }

            List <object> result = new List <object>();

            CollectionHelper.AddRange(result,
                                      CollectionHelper.Select(CollectionHelper.Cast <object>(args),
                                                              delegate(object a)
            {
                return((object)StringHelper.AsString(this.ToConsoleString(a)));
            }));

            return(result.ToArray());
        }
Ejemplo n.º 3
0
        /// <inheriteddoc />
        public Stream TryGetResourceStream(IEnumerable <char> resourceName)
        {
            string @namespace = null;

            object[] attribList = this.Assembly
                                  .GetCustomAttributes(typeof(global::MarcelJoachimKloubert.CLRToolbox.Resources.ResourceRootNamespaceAttribute),
                                                       false);

            if (attribList.Length > 0)
            {
                IEnumerable <ResourceRootNamespaceAttribute> castedAttribs = CollectionHelper.Cast <ResourceRootNamespaceAttribute>(attribList);

                ResourceRootNamespaceAttribute attrib = CollectionHelper.Single(castedAttribs);
                @namespace = attrib.Namespace;
            }
            else
            {
                @namespace = this.Object.GetType().Namespace;
                if (StringHelper.IsNullOrWhiteSpace(@namespace) == false)
                {
                    @namespace += ".";
                }

                @namespace += "Resources";
            }

            string fullResName = StringHelper.AsString(resourceName);

            if (StringHelper.IsNullOrWhiteSpace(@namespace) == false)
            {
                fullResName = @namespace.Trim() + "." + fullResName;
            }

            fullResName = (fullResName ?? string.Empty).ToLower().Trim();
            string matchingRes = CollectionHelper.SingleOrDefault(this.Assembly
                                                                  .GetManifestResourceNames(),
                                                                  delegate(string name)
            {
                return(fullResName == (name ?? string.Empty).ToLower().Trim());
            });

            return(matchingRes != null?this.Assembly
                   .GetManifestResourceStream(matchingRes) : null);
        }
Ejemplo n.º 4
0
        /// <inheriteddoc />
        public IEnumerable <S> GetAllInstances <S>(object key)
        {
            IEnumerable <object> instances = this.GetAllInstances(typeof(S), key);

            return(CollectionHelper.Cast <S>(instances));
        }
Ejemplo n.º 5
0
 /// <inheriteddoc />
 public GeneralList(IEnumerable collection)
     : base(CollectionHelper.Cast <object>(collection))
 {
 }