示例#1
0
 public void Should_Only_Add_True_Types()
 {
     var list = new TypeList<IMyInterface>();
     list.Add<MyClass1>();
     list.Add(typeof(MyClass2));
     Assert.Throws<ArgumentException>(() => list.Add(typeof(MyClass3)));
 }
示例#2
0
        public void Should_Only_Add_True_Types()
        {
            var list = new TypeList <IMyInterface>();

            list.Add <MyClass1>();
            list.Add(typeof(MyClass2));
            Assert.Throws <ArgumentException>(() => list.Add(typeof(MyClass3)));
        }
示例#3
0
 public void Foo3()
 {
     ITypeList<TypeParent> lt = new TypeList<TypeParent>();
     lt.Add<TypeParent>();
     lt.Add(typeof(TypeChild));
     lt.Add(typeof(int));
     //lt.Add(new TypeParent { strP = "parent" });
     //lt.Add(new TypeChild { strP = "child" });
     lt.ToList().ForEach((t) => { Console.WriteLine(t.ToString()); });
 }
示例#4
0
        public void Add()
        {
            var td = new TypeList <IServiceCollection>();

            Should.Throw <ArgumentException>(() => td.Add(typeof(ServiceDescriptor)));
            Should.Throw <ArgumentNullException>(() => td.Add(null));
            Should.NotThrow(() => td.Add(typeof(ServiceCollection)));
            td.Count.ShouldBe(1);
            td[0].ShouldBe(typeof(ServiceCollection));
            Should.NotThrow(() => td.Add <ServiceCollection>());
            td.Count.ShouldBe(2);
            td[1].ShouldBe(typeof(ServiceCollection));
        }
 public EmoteTypeAttribute(params uint[] emoteTypes)
 {
     foreach (uint emoteType in emoteTypes)
     {
         TypeList.Add((EmoteType)emoteType);
     }
 }
        private void InitializeTest(Type typeInLibraryToTest)
        {
            BaseType = typeof(ViewModelBase);
              AllTypes = new TypeList();
              AllTypes.AddRange(typeInLibraryToTest.Assembly.GetTypes());

              AllTypesToCheck = new TypeList();
              DataTypesToCheck = new TypeList();
              TypeProperties = new Dictionary<Type, PropertyInfo[]>();
              foreach (Type currentType in AllTypes)
              {
            if (currentType.IsAbstract)
              continue;

            if (ReflectionUtil.IsClassOfType(currentType, BaseType))
            {
              AllTypesToCheck.Add(currentType);
              if (ReflectionUtil.IsClassOfType(currentType, BaseType))
            DataTypesToCheck.Add(currentType);

              PropertyInfo[] properties = currentType.GetProperties();
              List<PropertyInfo> finalProperties = new List<PropertyInfo>();
              foreach (PropertyInfo current in properties)
              {
            NotMappedAttribute notMappedAttribute = current.GetCustomAttribute<NotMappedAttribute>();
            if (notMappedAttribute != null)
              continue;

            finalProperties.Add(current);
              }

              TypeProperties.Add(currentType, finalProperties.ToArray());
            }
              }
        }
示例#7
0
文件: TypeDAL.cs 项目: abigabaw/wis
        /// <summary>
        /// To Get Land Type
        /// </summary>
        /// <returns></returns>
        public TypeList GetLandType()
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_MST_LND_GET_TYPE";

            cmd             = new OracleCommand(proc, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr          = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            TypeBO           objtypeBO   = null;
            TypeList         objtypelist = new TypeList();

            while (dr.Read())
            {
                objtypeBO            = new TypeBO();
                objtypeBO.LND_TYPEID = (Convert.ToInt32(dr.GetValue(dr.GetOrdinal("LND_TYPEID"))));
                objtypeBO.LandType   = dr.GetValue(dr.GetOrdinal("LANDTYPE")).ToString();
                objtypelist.Add(objtypeBO);
            }

            dr.Close();
            return(objtypelist);
        }
示例#8
0
        //Constructor
        //Init' property values

        public EntryObject()
        {
            EntryID = -1;
            NameList.Add("_null");
            TypeList.Add("_null");
            WhereList.Add("_null");
            ExtraList.Add("_null");
        }
示例#9
0
            public void BlackListType(string _newType)
            {
                if (TypeList.Contains(_newType))
                {
                    return;
                }

                TypeList.Add(_newType);
            }
示例#10
0
        protected void Obj(String indexName, String objName, String path, object[] parameter, Boolean obj)
        {
            TypeList.Add(indexName, Assembly.LoadFrom(path).GetType(objName));

            if (obj)
            {
                ObjectList.Add(indexName, Activator.CreateInstance(TypeList[indexName], parameter));
            }
        }
