System.Type.IsSubclassOf(System.Type)

Here are the examples of the csharp api System.Type.IsSubclassOf(System.Type) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1432 Examples 7

19 Source : UnityEngineObjectObjectType.cs
with MIT License
from 404Lcc

public bool IsType(Type type)
        {
            return type == typeof(Object) || type.IsSubclreplacedOf(typeof(Object));
        }

19 Source : AObjectBase.cs
with MIT License
from 404Lcc

public void AutoReference(Transform transform)
        {
            Dictionary<string, FieldInfo> fieldInfoDict = new Dictionary<string, FieldInfo>();
            FieldInfo[] fieldInfos = GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            Type objectType = typeof(Object);
            foreach (FieldInfo item in fieldInfos)
            {
                if (item.FieldType.IsSubclreplacedOf(objectType))
                {
                    fieldInfoDict[item.Name.ToLower()] = item;
                }
            }
            if (fieldInfoDict.Count > 0)
            {
                AutoReference(transform, fieldInfoDict);
            }
        }

19 Source : TypeSerializer.cs
with MIT License
from 404Lcc

public object Read(object value, ProtoReader source)
        {
            if (isRootType && value != null) { Callback(value, TypeModel.CallbackType.BeforeDeserialize, source.Context); } 
            int fieldNumber, lastFieldNumber = 0, lastFieldIndex = 0;
            bool fieldHandled;

            //Helpers.DebugWriteLine(">> Reading fields for " + forType.FullName);
            while ((fieldNumber = source.ReadFieldHeader()) > 0)
            {
                fieldHandled = false;
                if (fieldNumber < lastFieldNumber)
                {
                    lastFieldNumber = lastFieldIndex = 0;
                }
                for (int i = lastFieldIndex; i < fieldNumbers.Length; i++)
                {
                    if (fieldNumbers[i] == fieldNumber)
                    {
                        IProtoSerializer ser = serializers[i];
                        //Helpers.DebugWriteLine(": " + ser.ToString());
                        Type serType = ser.ExpectedType;
                        if (value == null)
                        {
                            if (serType == forType) value = CreateInstance(source, true);
                        }
                        else
                        {
                            if (serType != forType && ((IProtoTypeSerializer)ser).CanCreateInstance()
                                && serType
#if WINRT || COREFX || PROFILE259
								.GetTypeInfo()
#endif
                                .IsSubclreplacedOf(value.GetType()))
                            {
                                value = ProtoReader.Merge(source, value, ((IProtoTypeSerializer)ser).CreateInstance(source));
                            }
                        }

                        if (ser.ReturnsValue) {
                            value = ser.Read(value, source);
                        } else { // pop
                            ser.Read(value, source);
                        }
                        
                        lastFieldIndex = i;
                        lastFieldNumber = fieldNumber;
                        fieldHandled = true;
                        break;
                    }
                }
                if (!fieldHandled)
                {
                    //Helpers.DebugWriteLine(": [" + fieldNumber + "] (unknown)");
                    if (value == null) value = CreateInstance(source, true);
                    if (isExtensible) {
                        source.AppendExtensionData((IExtensible)value); 
                    } else {
                        source.SkipField();
                    }
                }
            }
            //Helpers.DebugWriteLine("<< Reading fields for " + forType.FullName);
            if(value == null) value = CreateInstance(source, true);
            if (isRootType) { Callback(value, TypeModel.CallbackType.AfterDeserialize, source.Context); } 
            return value;
        }

19 Source : Helpers.cs
with MIT License
from 404Lcc

internal static bool IsSubclreplacedOf(Type type, Type baseClreplaced)
        {
#if WINRT || COREFX || PROFILE259
			return type.GetTypeInfo().IsSubclreplacedOf(baseClreplaced);
#else
            return type.IsSubclreplacedOf(baseClreplaced);
#endif
        }

19 Source : RegisterCrossBindingAdaptorHelper.cs
with MIT License
from 404Lcc

public static void RegisterCrossBindingAdaptor(AppDomain appdomain)
        {
            foreach (Type item in typeof(Init).replacedembly.GetTypes().ToList().FindAll(item => item.IsSubclreplacedOf(typeof(CrossBindingAdaptor))))
            {
                object obj = Activator.CreateInstance(item);
                if (!(obj is CrossBindingAdaptor))
                {
                    continue;
                }
                appdomain.RegisterCrossBindingAdaptor((CrossBindingAdaptor)obj);
            }
        }

19 Source : ServiceCollectionExtension.cs
with GNU Lesser General Public License v3.0
from 8720826

public static void AutoRegister(this IServiceCollection services)
        {
            #region 自动注入

            var allreplacedemblies = replacedembly.GetEntryreplacedembly().GetReferencedreplacedemblies().Select(replacedembly.Load);
            foreach (var serviceAsm in allreplacedemblies)
            {
                var serviceList = serviceAsm.GetTypes().Where(t => t.IsClreplaced && !t.IsAbstract && !t.IsInterface);

                foreach (Type serviceType in serviceList.Where(t => typeof(IScoped).IsreplacedignableFrom(t)))
                {
                    var interfaceTypes = serviceType.GetInterfaces();

                    foreach (var interfaceType in interfaceTypes)
                    {
                        services.AddScoped(interfaceType, serviceType);
                    }
                }

                foreach (Type serviceType in serviceList.Where(t => typeof(ISingleton).IsreplacedignableFrom(t)))
                {
                    var interfaceTypes = serviceType.GetInterfaces();

                    foreach (var interfaceType in interfaceTypes)
                    {
                        services.AddSingleton(interfaceType, serviceType);
                    }
                }

                foreach (Type serviceType in serviceList.Where(t => typeof(ITransient).IsreplacedignableFrom(t)))
                {
                    var interfaceTypes = serviceType.GetInterfaces();

                    foreach (var interfaceType in interfaceTypes)
                    {
                        services.AddTransient(interfaceType, serviceType);
                    }
                }

                foreach (Type serviceType in serviceList.Where(t => t.IsSubclreplacedOf(typeof(BackgroundService))))
                {
                    services.AddTransient(typeof(IHostedService), serviceType);
                }
            }
            #endregion

        }

19 Source : ResourceRepository.cs
with MIT License
from 99x

