public static string GetName(TypeReference type) { if (MonoType.IsCPrimitive(type)) { return(ScriptType.ToCPrimitiveString(type.Name)); } string name = type.Name; if (type.IsGenericInstance) { GenericInstanceType generic = (GenericInstanceType)type; int index = name.IndexOf('`'); name = name.Substring(0, index); name += '<'; for (int i = 0; i < generic.GenericArguments.Count; i++) { TypeReference arg = generic.GenericArguments[i]; name += GetArgumentName(arg); if (i < generic.GenericArguments.Count - 1) { name += ", "; } } name += '>'; } else if (type.HasGenericParameters) { int index = name.IndexOf('`'); name = name.Substring(0, index); name += '<'; for (int i = 0; i < type.GenericParameters.Count; i++) { GenericParameter par = type.GenericParameters[i]; name += GetArgumentName(par); if (i < type.GenericParameters.Count - 1) { name += ", "; } } name += '>'; } else if (type.IsArray) { ArrayType array = (ArrayType)type; name = GetName(array.ElementType) + $"[{new string(',', array.Dimensions.Count - 1)}]"; } return(name); }
public static bool CreateSymlink(string path, string target) { target = target.Replace('\\', '/'); //var link = new Mono.Unix.UnixSymbolicLinkInfo(path); var link = new SymlinkMono(path); //link.CreateSymbolicLinkTo(target); MethodInfo method = MonoType.GetMethod("CreateSymbolicLinkTo", new Type[] { typeof(string) }); method.Invoke(link.MonoObj, new object[] { target }); // return link.HasContents; return((bool)MonoType.GetProperty("HasContents").GetValue(link.MonoObj)); }
private IReadOnlyList <ScriptExportField> CreateFields(IScriptExportManager manager) { if (Definition == null) { return(new ScriptExportField[0]); } List <ScriptExportField> fields = new List <ScriptExportField>(); foreach (FieldDefinition field in Definition.Fields) { if (field.IsPublic) { if (field.IsNotSerialized) { continue; } } else { if (!ScriptExportMonoField.HasSerializeFieldAttribute(field)) { continue; } } if (field.FieldType.Module == null) { // if field has unknown type then consider it as serializable } else { TypeDefinition fieldTypeDefinition = field.FieldType.Resolve(); if (fieldTypeDefinition.IsInterface) { continue; } if (!MonoType.IsSerializableType(field.FieldType)) { continue; } } ScriptExportField efield = manager.RetrieveField(field); fields.Add(efield); } return(fields.ToArray()); }
public override MethodInfo[] GetMethods(BindingFlags bf) { if (!generic_type.IsCompilerContext) { throw new NotSupportedException(); } ArrayList l = new ArrayList(); // // Walk up our class hierarchy and retrieve methods from our // parent classes. // Type current_type = this; do { MonoGenericClass gi = current_type as MonoGenericClass; if (gi != null) { l.AddRange(gi.GetMethodsInternal(bf, this)); } else if (current_type is TypeBuilder) { l.AddRange(current_type.GetMethods(bf)); } else { // If we encounter a `MonoType', its // GetMethodsByName() will return all the methods // from its parent type(s), so we can stop here. MonoType mt = (MonoType)current_type; l.AddRange(mt.GetMethodsByName(null, bf, false, this)); break; } if ((bf & BindingFlags.DeclaredOnly) != 0) { break; } current_type = current_type.BaseType; } while (current_type != null); MethodInfo[] result = new MethodInfo [l.Count]; l.CopyTo(result); return(result); }
public void Compile(MonoType monoType, IFileEnumerator files) { if (!IsAOT) { throw ErrorHelper.CreateError(0099, "Internal error \"AOTBundle with aot: {0}\" Please file a bug report with a test case (http://bugzilla.xamarin.com).", aotType); } var monoEnv = new string [] { "MONO_PATH", files.RootDir }; Parallel.ForEach(GetFilesToAOT(files), ParallelOptions, file => { if (RunCommand(GetMonoPath(monoType), String.Format("--aot=hybrid {0}", Quote(file)), monoEnv) != 0) { throw ErrorHelper.CreateError(3001, "Could not AOT the assembly '{0}'", file); } }); }
private void SelectTab(Button selectButton, MonoType selectType) { // すべてのボタンをアクティブにする foreach (var button in tabButtons) { button.interactable = true; } // 押したボタンを非アクティブにする selectButton.interactable = false; // 表示可能なモノを取得 var displayableMonoInfos = playerMonoInfoRepository.GetDisplayableByType(selectType).ToList(); this.monoListPresetner.SetElement(displayableMonoInfos); }
public override EventInfo[] GetEvents(BindingFlags bf) { if (!this.generic_type.IsCompilerContext) { throw new NotSupportedException(); } ArrayList arrayList = new ArrayList(); Type type = this; for (;;) { MonoGenericClass monoGenericClass = type as MonoGenericClass; if (monoGenericClass != null) { arrayList.AddRange(monoGenericClass.GetEventsInternal(bf, this)); } else { if (!(type is TypeBuilder)) { break; } arrayList.AddRange(type.GetEvents(bf)); } if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default) { goto Block_4; } type = type.BaseType; if (type == null) { goto IL_8E; } } MonoType monoType = (MonoType)type; arrayList.AddRange(monoType.GetEvents(bf)); Block_4: IL_8E: EventInfo[] array = new EventInfo[arrayList.Count]; arrayList.CopyTo(array); return(array); }
string GetMonoPath(MonoType monoType) { switch (monoType) { case MonoType.Bundled64: return(Path.Combine(XamarinMacPrefix, "bin/bmac-mobile-mono")); case MonoType.Bundled32: return(Path.Combine(XamarinMacPrefix, "bin/bmac-mobile-mono-32")); case MonoType.System64: return("/Library/Frameworks/Mono.framework/Commands/mono64"); case MonoType.System32: return("/Library/Frameworks/Mono.framework/Commands/mono32"); default: throw ErrorHelper.CreateError(0099, "Internal error \"GetMonoPath with monoType: {0}\" Please file a bug report with a test case (http://bugzilla.xamarin.com).", monoType); } }
string GetExpectedMonoCommand(MonoType monoType) { switch (monoType) { case MonoType.Bundled64: return("bmac-mobile-mono"); case MonoType.Bundled32: return("bmac-mobile-mono-32"); case MonoType.System64: return("mono64"); case MonoType.System32: return("mono32"); default: Assert.Fail("GetMonoPath with invalid option"); return(""); } }
public override EventInfo[] GetEvents(BindingFlags bf) { if (!generic_type.IsCompilerContext) { throw new NotSupportedException(); } ArrayList l = new ArrayList(); Type current_type = this; do { MonoGenericClass gi = current_type as MonoGenericClass; if (gi != null) { l.AddRange(gi.GetEventsInternal(bf, this)); } else if (current_type is TypeBuilder) { l.AddRange(current_type.GetEvents(bf)); } else { MonoType mt = (MonoType)current_type; l.AddRange(mt.GetEvents(bf)); break; } if ((bf & BindingFlags.DeclaredOnly) != 0) { break; } current_type = current_type.BaseType; } while (current_type != null); EventInfo[] result = new EventInfo [l.Count]; l.CopyTo(result); return(result); }
public static string GetName(TypeReference type) { if (MonoType.IsCPrimitive(type)) { return(MonoUtils.ToCPrimitiveString(type.Name)); } if (type.IsGenericInstance) { GenericInstanceType generic = (GenericInstanceType)type; return(GetGenericInstanceName(generic)); } else if (type.HasGenericParameters) { return(GetGenericTypeName(type)); } else if (type.IsArray) { ArrayType array = (ArrayType)type; return(GetName(array.ElementType) + $"[{new string(',', array.Dimensions.Count - 1)}]"); } return(type.Name); }
// 设置暂停类型 public static void SetPauseType(MonoType type) => PauseType = type;
public IEnumerable <PlayerMonoInfo> GetDisplayableByType(MonoType type) { return(this.monoInfoRepository.GetByType(type) .Select(monoInfo => this.GetById(monoInfo.Id))); }
public IEnumerable <MonoInfo> GetByType(MonoType type) { return(GetAll() .Where(monoInfo => monoInfo.Type == type)); }
public void Compile(MonoType monoType, string path) { Compile(monoType, new FileSystemEnumerator(path)); }