示例#11
0
        public async Task GetData2()
        {
            var result = await new HttpClient().GetAsync("https://gist.githubusercontent.com/CorgoShip/7c1134535ca446acc779fa7a2327e59e/raw/3e34b0a396221f51ca8dd1e9f9df15e55f6726e8/TypeList");
            var text   = await result.Content.ReadAsStringAsync();

            string[] types = text.Split(',');
            foreach (var item in types)
            {
                TypeList.Add(item);
            }
        }
示例#12
0
        public static string BuildMethodSignature(MethodBase methodBase)
        {
            using (var log = new EnterExitLogger(s_log, "methodBase = {0}", methodBase)) {
                var parameterTypes = new TypeList();
                foreach (var pi in methodBase.GetParameters())
                {
                    parameterTypes.Add(pi.ParameterType);
                }

                var types = parameterTypes.ToArray();
                return(BuildMethodSignature(methodBase.Name, types));
            }
        }
示例#13
0
        private void GenerateComboBoxes()
        {
            CategoryList.Add("Engine");
            CategoryList.Add("Tyres");
            CategoryList.Add("Paint");
            CategoryList.Add("Doors");

            TypeList.Add("Car");
            TypeList.Add("Truck");
            TypeList.Add("Bus");

            PriorityList.Add("1");
            PriorityList.Add("2");
            PriorityList.Add("3");
        }
示例#14
0
        public void Action()
        {
            var action   = new ProxyConventionalAction();
            var services = new ServiceCollection();
            var types    = new List <Type> {
                typeof(TestProxiedService)
            };
            var interceptor = new TypeList <IInterceptor>();
            Expression <Func <Type, bool> > typePredicate = t => true;

            interceptor.Add <TestInterceptor>();
            var context = new ProxyConventionalActionContext(services, types, typePredicate, interceptor);

            Should.NotThrow(() => action.Action(context));
            services.GetSingletonInstance <ServiceInterceptorList>().GetInterceptors(typeof(TestProxiedService)).ShouldHaveSingleItem().ShouldBe(typeof(TestInterceptor));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CSharpCloneOfExpression"/> class.
        /// </summary>
        /// <param name="context">The creation context.</param>
        /// <param name="source">The Easly expression from which the C# expression is created.</param>
        protected CSharpCloneOfExpression(ICSharpContext context, ICloneOfExpression source)
            : base(context, source)
        {
            SourceExpression = Create(context, (IExpression)source.Source);

            IResultType SourceResult = SourceExpression.Source.ResolvedResult.Item;

            Debug.Assert(SourceResult.Count > 0);

            foreach (IExpressionType ExpressionType in SourceResult)
            {
                ICompiledType ClonedType = ExpressionType.ValueType;
                ICSharpType   Type       = CSharpType.Create(context, ClonedType);
                TypeList.Add(Type);
            }
        }
示例#16
0
        public virtual void BuildControllerList()
        {
            var h = XafTypesInfo.Instance.PersistentTypes.Where(pt => pt.FindAttribute <MergeableAttribute>() != null);

            foreach (ITypeInfo item in h)
            {
                Type t                    = item.Type;
                Type generic              = typeof(Merger <>);
                Type genericType          = generic.MakeGenericType(new System.Type[] { t });
                Type genericBasicMergerVC = typeof(MergerViewController <>);
                Type genericMergerVC      = genericBasicMergerVC.MakeGenericType(new System.Type[] { t });
                TypeList.Add(genericMergerVC);
                Type genericBaseControllerType = typeof(MergerGenericViewController <,>);
                Type genericControllerType     = genericBaseControllerType.MakeGenericType(new Type[] { t, genericType });
                TypeList.Add(genericControllerType);
            }
        }
示例#17
0
 //This function loads the SQL Server types
 protected override void LoadTypes()
 {
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(bool), DbType.Boolean, SqlDbType.Bit));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(byte), DbType.Binary, SqlDbType.TinyInt));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(byte[]), DbType.Binary, SqlDbType.VarBinary));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(DateTime), DbType.DateTime2, SqlDbType.DateTime2));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(Decimal), DbType.Decimal, SqlDbType.Decimal));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(double), DbType.Double, SqlDbType.Float));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(Guid), DbType.Guid, SqlDbType.UniqueIdentifier));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(Int16), DbType.Int16, SqlDbType.SmallInt));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(Int32), DbType.Int32, SqlDbType.Int));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(Int64), DbType.Int64, SqlDbType.BigInt));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(long), DbType.Int64, SqlDbType.BigInt));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(object), DbType.Object, SqlDbType.Variant));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(string), DbType.String, SqlDbType.VarChar));
     TypeList.Add(new SqlServerDbTypeMapEntry(typeof(DataTable), DbType.Object, SqlDbType.Structured));
 }