internal static void Initialize(replacedembly callingreplacedembly)
        {
            Repo = new ResourceRepository();

            var ignorereplacedemblies = new string[] {"RadiumRest", "RadiumRest.Core", "RadiumRest.Selfhost", "mscorlib"};
            var referencedreplacedemblies = callingreplacedembly.GetReferencedreplacedemblies();
            var currentAsm = replacedembly.GetExecutingreplacedembly().GetName();

            var scanreplacedemblies = new List<replacedemblyName>() { callingreplacedembly.GetName()};

            foreach (var asm in referencedreplacedemblies)
            {
                if (asm == currentAsm)
                    continue;

                if (!ignorereplacedemblies.Contains(asm.Name))
                    scanreplacedemblies.Add(asm);
            }

            foreach (var refAsm in scanreplacedemblies)
            {
                try
                {
                    var asm = replacedembly.Load(refAsm.FullName);


                    foreach (var typ in asm.GetTypes())
                    {
                        if (typ.IsSubclreplacedOf(typeof(RestResourceHandler)))
                        {
                            var clreplacedAttribObj = typ.GetCustomAttributes(typeof(RestResource), false).FirstOrDefault();
                            string baseUrl;
                            if (clreplacedAttribObj != null)
                            {
                                var clreplacedAttrib = (RestResource)clreplacedAttribObj;
                                baseUrl = clreplacedAttrib.Path;
                                baseUrl = baseUrl.StartsWith("/") ? baseUrl : "/" + baseUrl;
                            }
                            else baseUrl = "";

                            var methods = typ.GetMethods();


                            foreach (var method in methods)
                            {
                                var methodAttribObject = method.GetCustomAttributes(typeof(RestPath), false).FirstOrDefault();

                                if (methodAttribObject != null)
                                {
                                    var methodAttrib = (RestPath)methodAttribObject;
                                    string finalUrl = baseUrl + (methodAttrib.Path ?? "");
                                    
                                    var finalMethod = methodAttrib.Method;

                                    PathExecutionInfo exeInfo = new PathExecutionInfo
                                    {
                                        Type = typ,
                                        Method = method
                                    };
                                    AddExecutionInfo(finalMethod, finalUrl, exeInfo);
                                }
                            }
                        }

                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }

19 Source : ObjectManager.cs
with GNU General Public License v3.0
from a2659802

public static void RegisterBehaviour<T>()
        {
            var behaviours = typeof(T).GetNestedTypes(BindingFlags.Public).Where(x => x.IsSubclreplacedOf(typeof(CustomDecoration)));
            var items = typeof(ItemDef).GetNestedTypes(BindingFlags.Public | BindingFlags.Instance).Where(x => x.IsSubclreplacedOf(typeof(Item)));

            foreach (Type b in behaviours)
            {
                DecorationAttribute attr = b.GetCustomAttributes(typeof(DecorationAttribute), false).OfType<DecorationAttribute>().FirstOrDefault();
                if (attr == null)
                    continue;

                string poolname = attr.Name;

                Type DataStruct = null;
                foreach (Type i in items) // Search Item Defination in ItemDef
                {
                    DecorationAttribute[] i_attr = i.GetCustomAttributes(typeof(DecorationAttribute), false).OfType<DecorationAttribute>().ToArray();
                    if (i_attr == null || i_attr.Length == 0)
                        continue;
                        
                    if(i_attr.Contains(attr))
                    {
                        DataStruct = i;
                        break;
                    }
                }
                if(DataStruct == null) // Search Item Defination in Behaviour
                {
                    DataStruct = b.GetNestedTypes(BindingFlags.Public).Where(x => x.IsSubclreplacedOf(typeof(Item))).FirstOrDefault();
                }
                if (DataStruct == null) // Search Item Defination in T
                {
                    DataStruct = typeof(T).GetNestedTypes(BindingFlags.Public).Where(x => x.IsSubclreplacedOf(typeof(Item))).FirstOrDefault();
                }
                if (DataStruct == null) // Fill with defatult Item
                {
                    Logger.LogWarn($"Could Not Found an Item that match {b.FullName},Attr:{attr.Name},will use default item instance");
                    DataStruct = typeof(ItemDef.Defaulreplacedem);
                }

                Register(poolname, b, DataStruct);
            }
        }

19 Source : ObjectManager.cs
with GNU General Public License v3.0
from a2659802

public static void Register(string poolname,Type td,Type ti)
        {
            if (!(td.IsSubclreplacedOf(typeof(CustomDecoration))) || !(ti.IsSubclreplacedOf(typeof(Item))))
                throw new ArgumentException($"{td}-{ti} match exception");


            if (!ObjectLoader.InstantiableObjects.ContainsKey(poolname)) // create an empty gameobject for registion
            {
                GameObject empty = new GameObject();
                Object.DontDestroyOnLoad(empty);
                empty.SetActive(false);
                ObjectLoader.InstantiableObjects.Add(poolname, empty);
                Logger.LogDebug($"Cant find an object in InstantiableObjects, create an empty GO instead");
            }

            GameObject prefab = ObjectLoader.InstantiableObjects[poolname];
            var item = Activator.CreateInstance(ti) as Item;
            item.pname = poolname;
            CustomDecoration d = prefab.AddComponent(td) as CustomDecoration;
            d.item = item;

            Logger.Log($"Register [{poolname}] - Behaviour : {td} - DataStruct : {ti}");
            ReflectionCache.GereplacedemProps(ti, Operation.None);
            ReflectionCache.GetMethods(td, Operation.None);
            //ItemDescriptor.Register(td,poolname);
        }

19 Source : Inspector.cs
with GNU General Public License v3.0
from a2659802

public static void Show()
        {
            OpLock.Apply();
            try
            {
                Item item = ItemManager.Instance.currentSelect.GetComponent<CustomDecoration>().item;
                

                if (!cache_prop.ContainsKey(item.GetType()))
                {
                    _reflectProps(item.GetType());
                }
                if (cache_prop.TryGetValue(item.GetType(), out var itemProps))
                {
                    var insp = new InspectPanel();
                    currentEdit = insp;
                    int idx = 0;
                    foreach (var kv in itemProps)
                    {
                        string name = kv.Key;
                        Type propType = kv.Value.PropertyType;
                        object value = kv.Value.GetValue(item, null);
                        value = Convert.ToSingle(value);
                        ConstraintAttribute con = kv.Value.GetCustomAttributes(typeof(ConstraintAttribute), true).OfType<ConstraintAttribute>().FirstOrDefault();

                        LogProp(propType, name, value);

                        if(idx == 0)
                        {
                            insp.UpdateName(idx,name);
                            if(con is IntConstraint)
                            {
                                //Logger.LogDebug($"Check1 {con.Min}-{con.Max}");
                                insp.UpdateSliderConstrain(name,idx, (float)Convert.ChangeType(con.Min, typeof(float)), Convert.ToInt32(con.Max), true);
                            }
                            else if(con is FloatConstraint)
                            {
                                //Logger.LogDebug($"Check2 {con.Min}-{con.Max}");
                                insp.UpdateSliderConstrain(name,idx, (float)(con.Min), (float)(con.Max), false);
                            }
                            else
                            {
                                throw new ArgumentException();
                            }
                            //Logger.LogDebug($"Check3 {value}-{value.GetType()}");
                            insp.UpdateValue(idx, (float)value);
                        }
                        else
                        {
                            insp.AppendPropPanel(name);
                            if (con is IntConstraint)
                            {
                                insp.UpdateSliderConstrain(name,idx, (int)con.Min, (int)con.Max, true);
                            }
                            else if (con is FloatConstraint)
                            {
                                insp.UpdateSliderConstrain(name,idx, (float)con.Min, (float)con.Max, false);
                            }
                            else
                            {
                                throw new ArgumentException();
                            }
                            insp.UpdateValue(idx, (float)value);
                            insp.UpdateTextDelegate(idx);//insp.AddListener(idx, insp.UpdateTextDelegate(idx));

                        }
                        //insp.AddListener(idx, (v) => { kv.Value.SetValue(item, Convert.ChangeType(v, kv.Value.PropertyType), null); });
                        insp.AddListener(idx, (v) => {
                            if (ItemManager.Instance.currentSelect == null)
                                return;
                            object val;
                            try
                            {
                                if (kv.Value.PropertyType.IsSubclreplacedOf(typeof(Enum)))
                                {
                                    val = Enum.Parse(kv.Value.PropertyType, v.ToString("0"));
                                }
                                else
                                    val = Convert.ChangeType(v, kv.Value.PropertyType);
                                ItemManager.Instance.currentSelect.GetComponent<CustomDecoration>().Setup(handler[kv.Value], val);
                            }
                            catch
                            {
                                Logger.LogError("Error occour at Inspect OnValue Chnaged");
                                Hide();
                            }
                        });
                        idx++;
                    }
                }
                else
                {
                    Logger.LogError($"KeyNotFount at cache_prop,{item.GetType()}");
                }
                
            }
            catch(NullReferenceException e)
            {
                Logger.LogError($"NulRef Error at Inspector.Show:{e}");
                OpLock.Undo();
            }
       
        }

19 Source : ObjectManager.cs
with GNU General Public License v3.0
from a2659802

public static void RegisterSharedBehaviour<T>() where T : CustomDecoration
        {
            var shareAttr = typeof(T).GetCustomAttributes(typeof(DecorationAttribute), false).OfType<DecorationAttribute>();
            foreach(var attr in shareAttr)
            {
                if (attr == null)
                    continue;
                string poolname = attr.Name;

                var ti = typeof(T).GetNestedTypes(BindingFlags.Public).Where(x => x.IsSubclreplacedOf(typeof(Item))).FirstOrDefault();

                Register<T>(poolname, ti);
            }
        }

19 Source : UMARecipeBase.cs
with Apache License 2.0
from A7ocin

public static Type[] GetRecipeFormats()
		{
			if (recipeFormats == null)
			{
				var formats = new List<Type>(20);
				var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
				foreach (var replacedembly in replacedemblies)
				{
					var types = replacedembly.GetTypes();
					for (int i = 0; i < types.Length; i++)
					{
						var type = types[i];
						if (type.IsSubclreplacedOf(typeof(UMARecipeBase)) && !type.IsAbstract)
						{
							formats.Add(type);
						}
					}
				}
				recipeFormats = formats.ToArray();
			}
			return recipeFormats;
		}

19 Source : UserModule.cs
with Apache License 2.0
from AantCoder

[Command("help")]
        [Description("List of all commands")]
        //RU: Выводит список команд
        public async Task Helpsync()
        {
            var sb = new StringBuilder();
            foreach (var type in replacedembly.GetExecutingreplacedembly().GetTypes())
            {
                if (!(type.IsClreplaced && type.IsSubclreplacedOf(typeof(ModuleBase<SocketCommandContext>))))
                {
                    continue;
                }

                foreach (var method in type.GetMethods().Where(x => x.IsPublic && x.GetCustomAttribute<CommandAttribute>() != null && x.GetCustomAttribute<CommandAttribute>() != null))
                {
                    DescriptionAttribute desc = method.GetCustomAttribute<DescriptionAttribute>();
                    CommandAttribute cmd = method.GetCustomAttribute<CommandAttribute>();

                    if (!string.IsNullOrEmpty(desc.Description))
                    {
                        // !OC help: 
                        sb.Append(Program.PX + ' ');
                        sb.Append(cmd.Text);
                        sb.Append(": ");
                        sb.Append(desc.Description);
                        sb.AppendLine();
                    }
                }
            }

            await ReplyAsync(sb.ToString());
        }

19 Source : TypeExtensions.cs
with Apache License 2.0
from abist-co-ltd

public static List<Type> GetAllSubClreplacedesOf(this Type rootType, replacedembly[] searchreplacedemblies = null)
        {
            if (!rootType.IsClreplaced) return null;

            if (searchreplacedemblies == null) { searchreplacedemblies = AppDomain.CurrentDomain.Getreplacedemblies(); }

            var results = new List<Type>();

            Parallel.ForEach(searchreplacedemblies, (replacedembly) =>
            {
                Parallel.ForEach(replacedembly.GetTypes(), (type) =>
                {
                    if (type != null && type.IsClreplaced && !type.IsAbstract && type.IsSubclreplacedOf(rootType))
                    {
                        results.Add(type);
                    }
                });
            });

            return results;
        }

19 Source : BaseMixedRealityProfileInspector.cs
with Apache License 2.0
from abist-co-ltd

private static bool RenderProfileInternal(SerializedProperty property, Type profileType,
            bool showAddButton, bool renderProfileInBox, Type serviceType = null)
        {
            var profile = property.serializedObject.targetObject as BaseMixedRealityProfile;
            bool changed = false;
            var oldObject = property.objectReferenceValue;

            if (profileType != null && !profileType.IsSubclreplacedOf(typeof(BaseMixedRealityProfile)) && profileType != typeof(BaseMixedRealityProfile))
            {
                // If they've drag-and-dropped a non-profile scriptable object, set it to null.
                profileType = null;
            }

            // If we're constraining this to a service type, check whether the profile is valid
            // If it isn't, issue a warning.
            if (serviceType != null && oldObject != null)
            {
                if (!MixedRealityProfileUtility.IsProfileForService(oldObject.GetType(), serviceType))
                {
                    EditorGUILayout.HelpBox("This profile is not supported for " + serviceType.Name + ". Using an unsupported service may result in unexpected behavior.", MessageType.Warning);
                }
            }

            if (profileType == null)
            {
                // Find the profile type so we can limit the available object field options
                if (serviceType != null)
                {
                    // If GetProfileTypesForService has a count greater than one, then it won't be possible to use
                    // EditorGUILayout.ObjectField to restrict the set of profiles to a single type - in this
                    // case all profiles of BaseMixedRealityProfile will be visible in the picker.
                    //
                    // However in the case where there is just a single profile type for the service, we can improve
                    // upon the user experience by limiting the set of things that show in the picker by restricting
                    // the set of profiles listed to only that type.
                    var availableTypes = MixedRealityProfileUtility.GetProfileTypesForService(serviceType);
                    if (availableTypes.Count == 1)
                    {
                        profileType = availableTypes.First();
                    }
                }

                // If the profile type is still null, just set it to base profile type
                if (profileType == null)
                {
                    profileType = typeof(BaseMixedRealityProfile);
                }
            }

            // Draw the profile dropdown
            changed |= MixedRealityInspectorUtility.DrawProfileDropDownList(property, profile, oldObject, profileType, showAddButton);

            Debug.replacedert(profile != null, "No profile was set in OnEnable. Did you forget to call base.OnEnable in a derived profile clreplaced?");

            // Draw the sub-profile editor
            MixedRealityInspectorUtility.DrawSubProfileEditor(property.objectReferenceValue, renderProfileInBox);

            return changed;
        }

19 Source : SceneInfoUtils.cs
with Apache License 2.0
from abist-co-ltd

private static void RefreshCachedTypes()
        {
            if (EditorApplication.isCompiling || BuildPipeline.isBuildingPlayer)
            {   // Don't refresh cached types if we're in the middle of something important
                return;
            }

            cachedComponentTypes.Clear();

            foreach (replacedembly replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
            {
                foreach (Type t in replacedembly.GetTypes().Where(t => t.IsSubclreplacedOf(typeof(Component))))
                {
                    foreach (FieldInfo f in t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
                    {
                        if (fieldTypesToSearch.Contains(f.FieldType))
                        {
                            cachedComponentTypes.Add(new Tuple<Type, FieldInfo>(t, f));
                        }
                    }
                }
            }
        }

19 Source : InteractableThemeBase.cs
with Apache License 2.0
from abist-co-ltd

public static InteractableThemeBase CreateTheme(Type themeType)
        {
            if (!themeType.IsSubclreplacedOf(typeof(InteractableThemeBase)))
            {
                Debug.LogError($"Trying to initialize theme of type {themeType} but type does not extend {typeof(InteractableThemeBase)}");
                return null;
            }

            return (InteractableThemeBase)Activator.CreateInstance(themeType);
        }

19 Source : StructuredState.cs
with MIT License
from AElfProject

private void DetectPropertyInfos()
        {
            _propertyInfos = this.GetType()
                .GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                .Where(x => x.PropertyType.IsSubclreplacedOf(typeof(StateBase)))
                .ToDictionary(x => x.Name, x => x);
            /*_states = this.GetType()
                .GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                .Where(x => x.PropertyType.IsSubclreplacedOf(typeof(StateBase)))
                .ToDictionary(x => x.Name, x =>
                {
                    var method = x.GetGetMethod();
                    var func = (Func<StateBase>) Delegate.CreateDelegate(typeof(Func<StateBase>),
                        this,
                        x.GetGetMethod());
                    return func();
                });*/
        }

19 Source : FileCarver.cs
with MIT License
from aerosoul94

public List<FileSignature> replacedyze(CancellationToken cancellationToken, IProgress<int> progress)
        {
            var allSignatures = from replacedembly in AppDomain.CurrentDomain.Getreplacedemblies()
                                from type in replacedembly.GetTypes()
                                where type.Namespace == "FATX.replacedyzers.Signatures"
                                where type.IsSubclreplacedOf(typeof(FileSignature))
                                select type;

            _carvedFiles = new List<FileSignature>();
            var interval = (long)_interval;

            var types = allSignatures.ToList();

            var origByteOrder = _volume.GetReader().ByteOrder;

            long progressValue = 0;
            long progressUpdate = interval * 0x200;

            for (long offset = 0; offset < _length; offset += interval)
            {
                foreach (Type type in types)
                {
                    // too slow
                    FileSignature signature = (FileSignature)Activator.CreateInstance(type, _volume, offset);

                    _volume.GetReader().ByteOrder = origByteOrder;

                    _volume.SeekFileArea(offset);
                    bool test = signature.Test();
                    if (test)
                    {
                        try
                        {
                            // Make sure that we record the file first
                            _carvedFiles.Add(signature);

                            // Attempt to parse the file
                            _volume.SeekFileArea(offset);
                            signature.Parse();
                            Console.WriteLine(string.Format("Found {0} at 0x{1:X}.", signature.GetType().Name, offset));
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(string.Format("Exception thrown for {0} at 0x{1:X}: {2}", signature.GetType().Name, offset, e.Message));
                            Console.WriteLine(e.StackTrace);
                        }
                    }
                }

                progressValue += interval;

                if (progressValue % progressUpdate == 0)
                    progress?.Report((int)(progressValue / interval));

                if (cancellationToken.IsCancellationRequested)
                {
                    return _carvedFiles;
                }
            }

            // Fill up the progress bar
            progress?.Report((int)(_length / interval));

            Console.WriteLine("Complete!");

            return _carvedFiles;
        }

19 Source : IDataExtendChecker.cs
with Mozilla Public License 2.0
from agebullhu

internal static bool PrepareDelete<T>(long[] ids)
        {
            var type = typeof(T);
            foreach (var creaters in Checker)
            {
                if (type != creaters.Key && !type.IsSubclreplacedOf(creaters.Key) && !type.IsSupperInterface(creaters.Key))
                    continue;
                foreach (var creater in creaters.Value.Dictionary.Values)
                {
                    var checker = creater();
                    if (!checker.PrepareDelete<T>(ids))
                        return false;
                }
            }
            return true;
        }

19 Source : IDataExtendChecker.cs
with Mozilla Public License 2.0
from agebullhu

internal static bool PrepareQuery<T>(IDataTable dataTable, ref string condition, ref DbParameter[] args)
        {
            var type = typeof(T);
            foreach (var creaters in Checker)
            {
                if (type != creaters.Key && !type.IsSubclreplacedOf(creaters.Key) && !type.IsSupperInterface(creaters.Key))
                    continue;
                foreach (var creater in creaters.Value.Dictionary.Values)
                {
                    var checker = creater();
                    if (!checker.PrepareQuery(dataTable, ref condition, ref args))
                        return false;
                }
            }
            return true;
        }

19 Source : ZeroDiscover.cs
with Mozilla Public License 2.0
from agebullhu

public static void DiscoverApiDoreplacedent(Type type)
        {
            if (!type.IsSubclreplacedOf(typeof(ApiStation)))
                return;
            ZeroTrace.SystemLog("DiscoverApiDoreplacedent", type.FullName);
            ZeroDiscover discover = new ZeroDiscover();
            discover.FindApi(type, true);
            discover.RegistDoreplacedent();
        }

19 Source : IZeroObject.cs
with Mozilla Public License 2.0
from agebullhu

public static bool RegistZeroObject(IZeroObject obj)
        {
            if (obj.GetType().IsSubclreplacedOf(typeof(ApiStation)))
                ZeroDiscover.DiscoverApiDoreplacedent(obj.GetType());
            using (OnceScope.CreateScope(ZeroObjects))
            {
                if (ZeroObjects.ContainsKey(obj.Name))
                    return false;
                ZeroTrace.SystemLog("RegistZeroObject", obj.Name);
                ZeroObjects.Add(obj.Name, obj);
                if (ApplicationState >= StationState.Initialized)
                {
                    try
                    {
                        obj.OnZeroInitialize();
                        ZeroTrace.SystemLog(obj.Name, "Initialize");
                    }
                    catch (Exception e)
                    {
                        ZeroTrace.WriteException(obj.Name, e, "Initialize");
                    }
                }

                if (!CanDo)
                    return true;
                try
                {
                    ZeroTrace.SystemLog(obj.Name, "Start");
                    obj.OnZeroStart();
                }
                catch (Exception e)
                {
                    ZeroTrace.WriteException(obj.Name, e, "Start");
                }
            }
            return true;
        }

19 Source : ZeroDiscover.cs
with Mozilla Public License 2.0
from agebullhu

public void FindApies()
        {
            XmlMember.Load(replacedembly);
            StationInfo.Add(StationName, _defStation = new StationDoreplacedent
            {
                Name = StationName
            });
            var types = replacedembly.GetTypes().Where(p => p.IsSubclreplacedOf(typeof(ApiController))).ToArray();
            foreach (var type in types)
            {
                FindApi(type, false);
            }
            RegistToZero();

            RegistDoreplacedent();
        }

19 Source : CommandCoefficient.cs
with Mozilla Public License 2.0
from agebullhu

public static List<CommandItemBase> Coefficient(object arg)
        {
            if (arg == null)
                return null;
            var dictionary = new Dictionary<ICommandItemBuilder, bool>();
            var type = arg.GetType();
            if (Commands.TryGetValue(type, out var result))
                return result;
            Commands.Add(type, result = new List<CommandItemBase>());

            foreach (var item in CommandBuilders)
            {
                if (item.Key != type && !type.IsSubclreplacedOf(item.Key))
                    continue;

                foreach (var action in item.Value.Where(p => p.Editor == null || !p.SignleSoruce))
                {
                    if (dictionary.ContainsKey(action))
                        continue;
                    result.Add(action.ToCommand(arg, null));
                    dictionary.Add(action, true);
                }
            }

            //foreach (var item in SourceTypeMap)
            //{
            //    if (item.Key != type && !type.IsSubclreplacedOf(item.Key))
            //        continue;
            //    foreach (var convert in item.Value)
            //    {
            //        foreach (var cmd in CommandBuilders)
            //        {
            //            result.Add(CommandItemBase.Line);
            //            foreach (var action in cmd.Value.Where(p => p.Editor == null))
            //            {
            //                if (dictionary.ContainsKey(action))
            //                    continue;
            //                if (cmd.Key == convert.Key || convert.Key.IsSubclreplacedOf(cmd.Key))
            //                {
            //                    dictionary.Add(action, true);
            //                    result.Add(action.ToCommand(arg, convert.Value));
            //                }
            //                else if (action.TargetType == convert.Key)
            //                {
            //                    dictionary.Add(action, true);
            //                    result.Add(action.ToCommand(arg, convert.Value));
            //                }
            //                else if (action.TargetType != null && action.TargetType.IsSubclreplacedOf(convert.Key))
            //                {
            //                    dictionary.Add(action, true);
            //                    result.Add(action.ToCommand(arg, convert.Value));
            //                }
            //            }
            //        }
            //    }
            //}
            return result;
        }

19 Source : CommandCoefficient.cs
with Mozilla Public License 2.0
from agebullhu

public static List<CommandItemBase> CoefficientEditor(Type type, string editor = null)
        {
            var result = new Dictionary<ICommandItemBuilder, CommandItemBase>();
            foreach (var item in CommandBuilders)
            {
                if (item.Key != type && !type.IsSubclreplacedOf(item.Key))
                    continue;
                foreach (var action in item.Value.Where(p => editor == null || p.Editor != null && p.Editor.Contains(editor)))
                {
                    if (!result.ContainsKey(action))
                        result.Add(action, action.ToCommand(null, null));
                }
            }

            //foreach (var item in SourceTypeMap)
            //{
            //    if (item.Key != type && !type.IsSubclreplacedOf(item.Key))
            //        continue;
            //    foreach (var convert in item.Value)
            //    {
            //        foreach (var cmd in CommandBuilders)
            //        {
            //            foreach (var action in cmd.Value.Where(p => editor == null || p.Editor != null && p.Editor.Contains(editor)))
            //            {
            //                if (result.ContainsKey(action))
            //                    continue;
            //                if (cmd.Key == convert.Key || convert.Key.IsSubclreplacedOf(cmd.Key))
            //                {
            //                    result.Add(action, action.ToCommand(null, convert.Value));
            //                }
            //                else if (action.TargetType == convert.Key)
            //                {
            //                    result.Add(action, action.ToCommand(null, convert.Value));
            //                }
            //                else if (action.TargetType != null && action.TargetType.IsSupperInterface(convert.Key))
            //                {
            //                    result.Add(action, action.ToCommand(null, convert.Value));
            //                }
            //            }
            //        }
            //    }
            //}
            return result.Values.ToList();
        }

19 Source : DrawActions.cs
with GNU General Public License v3.0
from aglab2

public static IEnumerable<Type> GetAllSubclreplacedes()
        {
            var baseType = typeof(Action);
            var replacedembly = baseType.replacedembly;

            return replacedembly.GetTypes().Where(t => t.IsSubclreplacedOf(baseType));
        }

19 Source : ContractResolver.cs
with MIT License
from Aguafrommars

protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
        {
            var property = base.CreateProperty(member, memberSerialization);
            var propertyInfo = member as PropertyInfo;
            var propertyType = propertyInfo?.PropertyType;
            property.ShouldSerialize = instance => propertyType != null && 
                (!propertyType.IsInterface || 
                    (typeof(IEnumerable).IsreplacedignableFrom(propertyType) &&
                    propertyType.IsGenericType 
                    && propertyType.GetGenericArguments().Any(a => !a.IsInterface))) 
                && !propertyType.IsSubclreplacedOf(typeof(Delegate));

            return property;
        }

19 Source : EditContextExtensions.cs
with Apache License 2.0
from Aguafrommars

private static IValidator GetValidatorForModel(object enreplacedy, object model, IStringLocalizer localizer)
        {
            if (model is IEnreplacedyResource resource)
            {
                var enreplacedyValidatorType = typeof(EnreplacedyResourceValidator<>).MakeGenericType(model.GetType());              
                return (IValidator)Activator.CreateInstance(enreplacedyValidatorType, enreplacedy, resource.ResourceKind, localizer);
            }
            var abstractValidatorType = typeof(AbstractValidator<>).MakeGenericType(model.GetType());
            var replacedemby = AppDomain.CurrentDomain.Getreplacedemblies().Where(a => a.FullName.Contains("Aguacongas.TheIdServer.BlazorApp"))
                .FirstOrDefault(a => a.GetTypes().Any(t => t.IsSubclreplacedOf(abstractValidatorType)));
            if (replacedemby == null)
            {
                return null;
            }

            var modelValidatorType = replacedemby.GetTypes().First(t => t.IsSubclreplacedOf(abstractValidatorType));

            var modelValidatorInstance = (IValidator)Activator.CreateInstance(modelValidatorType, enreplacedy, localizer);
            return modelValidatorInstance;
        }

19 Source : Type.cs
with Mozilla Public License 2.0
from ahyahy

public bool IsSubclreplacedOf(osf.Type p1)
        {
            return M_Type.IsSubclreplacedOf(p1.M_Type);
        }

19 Source : Type.cs
with Mozilla Public License 2.0
from ahyahy

[ContextMethod("ЭтоПодкласс", "IsSubclreplacedOf")]
        public bool IsSubclreplacedOf(ClType p1)
        {
            string str1 = Base_obj.ToString();
            string str2 = p1.Base_obj.ToString();
            System.Type Type1 = System.Type.GetType(str1.Replace("osf.Cl", "osf."));
            System.Type Type2 = System.Type.GetType(str2.Replace("osf.Cl", "osf."));
            return Type1.IsSubclreplacedOf(Type2);
        }

19 Source : HierarchyIconHelper.cs
with MIT License
from aillieo

private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
        {
            GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
            if (gameObject != null)
            {
                NodeDefine node = gameObject.GetComponent<NodeDefine>();
                if (node == null)
                {
                    return;
                }

                Type type = node.GetNodeType();
                if (type != null)
                {
                    // draw custom icon
                    var nodeIconAttributes = type.GetCustomAttributes(typeof(NodeIconAttribute), true);
                    if (nodeIconAttributes.Length > 0)
                    {
                        var attribute = nodeIconAttributes[0] as NodeIconAttribute;
                        string filePath = attribute.iconPath;
                        if (!cachedTexture.ContainsKey(filePath))
                        {
                            cachedTexture.Add(filePath, replacedetDatabase.LoadreplacedetAtPath<Texture2D>(filePath));
                        }
                        Texture2D tex = cachedTexture[filePath];
                        if (tex != null)
                        {
                            DrawIcon(instanceID, selectionRect, tex);
                            return;
                        }
                    }

                    // draw preset icons
                    if(type.IsSubclreplacedOf(typeof(NodeAction)))
                    {
                        DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeAction]);
                        return;
                    }
                    if (type.IsSubclreplacedOf(typeof(NodeCondition)))
                    {
                        DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeCondition]);
                        return;
                    }
                    if (type.IsSubclreplacedOf(typeof(NodeDecorator)))
                    {
                        DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeDecorator]);
                        return;
                    }

                    if (type == typeof(NodeSequence))
                    {
                        DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeSequence]);
                        return;
                    }
                    if (type == typeof(NodeSelector))
                    {
                        DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeSelector]);
                        return;
                    }
                    if (type == typeof(NodeParallel))
                    {
                        DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeParallel]);
                        return;
                    }

                }



                // default
                DrawIcon(instanceID, selectionRect, Texturereplacedets.TextureDict[PresetNodeIcons.NodeBase]);
            }
        }