示例#18
0
 /// <summary>
 /// This function is the loading function for the types
 /// </summary>
 protected virtual void LoadTypes()
 {
     TypeList.Add(new DBTypeMapEntry(typeof(bool), DbType.Boolean));
     TypeList.Add(new DBTypeMapEntry(typeof(byte), DbType.Binary));
     TypeList.Add(new DBTypeMapEntry(typeof(byte[]), DbType.Binary));
     TypeList.Add(new DBTypeMapEntry(typeof(DateTime), DbType.DateTime2));
     TypeList.Add(new DBTypeMapEntry(typeof(Decimal), DbType.Decimal));
     TypeList.Add(new DBTypeMapEntry(typeof(double), DbType.Double));
     TypeList.Add(new DBTypeMapEntry(typeof(Guid), DbType.Guid));
     TypeList.Add(new DBTypeMapEntry(typeof(Int16), DbType.Int16));
     TypeList.Add(new DBTypeMapEntry(typeof(Int32), DbType.Int32));
     TypeList.Add(new DBTypeMapEntry(typeof(Int64), DbType.Int64));
     TypeList.Add(new DBTypeMapEntry(typeof(long), DbType.Int64));
     TypeList.Add(new DBTypeMapEntry(typeof(object), DbType.Object));
     TypeList.Add(new DBTypeMapEntry(typeof(string), DbType.String));
     TypeList.Add(new DBTypeMapEntry(typeof(DataTable), DbType.Object));
 }
示例#19
0
 //This function loads the MySQL types
 protected override void LoadTypes()
 {
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(bool), DbType.Boolean, MySqlDbType.Bit));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(byte), DbType.Binary, MySqlDbType.Byte));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(byte[]), DbType.Binary, MySqlDbType.VarBinary));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(DateTime), DbType.DateTime2, MySqlDbType.DateTime));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(Decimal), DbType.Decimal, MySqlDbType.Decimal));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(double), DbType.Double, MySqlDbType.Float));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(Guid), DbType.Guid, MySqlDbType.Guid));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(Int16), DbType.Int16, MySqlDbType.Int16));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(Int32), DbType.Int32, MySqlDbType.Int32));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(Int64), DbType.Int64, MySqlDbType.Int64));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(long), DbType.Int64, MySqlDbType.Int64));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(object), DbType.Object, MySqlDbType.Blob));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(string), DbType.String, MySqlDbType.VarChar));
     TypeList.Add(new MySQLDBTypeMapEntry(typeof(DataTable), DbType.Object, MySqlDbType.Blob));
 }
示例#20
0
        public void Action()
        {
            var action   = new ProxyConventionalAction();
            var services = new ServiceCollection();
            var types    = new List <Type> {
                typeof(TestProxiedService)
            };
            var interceptor = new TypeList <IInterceptor>();
            Expression <Func <Type, bool> > typePredicate = t => true;

            interceptor.Add <TestInterceptor>();
            var context = new ProxyConventionalActionContext(services, types, typePredicate, interceptor);

            Should.NotThrow(() => action.Action(context));
            services.ShouldContainTransient(typeof(TestInterceptor));
            services.ShouldContainSingleton(typeof(IAspectConfiguration), typeof(AspectConfiguration))
            .ImplementationInstance
            .ShouldBeOfType <AspectConfiguration>()
            .Interceptors.ShouldHaveSingleItem();
        }
        public AccessConnector(string connectString = "")
        {
            //conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["DatabaseHelper.Properties.Settings.DocMngDatabaseConnectionString"].ToString());
            if (connectString != "")
            {
                base.connector = new OleDbConnection(connectString);
            }

            TypeList.Add("varchar", typeof(string));
            TypeList.Add("integer", typeof(int));
            TypeList.Add("short", typeof(short));
            TypeList.Add("double", typeof(double));
            TypeList.Add("real", typeof(float));
            TypeList.Add("byte", typeof(byte));
            TypeList.Add("NUMERIC", typeof(float));
            TypeList.Add("money", typeof(float));
            TypeList.Add("text", typeof(string));
            TypeList.Add("datetime", typeof(DateTime));
            TypeList.Add("bit", typeof(byte));
            TypeList.Add("OLEObject", typeof(string));
        }
示例#22
0
        /// <summary>
        /// Liefert die WebService-Proxytypen des Assemblies <paramref name="assembly"/>.
        /// </summary>
        /// <param name="assembly">Die Assembly mit den WebService-Proxyklassen.</param>
        /// <returns> WebService-Proxytypen.</returns>
        private static TypeList GetWebserviceTypes(Assembly assembly)
        {
            var exportedTypes   = assembly.GetExportedTypes();
            var webServiceTypes = new TypeList();

            foreach (var type in exportedTypes)
            {
                if (type.IsAbstract)
                {
                    continue;
                }

                var serviceBindingAttributes = (WebServiceBindingAttribute[])type.GetCustomAttributes(typeof(WebServiceBindingAttribute), false);
                if (serviceBindingAttributes != null && serviceBindingAttributes.Length == 1)
                {
                    webServiceTypes.Add(type);
                }
            }

            return(webServiceTypes);
        }
示例#23
0
 static JsonConverter()
 {
     SupportedTypeDefinitions = new TypeList();
     SupportedTypeDefinitions.Add(typeof(Object));
 }
        private IEnumerable <Type> ResolveTypesInternalLocked(
            Type baseType, Type attributeType,
            Func <IEnumerable <Type> > finder,
            bool cache)
        {
            // check if the TypeList already exists, if so return it, if not we'll create it
            var      listKey  = new TypeListKey(baseType, attributeType);
            TypeList typeList = null;

            if (cache)
            {
                _types.TryGetValue(listKey, out typeList); // else null
            }
            // if caching and found, return
            if (typeList != null)
            {
                // need to put some logging here to try to figure out why this is happening: http://issues.umbraco.org/issue/U4-3505
                _logger.Logger.Debug <PluginManager>("Resolving {0}: found a cached type list.", () => ResolvedName(baseType, attributeType));
                return(typeList.Types);
            }

            // else proceed,
            typeList = new TypeList(baseType, attributeType);

            var scan = RequiresRescanning || File.Exists(GetPluginListFilePath()) == false;

            if (scan)
            {
                // either we have to rescan, or we could not find the cache file:
                // report (only once) and scan and update the cache file - this variable is purely used to check if we need to log
                if (_reportedChange == false)
                {
                    _logger.Logger.Debug <PluginManager>("Assembly changes detected, need to rescan everything.");
                    _reportedChange = true;
                }
            }

            if (scan == false)
            {
                // if we don't have to scan, try the cache
                var cacheResult = TryGetCached(baseType, attributeType);

                // here we need to identify if the CachedPluginNotFoundInFile was the exception, if it was then we need to re-scan
                // in some cases the plugin will not have been scanned for on application startup, but the assemblies haven't changed
                // so in this instance there will never be a result.
                if (cacheResult.Exception is CachedPluginNotFoundInFileException || cacheResult.Success == false)
                {
                    _logger.Logger.Debug <PluginManager>("Resolving {0}: failed to load from cache file, must scan assemblies.", () => ResolvedName(baseType, attributeType));
                    scan = true;
                }
                else
                {
                    // successfully retrieved types from the file cache: load
                    foreach (var type in cacheResult.Result)
                    {
                        try
                        {
                            // we use the build manager to ensure we get all types loaded, this is slightly slower than
                            // Type.GetType but if the types in the assembly aren't loaded yet it would fail whereas
                            // BuildManager will load them - this is how eg MVC loads types, etc - no need to make it
                            // more complicated
                            typeList.Add(BuildManager.GetType(type, true));
                        }
                        catch (Exception ex)
                        {
                            // in case of any exception, we have to exit, and revert to scanning
                            _logger.Logger.Error <PluginManager>("Resolving " + ResolvedName(baseType, attributeType) + ": failed to load cache file type " + type + ", reverting to scanning assemblies.", ex);
                            scan = true;
                            break;
                        }
                    }

                    if (scan == false)
                    {
                        _logger.Logger.Debug <PluginManager>("Resolving {0}: loaded types from cache file.", () => ResolvedName(baseType, attributeType));
                    }
                }
            }

            if (scan)
            {
                // either we had to scan, or we could not resolve the types from the cache file - scan now
                _logger.Logger.Debug <PluginManager>("Resolving {0}: scanning assemblies.", () => ResolvedName(baseType, attributeType));

                foreach (var t in finder())
                {
                    typeList.Add(t);
                }
            }

            // if we are to cache the results, do so
            if (cache)
            {
                var added = _types.ContainsKey(listKey) == false;
                if (added)
                {
                    _types[listKey] = typeList;
                    //if we are scanning then update the cache file
                    if (scan)
                    {
                        UpdateCache();
                    }
                }

                _logger.Logger.Debug <PluginManager>("Resolved {0}, caching ({1}).", () => ResolvedName(baseType, attributeType), () => added.ToString().ToLowerInvariant());
            }
            else
            {
                _logger.Logger.Debug <PluginManager>("Resolved {0}.", () => ResolvedName(baseType, attributeType));
            }

            return(typeList.Types);
        }