19 Source : APIDocGeneratorMiddleware.cs
with MIT License
from AiursoftWeb

private bool IsController(Type type)
        {
            return
                type.Name.EndsWith("Controller") &&
                type.Name != "Controller" &&
                type.IsSubclreplacedOf(typeof(ControllerBase)) &&
                type.IsPublic;
        }

19 Source : Extends.cs
with MIT License
from AiursoftWeb

private static void AddScanned(
            Type service,
            Type condition,
            Action<Type, Type> abstractImplementation,
            Action<Type> realisticImplementation,
            IServiceCollection services,
            params Type[] abstracts)
        {
            if (!service.GetInterfaces().Contains(condition))
            {
                return;
            }
            foreach (var inputInterface in abstracts.Where(t => t.IsInterface))
            {
                if (service.GetInterfaces().Any(t => t == inputInterface))
                {
                    if (!services.Any(t => t.ServiceType == service && t.ImplementationType == inputInterface))
                    {
                        abstractImplementation(inputInterface, service);
                        Console.WriteLine($"Service:\t{service.Name}\t\t{service.replacedembly.FullName?.Split(',')[0]}\t\tsuccess as\t{inputInterface.Name}");
                    }
                }
            }
            foreach (var inputAbstractClreplaced in abstracts.Where(t => t.IsAbstract))
            {
                if (service.IsSubclreplacedOf(inputAbstractClreplaced))
                {
                    if (!services.Any(t => t.ServiceType == service && t.ImplementationType == inputAbstractClreplaced))
                    {
                        abstractImplementation(inputAbstractClreplaced, service);
                        Console.WriteLine($"Service:\t{service.Name}\t\t{service.replacedembly.FullName?.Split(',')[0]}\t\tsuccess as\t{inputAbstractClreplaced.Name}");
                    }
                }
            }
            if (!services.Any(t => t.ServiceType == service && t.ImplementationType == service))
            {
                realisticImplementation(service);
                Console.WriteLine($"Service:\t{service.Name}\t\t{service.replacedembly.FullName?.Split(',')[0]}\t\tsuccess");
            }
        }