示例#25
0
        public ComWithS71200DB()
        {
            TypeList.Add(Data0.GetType().ToString());
            TypeList.Add(Data1.GetType().ToString());
            TypeList.Add(Data2.GetType().ToString());
            TypeList.Add(Data3.GetType().ToString());
            TypeList.Add(Data4.GetType().ToString());
            TypeList.Add(Data5.GetType().ToString());
            TypeList.Add(Data6.GetType().ToString());
            TypeList.Add(Data7.GetType().ToString());
            TypeList.Add(Data8.GetType().ToString());
            TypeList.Add(Data9.GetType().ToString());
            TypeList.Add(Data10.GetType().ToString());
            TypeList.Add(Data11.GetType().ToString());
            TypeList.Add(Data12.GetType().ToString());
            TypeList.Add(Data13.GetType().ToString());
            TypeList.Add(Data14.GetType().ToString());
            TypeList.Add(Data15.GetType().ToString());
            TypeList.Add(Data16.GetType().ToString());
            TypeList.Add(Data17.GetType().ToString());
            TypeList.Add(Data18.GetType().ToString());
            TypeList.Add(Data19.GetType().ToString());
            TypeList.Add(Data20.GetType().ToString());
            TypeList.Add(Data21.GetType().ToString());
            TypeList.Add(Data22.GetType().ToString());
            TypeList.Add(Data23.GetType().ToString());
            TypeList.Add(Data24.GetType().ToString());
            TypeList.Add(Data25.GetType().ToString());
            TypeList.Add(Data26.GetType().ToString());
            TypeList.Add(Data27.GetType().ToString());
            TypeList.Add(Data28.GetType().ToString());
            TypeList.Add(Data29.GetType().ToString());
            TypeList.Add(Data30.GetType().ToString());
            TypeList.Add(Data31.GetType().ToString());
            TypeList.Add(Data32.GetType().ToString());
            TypeList.Add(Data33.GetType().ToString());
            TypeList.Add(Data34.GetType().ToString());
            TypeList.Add(Data35.GetType().ToString());
            TypeList.Add(Data36.GetType().ToString());
            TypeList.Add(Data37.GetType().ToString());
            TypeList.Add(Data38.GetType().ToString());
            TypeList.Add(Data39.GetType().ToString());
            TypeList.Add(Data40.GetType().ToString());
            TypeList.Add(Data41.GetType().ToString());
            TypeList.Add(Data42.GetType().ToString());
            TypeList.Add(Data43.GetType().ToString());
            TypeList.Add(Data44.GetType().ToString());
            TypeList.Add(Data45.GetType().ToString());
            TypeList.Add(Data46.GetType().ToString());
            TypeList.Add(Data47.GetType().ToString());
            TypeList.Add(Data48.GetType().ToString());
            TypeList.Add(Data49.GetType().ToString());
            TypeList.Add(Data50.GetType().ToString());
            TypeList.Add(Data51.GetType().ToString());
            TypeList.Add(Data52.GetType().ToString());
            TypeList.Add(Data53.GetType().ToString());
            TypeList.Add(Data54.GetType().ToString());
            TypeList.Add(Data55.GetType().ToString());
            TypeList.Add(Data56.GetType().ToString());
            TypeList.Add(Data57.GetType().ToString());
            TypeList.Add(Data58.GetType().ToString());
            TypeList.Add(Data59.GetType().ToString());
            TypeList.Add(Data60.GetType().ToString());
            TypeList.Add(Data61.GetType().ToString());
            TypeList.Add(Data62.GetType().ToString());
            TypeList.Add(Data63.GetType().ToString());
            TypeList.Add(Data64.GetType().ToString());
            TypeList.Add(Data65.GetType().ToString());
            TypeList.Add(Data66.GetType().ToString());
            TypeList.Add(Data67.GetType().ToString());
            TypeList.Add(Data68.GetType().ToString());
            TypeList.Add(Data69.GetType().ToString());
            TypeList.Add(Data70.GetType().ToString());
            TypeList.Add(Data71.GetType().ToString());
            TypeList.Add(Data72.GetType().ToString());
            TypeList.Add(Data73.GetType().ToString());
            TypeList.Add(Data74.GetType().ToString());
            TypeList.Add(Data75.GetType().ToString());
            TypeList.Add(Data76.GetType().ToString());
            TypeList.Add(Data77.GetType().ToString());
            TypeList.Add(Data78.GetType().ToString());
            TypeList.Add(Data79.GetType().ToString());
            TypeList.Add(Data80.GetType().ToString());
            TypeList.Add(Data81.GetType().ToString());
            TypeList.Add(Data82.GetType().ToString());
            TypeList.Add(Data83.GetType().ToString());
            TypeList.Add(Data84.GetType().ToString());
            TypeList.Add(Data85.GetType().ToString());
            TypeList.Add(Data86.GetType().ToString());
            TypeList.Add(Data87.GetType().ToString());
            TypeList.Add(Data88.GetType().ToString());
            TypeList.Add(Data89.GetType().ToString());
            TypeList.Add(Data90.GetType().ToString());
            TypeList.Add(Data91.GetType().ToString());
            TypeList.Add(Data92.GetType().ToString());
            TypeList.Add(Data93.GetType().ToString());
            TypeList.Add(Data94.GetType().ToString());
            TypeList.Add(Data95.GetType().ToString());
            TypeList.Add(Data96.GetType().ToString());
            TypeList.Add(Data97.GetType().ToString());
            TypeList.Add(Data98.GetType().ToString());
            TypeList.Add(Data99.GetType().ToString());
            TypeList.Add(Data100.GetType().ToString());

            DataList.Add(Data0);
            DataList.Add(Data1);
            DataList.Add(Data2);
            DataList.Add(Data3);
            DataList.Add(Data4);
            DataList.Add(Data5);
            DataList.Add(Data6);
            DataList.Add(Data7);
            DataList.Add(Data8);
            DataList.Add(Data9);
            DataList.Add(Data10);
            DataList.Add(Data11);
            DataList.Add(Data12);
            DataList.Add(Data13);
            DataList.Add(Data14);
            DataList.Add(Data15);
            DataList.Add(Data16);
            DataList.Add(Data17);
            DataList.Add(Data18);
            DataList.Add(Data19);
            DataList.Add(Data20);
            DataList.Add(Data21);
            DataList.Add(Data22);
            DataList.Add(Data23);
            DataList.Add(Data24);
            DataList.Add(Data25);
            DataList.Add(Data26);
            DataList.Add(Data27);
            DataList.Add(Data28);
            DataList.Add(Data29);
            DataList.Add(Data30);
            DataList.Add(Data31);
            DataList.Add(Data32);
            DataList.Add(Data33);
            DataList.Add(Data34);
            DataList.Add(Data35);
            DataList.Add(Data36);
            DataList.Add(Data37);
            DataList.Add(Data38);
            DataList.Add(Data39);
            DataList.Add(Data40);
            DataList.Add(Data41);
            DataList.Add(Data42);
            DataList.Add(Data43);
            DataList.Add(Data44);
            DataList.Add(Data45);
            DataList.Add(Data46);
            DataList.Add(Data47);
            DataList.Add(Data48);
            DataList.Add(Data49);
            DataList.Add(Data50);
            DataList.Add(Data51);
            DataList.Add(Data52);
            DataList.Add(Data53);
            DataList.Add(Data54);
            DataList.Add(Data55);
            DataList.Add(Data56);
            DataList.Add(Data57);
            DataList.Add(Data58);
            DataList.Add(Data59);
            DataList.Add(Data60);
            DataList.Add(Data61);
            DataList.Add(Data62);
            DataList.Add(Data63);
            DataList.Add(Data64);
            DataList.Add(Data65);
            DataList.Add(Data66);
            DataList.Add(Data67);
            DataList.Add(Data68);
            DataList.Add(Data69);
            DataList.Add(Data70);
            DataList.Add(Data71);
            DataList.Add(Data72);
            DataList.Add(Data73);
            DataList.Add(Data74);
            DataList.Add(Data75);
            DataList.Add(Data76);
            DataList.Add(Data77);
            DataList.Add(Data78);
            DataList.Add(Data79);
            DataList.Add(Data80);
            DataList.Add(Data81);
            DataList.Add(Data82);
            DataList.Add(Data83);
            DataList.Add(Data84);
            DataList.Add(Data85);
            DataList.Add(Data86);
            DataList.Add(Data87);
            DataList.Add(Data88);
            DataList.Add(Data89);
            DataList.Add(Data90);
            DataList.Add(Data91);
            DataList.Add(Data92);
            DataList.Add(Data93);
            DataList.Add(Data94);
            DataList.Add(Data95);
            DataList.Add(Data96);
            DataList.Add(Data97);
            DataList.Add(Data98);
            DataList.Add(Data99);
            DataList.Add(Data100);
        }