19 Source : InstranceMaker.cs
with MIT License
from AiursoftWeb

private static IList GetArrayWithInstanceInherts(Type itemType)
        {
            var listType = typeof(List<>);
            var constructedListType = listType.MakeGenericType(itemType);
            var instance = (IList)Activator.CreateInstance(constructedListType);
            if (instance == null)
            {
                return new List<object>();
            }
            if (!itemType.IsAbstract)
            {
                instance.Add(Make(itemType));
            }
            foreach (var item in replacedembly.GetEntryreplacedembly()?.GetTypes().Where(t => !t.IsAbstract).Where(t => t.IsSubclreplacedOf(itemType)) ?? new List<Type>())
            {
                instance.Add(Make(item));
            }
            return instance;
        }

19 Source : BotExtends.cs
with MIT License
from AiursoftWeb

private static IEnumerable<Type> ScanBots()
        {
            var bots = replacedembly
                .GetEntryreplacedembly()
                ?.GetTypes()
                .Where(t => t.IsSubclreplacedOf(typeof(BotBase)));
            return bots;
        }

19 Source : DefaultContractResolver.cs
with MIT License
from akaskela

internal static bool CanConvertToString(Type type)
        {
#if !(DOTNET || PORTABLE40 || PORTABLE)
            TypeConverter converter = ConvertUtils.GetConverter(type);

            // use the objectType's TypeConverter if it has one and can convert to a string
            if (converter != null
                && !(converter is ComponentConverter)
                && !(converter is ReferenceConverter)
                && converter.GetType() != typeof(TypeConverter))
            {
                if (converter.CanConvertTo(typeof(string)))
                {
                    return true;
                }
            }
#endif

            if (type == typeof(Type) || type.IsSubclreplacedOf(typeof(Type)))
            {
                return true;
            }

            return false;
        }

19 Source : DefaultContractResolver.cs
with MIT License
from akaskela

protected virtual JsonContract CreateContract(Type objectType)
        {
            if (IsJsonPrimitiveType(objectType))
            {
                return CreatePrimitiveContract(objectType);
            }

            Type t = ReflectionUtils.EnsureNotNullableType(objectType);
            JsonContainerAttribute containerAttribute = JsonTypeReflector.GetCachedAttribute<JsonContainerAttribute>(t);

            if (containerAttribute is JsonObjectAttribute)
            {
                return CreateObjectContract(objectType);
            }

            if (containerAttribute is JsonArrayAttribute)
            {
                return CreateArrayContract(objectType);
            }

            if (containerAttribute is JsonDictionaryAttribute)
            {
                return CreateDictionaryContract(objectType);
            }

            if (t == typeof(JToken) || t.IsSubclreplacedOf(typeof(JToken)))
            {
                return CreateLinqContract(objectType);
            }

            if (CollectionUtils.IsDictionaryType(t))
            {
                return CreateDictionaryContract(objectType);
            }

            if (typeof(IEnumerable).IsreplacedignableFrom(t))
            {
                return CreateArrayContract(objectType);
            }

            if (CanConvertToString(t))
            {
                return CreateStringContract(objectType);
            }

#if !(DOTNET || PORTABLE40 || PORTABLE)
            if (!IgnoreSerializableInterface && typeof(ISerializable).IsreplacedignableFrom(t))
            {
                return CreateISerializableContract(objectType);
            }
#endif

#if !(NET35 || NET20 || PORTABLE40)
            if (typeof(IDynamicMetaObjectProvider).IsreplacedignableFrom(t))
            {
                return CreateDynamicContract(objectType);
            }
#endif

#if !PORTABLE
            // tested last because it is not possible to automatically deserialize custom IConvertible types
            if (IsIConvertible(t))
            {
                return CreatePrimitiveContract(t);
            }
#endif

            return CreateObjectContract(objectType);
        }