示例#26
0
 public void Add <T>() where T : ICommand, new()
 {
     list.Add <T>();
 }
示例#27
0
 public static void Add <T>() where T : ISystem, new()
 {
     list.Add <T>();
 }
示例#28
0
        private IEnumerable <Type> GetTypesInternalLocked(
            Type baseType, Type attributeType,
            Func <IEnumerable <Type> > finder,
            string action,
            bool cache)
        {
            // check if the TypeList already exists, if so return it, if not we'll create it
            var      tobject  = typeof(object); // CompositeTypeTypeKey does not support null values
            var      listKey  = new CompositeTypeTypeKey(baseType ?? tobject, attributeType ?? tobject);
            TypeList typeList = null;

            if (cache)
            {
                _types.TryGetValue(listKey, out typeList); // else null
            }
            // if caching and found, return
            if (typeList != null)
            {
                // need to put some logging here to try to figure out why this is happening: http://issues.umbraco.org/issue/U4-3505
                _logger.Debug <TypeLoader>("Getting {TypeName}: found a cached type list.", GetName(baseType, attributeType));
                return(typeList.Types);
            }

            // else proceed,
            typeList = new TypeList(baseType, attributeType);

            var typesListFilePath = GetTypesListFilePath();
            var scan = RequiresRescanning || File.Exists(typesListFilePath) == false;

            if (scan)
            {
                // either we have to rescan, or we could not find the cache file:
                // report (only once) and scan and update the cache file
                if (_reportedChange == false)
                {
                    _logger.Debug <TypeLoader>("Assemblies changes detected, need to rescan everything.");
                    _reportedChange = true;
                }
            }

            if (scan == false)
            {
                // if we don't have to scan, try the cache
                var cacheResult = TryGetCached(baseType, attributeType);

                // here we need to identify if the CachedTypeNotFoundInFile was the exception, if it was then we need to re-scan
                // in some cases the type will not have been scanned for on application startup, but the assemblies haven't changed
                // so in this instance there will never be a result.
                if (cacheResult.Exception is CachedTypeNotFoundInFileException || cacheResult.Success == false)
                {
                    _logger.Debug <TypeLoader>("Getting {TypeName}: failed to load from cache file, must scan assemblies.", GetName(baseType, attributeType));
                    scan = true;
                }
                else
                {
                    // successfully retrieved types from the file cache: load
                    foreach (var type in cacheResult.Result)
                    {
                        var resolvedType = TypeFinder.GetTypeByName(type);
                        if (resolvedType != null)
                        {
                            typeList.Add(resolvedType);
                        }
                        else
                        {
                            // in case of any exception, we have to exit, and revert to scanning
                            _logger.Warn <TypeLoader>("Getting {TypeName}: failed to load cache file type {CacheType}, reverting to scanning assemblies.", GetName(baseType, attributeType), type);
                            scan = true;
                            break;
                        }
                    }

                    if (scan == false)
                    {
                        _logger.Debug <TypeLoader>("Getting {TypeName}: loaded types from cache file.", GetName(baseType, attributeType));
                    }
                }
            }

            if (scan)
            {
                // either we had to scan, or we could not get the types from the cache file - scan now
                _logger.Debug <TypeLoader>("Getting {TypeName}: " + action + ".", GetName(baseType, attributeType));

                foreach (var t in finder())
                {
                    typeList.Add(t);
                }
            }

            // if we are to cache the results, do so
            if (cache)
            {
                var added = _types.ContainsKey(listKey) == false;
                if (added)
                {
                    _types[listKey] = typeList;
                    //if we are scanning then update the cache file
                    if (scan)
                    {
                        UpdateCache();
                    }
                }

                _logger.Debug <TypeLoader>("Got {TypeName}, caching ({CacheType}).", GetName(baseType, attributeType), added.ToString().ToLowerInvariant());
            }
            else
            {
                _logger.Debug <TypeLoader>("Got {TypeName}.", GetName(baseType, attributeType));
            }

            return(typeList.Types);
        }
示例#29
0
        public bool Match(SourceStream source, out NamespaceType result)
        {
            result = null;

            if (!source.IsValid())
            {
                return(false);
            }

            var slice = source.GetSlice();

            SkipCommentsAndWhitespace(slice);

            if (!slice.MatchString(KeywordNamespace))
            {
                return(false);
            }

            SkipCommentsAndWhitespace(slice);

            string namespace_name = string.Empty;

name_match:

            if (!slice.ReadWord(out string name))
            {
                throw new ParseError($"expected namespace 'name'.", slice);
            }

            if (!name.IsNameLegal())
            {
                slice.MoveBy(-name.Length);
                throw new ParseError($"'{name}' is not a legal namespace.", slice);
            }

            namespace_name += name;

            SkipCommentsAndWhitespace(slice);

            if (slice.MatchString(TokenNameExtension))
            {
                namespace_name += TokenNameExtension;
                goto name_match;
            }

            if (!slice.MatchString(TokenNamespaceFirst))
            {
                throw new ParseError($"expected '{TokenNamespaceFirst}'.", slice);
            }

            var types   = new TypeList();
            var parsers = new GrammarParserDelegate[]
            {
                MatchStruct,
                match_enum,
                MatchNamespace,
            };

            while (slice.IsValid())
            {
                SkipCommentsAndWhitespace(slice);

                if (slice.MatchString(TokenNamespaceFinal))
                {
                    break;
                }

                if (!MatchAny(slice, parsers, out BaseType type))
                {
                    throw new ParseError("cannot parse", slice);
                }

                types.Add(type);
            }

            var span = source.Join(slice);

            result = new NamespaceType(namespace_name, types, span);

            return(true);
        }