19 Source : NodeEditorAssetModProcessor.cs
with MIT License
from aksyr

private static replacedetDeleteResult OnWillDeletereplacedet (string path, RemovereplacedetOptions options) {
            // Get the object that is requested for deletion
            UnityEngine.Object obj = replacedetDatabase.LoadreplacedetAtPath<UnityEngine.Object> (path);

            // If we aren't deleting a script, return
            if (!(obj is UnityEditor.MonoScript)) return replacedetDeleteResult.DidNotDelete;

            // Check script type. Return if deleting a non-node script
            UnityEditor.MonoScript script = obj as UnityEditor.MonoScript;
            System.Type scriptType = script.GetClreplaced ();
            if (scriptType == null || (scriptType != typeof (XNode.Node) && !scriptType.IsSubclreplacedOf (typeof (XNode.Node)))) return replacedetDeleteResult.DidNotDelete;

            // Find all ScriptableObjects using this script
            string[] guids = replacedetDatabase.Findreplacedets ("t:" + scriptType);
            for (int i = 0; i < guids.Length; i++) {
                string replacedetpath = replacedetDatabase.GUIDToreplacedetPath (guids[i]);
                Object[] objs = replacedetDatabase.LoadAllreplacedetRepresentationsAtPath (replacedetpath);
                for (int k = 0; k < objs.Length; k++) {
                    XNode.Node node = objs[k] as XNode.Node;
                    if (node.GetType () == scriptType) {
                        if (node != null && node.graph != null) {
                            // Delete the node and notify the user
                            Debug.LogWarning (node.name + " of " + node.graph + " depended on deleted script and has been removed automatically.", node.graph);
                            node.graph.RemoveNode (node);
                        }
                    }
                }
            }
            // We didn't actually delete the script. Tell the internal system to carry on with normal deletion procedure
            return replacedetDeleteResult.DidNotDelete;
        }