示例#30
0
        public string SetConditions()
        {
            string ErrorMsg = null;

            if (JobEnabled.Checked)
            {
                JobList.Clear();
                for (int i = 0; i <= (JobListBox.Items.Count - 1); i++)
                {
                    if (JobListBox.GetItemChecked(i))
                    {
                        JobList.Add(JobListBox.Items[i].ToString());
                    }
                }
                if (JobList.Count != 0)
                {
                    if (OneJobOnly.Checked)
                    {
                        job = Convert.ToString((string)JobList[random.Next(0, JobList.Count)]);
                    }
                    if (JobList.Count < 4 && JobExistFalse.Checked)
                    {
                        Error     = true;
                        ErrorMsg += ("職業を被らせない設定は選択している職業数が4つ以上である必要があります。\n");
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("職業が選択されていません。\n");
                }
            }
            if (TypeEnabled.Checked)
            {
                TypeList.Clear();
                for (int i = 0; i <= (TypeListBox.Items.Count - 1); i++)
                {
                    if (TypeListBox.GetItemChecked(i))
                    {
                        TypeList.Add(TypeListBox.Items[i].ToString());
                    }
                }
                if (TypeList.Count != 0)
                {
                    if (OneTypeOnly.Checked)
                    {
                        type = Convert.ToString((string)TypeList[random.Next(0, TypeList.Count)]);
                    }
                    if (TypeList.Count < 4 && TypeExistFalse.Checked)
                    {
                        Error     = true;
                        ErrorMsg += ("タイプを被らせない設定は選択しているタイプ数が4つ以上である必要があります。\n");
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("タイプが選択されていません。\n");
                }
            }
            if (RarityEnabled.Checked)
            {
                RareList.Clear();
                if (UseRarity.Checked)
                {
                    for (int i = 0; i <= (RarityListBox.Items.Count - 1); i++)
                    {
                        if (RarityListBox.GetItemChecked(i))
                        {
                            RareList.Add(RarityListBox.Items[i].ToString());
                        }
                    }
                    TRResult.Text = "";
                    if (RareList.Count == 0)
                    {
                        Error     = true;
                        ErrorMsg += ("レアリティが選択されていません。\n");
                    }
                }
                if (UseTotalRarity.Checked)
                {
                    TRResult.Text = "レアリティ合計値:" + random.Next((int)TRMinimum.Value, (int)TRMax.Value);
                }
            }
            if (RareTypeEnabled.Checked)
            {
                RareTypeList.Clear();
                for (int i = 0; i <= (RareTypeListBox.Items.Count - 1); i++)
                {
                    if (RareTypeListBox.GetItemChecked(i))
                    {
                        RareTypeList.Add(RareTypeListBox.Items[i].ToString());
                    }
                }
                if (RareTypeList.Count != 0)
                {
                    if (OneRareTypeOnly.Checked)
                    {
                        raretype = Convert.ToString((string)RareTypeList[random.Next(0, RareTypeList.Count)]);
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("種類が選択されていません。\n");
                }
            }
            if (AttributeEnabled.Checked)
            {
                AttributeList.Clear();
                for (int i = 0; i <= (AttributeListBox.Items.Count - 1); i++)
                {
                    if (AttributeListBox.GetItemChecked(i))
                    {
                        AttributeList.Add(AttributeListBox.Items[i].ToString());
                    }
                }
                if (AttributeList.Count != 0)
                {
                    attribute = Convert.ToString((string)AttributeList[random.Next(0, AttributeList.Count)]);
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("属性が選択されていません。\n");
                }
            }
            if (!JobEnabled.Checked && !TypeEnabled.Checked && !RarityEnabled.Checked && !RareTypeEnabled.Checked && !AttributeEnabled.Checked)
            {
                Error     = true;
                ErrorMsg += ("有効になっている条件がありません。");
            }
            return(ErrorMsg);
        }
示例#31
0
 public EmoteTypeAttribute(EmoteType emoteType)
 {
     TypeList.Add(emoteType);
 }
示例#32
0
 public void Add <T>() where T : View, new()
 {
     list.Add <T>();
 }