19 Source : BaseNode.cs
with MIT License
from alelievr

public static BaseNode CreateFromType(Type nodeType, Vector2 position)
		{
			if (!nodeType.IsSubclreplacedOf(typeof(BaseNode)))
				return null;

			var node = Activator.CreateInstance(nodeType) as BaseNode;

			node.position = new Rect(position, new Vector2(100, 100));

			ExceptionToLog.Call(() => node.OnNodeCreated());

			return node;
		}

19 Source : NodeProvider.cs
with MIT License
from alelievr

public static Type GetNodeViewTypeFromType(Type nodeType)
		{
			Type view;

            if (nodeViewPerType.TryGetValue(nodeType, out view))
                return view;

            Type baseType = null;

            // Allow for inheritance in node views: multiple C# node using the same view
            foreach (var type in nodeViewPerType)
            {
                // Find a view (not first fitted view) of nodeType
                if (nodeType.IsSubclreplacedOf(type.Key) && (baseType == null || type.Value.IsSubclreplacedOf(baseType)))
                    baseType = type.Value;
            }

            if (baseType != null)
                return baseType;

            return view;
        }

19 Source : GraphCLI.Parser.cs
with MIT License
from alelievr

static Type	TryParseNodeType(string type)
		{
			Type	nodeType;

			//try to parse the node type:
			nodeType = Type.GetType(type);
			if (nodeType == null)
				nodeType = Type.GetType("ProceduralWorlds.Node." + type);
			if (nodeType == null)
				nodeType = Type.GetType("ProceduralWorlds.Core." + type);

			//thorw exception if the type can't be parse / does not inherit from BaseNode
			if (nodeType == null || !nodeType.IsSubclreplacedOf(typeof(BaseNode)))
				throw new InvalidOperationException("Type " + type + " not found as a node type (" + nodeType + ")");
			
			return nodeType;
		}

19 Source : BaseNodeView.cs
with MIT License
from alelievr

void UpdateOtherFieldValue(FieldInfo info, object newValue)
		{
			// Warning: Keep in sync with FieldFactory CreateField
			var fieldType = info.FieldType.IsSubclreplacedOf(typeof(UnityEngine.Object)) ? typeof(UnityEngine.Object) : info.FieldType;
			var genericUpdate = specificUpdateOtherFieldValue.MakeGenericMethod(fieldType);

			genericUpdate.Invoke(this, new object[]{info, newValue});
		}

19 Source : BaseNodeView.cs
with MIT License
from alelievr

object GetInputFieldValue(FieldInfo info)
		{
			// Warning: Keep in sync with FieldFactory CreateField
			var fieldType = info.FieldType.IsSubclreplacedOf(typeof(UnityEngine.Object)) ? typeof(UnityEngine.Object) : info.FieldType;
			var genericUpdate = specificGetValue.MakeGenericMethod(fieldType);

			return genericUpdate.Invoke(this, new object[]{info});
		}

19 Source : BaseGraph.cs
with MIT License
from alelievr

public string AddExposedParameter(string name, Type type, object value = null)
		{

			if (!type.IsSubclreplacedOf(typeof(ExposedParameter)))
			{
				Debug.LogError($"Can't add parameter of type {type}, the type doesn't inherit from ExposedParameter.");
			}

			var param = Activator.CreateInstance(type) as ExposedParameter;

			// patch value with correct type:
			if (param.GetValueType().IsValueType)
				value = Activator.CreateInstance(param.GetValueType());
			
			param.Initialize(name, value);
			exposedParameters.Add(param);

			onExposedParameterListChanged?.Invoke();

			return param.guid;
		}

19 Source : MicroSplatShaderGUI_Compiler.cs
with MIT License
from alelievr

public void Init()
      {
         if (terrainBody == null || extensions.Count == 0)
         {
            string[] paths = replacedetDatabase.Findreplacedets("microsplat_ t:Textreplacedet");
            for (int i = 0; i < paths.Length; ++i)
            {
               paths[i] = replacedetDatabase.GUIDToreplacedetPath(paths[i]);
            }

            for (int i = 0; i < paths.Length; ++i)
            {
               var p = paths[i];

               if (p.EndsWith("microsplat_terrain_body.txt"))
               {
                  terrainBody = replacedetDatabase.LoadreplacedetAtPath<Textreplacedet>(p);
               }
               if (p.EndsWith("microsplat_shared.txt"))
               {
                  sharedInc = replacedetDatabase.LoadreplacedetAtPath<Textreplacedet>(p);
               }
            }

            // init extensions
            var types = System.Reflection.replacedembly.GetExecutingreplacedembly().GetTypes();
            var possible = (from System.Type type in types
                                 where type.IsSubclreplacedOf(typeof(FeatureDescriptor))
                                 select type).ToArray();

            for (int i = 0; i < possible.Length; ++i)
            {
               var typ = possible[i];
               FeatureDescriptor ext = System.Activator.CreateInstance(typ) as FeatureDescriptor;
               ext.InitCompiler(paths);
               extensions.Add(ext);
            }
            extensions.Sort(delegate(FeatureDescriptor p1, FeatureDescriptor p2)
            {
               if (p1.DisplaySortOrder() != 0 || p2.DisplaySortOrder() != 0)
               {
                  return p1.DisplaySortOrder().CompareTo(p2.DisplaySortOrder());
               }
               return p1.GetType().Name.CompareTo(p2.GetType().Name);
            });


            var adapters = (from System.Type type in types
               where(type.GetInterfaces().Contains(typeof(IRenderLoopAdapter))) 
               select type).ToArray();

            availableRenderLoops.Clear();
            for (int i = 0; i < adapters.Length; ++i)
            {
               var typ = adapters[i];
               IRenderLoopAdapter adapter = System.Activator.CreateInstance(typ) as IRenderLoopAdapter;
               adapter.Init(paths);
               availableRenderLoops.Add(adapter);
            }

         }
      }

19 Source : GraphBuilder.cs
with MIT License
from alelievr

public GraphBuilder NewNode(Type nodeType, string name, BaseGraphCLIAttributes attributes = null)
		{
			if (!nodeType.IsSubclreplacedOf(typeof(BaseNode)))
			{
				Debug.Log("[GraphBuilder] unknown node type: '" + nodeType + "'");
				return this;
			}
			commands.Add(BaseGraphCLI.GenerateNewNodeCommand(nodeType, name, attributes));
			return this;
		}

19 Source : GraphBuilder.cs
with MIT License
from alelievr

public GraphBuilder NewNode(Type nodeType, Vector2 position, string name, BaseGraphCLIAttributes attributes = null)
		{
			if (!nodeType.IsSubclreplacedOf(typeof(BaseNode)))
			{
				Debug.Log("[GraphBuilder] unknown node type: '" + nodeType + "'");
				return this;
			}
			commands.Add(BaseGraphCLI.GenerateNewNodeCommand(nodeType, name, position, attributes));
			return this;
		}

19 Source : MixtureGraphView.cs
with MIT License
from alelievr

public override List< Port > GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter)
		{
			var compatiblePorts = new List< Port >();
			PortView startPortView = startPort as PortView;

			compatiblePorts.AddRange(ports.ToList().Where(p => {
				var portView = p as PortView;

				if (p.direction == startPort.direction)
					return false;

				if (p.node == startPort.node)
					return false;

				//Check if there is custom adapters for this replacedignation
				if (CustomPortIO.Isreplacedignable(startPort.portType, p.portType))
					return true;

				// Allow connection between RenderTexture and all texture types:
				Type startType = startPortView.portData.displayType ?? startPortView.portType;
				Type endType = portView.portData.displayType ?? portView.portType;
				if (startType == typeof(RenderTexture))
				{
					if (endType.IsSubclreplacedOf(typeof(Texture)))
						return true;
				}
				if (endType == typeof(RenderTexture))
				{
					if (startType.IsSubclreplacedOf(typeof(Texture)))
						return true;
				}

				//Check for type replacedignability
				if (!BaseGraph.TypesAreConnectable(startPort.portType, p.portType))
					return false;

				//Check if the edge already exists
				if (portView.GetEdges().Any(e => e.input == startPort || e.output == startPort))
					return false;

				return true;
			}));

			return compatiblePorts;
		}

19 Source : ProceduralWorldsGUI.cs
with MIT License
from alelievr

public void ObjectPreview(GUIContent name, object obj, bool update)
		{
			Type objType = obj.GetType();

			if (objType == typeof(Sampler2D))
				Sampler2DPreview(name, obj as Sampler2D, update);
			else if (obj.GetType().IsSubclreplacedOf(typeof(Object)))
			{
				//unity object preview
			}
			else
				Debug.LogWarning("can't preview the object of type: " + obj.GetType());
		}

See More Examples