protected CompilerRunnerBase(IContentType contentType) { Mef.SatisfyImportsOnce(this); SourceContentType = contentType; TargetContentType = FileExtensionRegistry.GetContentTypeForExtension(TargetExtension.TrimEnd('.')); _listeners = Mef.GetAllImports <IFileSaveListener>(TargetContentType); Settings = WESettings.Instance.ForContentType <ICompilerInvocationSettings>(contentType); }
private void SetField(string key, string value) { PropertyInfo propertyInfo = this.GetType().GetProperty(key, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (propertyInfo == null) { return; } if (propertyInfo.PropertyType == typeof(int)) { propertyInfo.SetValue(this, int.Parse(value), null); } else if (propertyInfo.PropertyType == typeof(string)) { propertyInfo.SetValue(this, value, null); } else if (propertyInfo.PropertyType == typeof(double)) { propertyInfo.SetValue(this, double.Parse(value), null); } else if (propertyInfo.PropertyType == typeof(bool)) { propertyInfo.SetValue(this, bool.Parse(value), null); } else if (propertyInfo.PropertyType == typeof(Attribute)) { propertyInfo.SetValue(this, AttributeExtension.ToEnum(value), null); } else if (propertyInfo.PropertyType == typeof(Target)) { propertyInfo.SetValue(this, TargetExtension.ToEnum(value), null); } else if (propertyInfo.PropertyType == typeof(Tribe)) { propertyInfo.SetValue(this, TribeExtension.ToEnum(value), null); } else if (propertyInfo.PropertyType == typeof(EnemyTribe)) { propertyInfo.SetValue(this, EnemyTribeExtension.ToEnum(value), null); } else if (propertyInfo.PropertyType == typeof(Job)) { propertyInfo.SetValue(this, JobExtension.ToEnum(value), null); } else if (propertyInfo.PropertyType == typeof(WeaponType)) { propertyInfo.SetValue(this, WeaponTypeExtension.ToEnum(value), null); } else if (propertyInfo.PropertyType == typeof(SelectType)) { propertyInfo.SetValue(this, SelectTypeExtension.ToEnum(value), null); } // 他の型にも対応させたいときには適当にここに。enumとかもどうにかなりそう。 }
public MetroBuildWindowExtension(TargetExtension targetExtension) { WSAUWPBuildType[] typeArray1 = new WSAUWPBuildType[2]; typeArray1[1] = WSAUWPBuildType.D3D; this.uwpBuildTypes = typeArray1; this.uwpBuildTypeStrings = new GUIContent[] { EditorGUIUtility.TextContent("XAML"), EditorGUIUtility.TextContent("D3D") }; WSABuildAndRunDeployTarget[] targetArray1 = new WSABuildAndRunDeployTarget[3]; targetArray1[1] = WSABuildAndRunDeployTarget.WindowsPhone; targetArray1[2] = WSABuildAndRunDeployTarget.LocalMachineAndWindowsPhone; this.wsaBuildAndRunDeployTargets = targetArray1; WSABuildAndRunDeployTarget[] targetArray2 = new WSABuildAndRunDeployTarget[2]; targetArray2[1] = WSABuildAndRunDeployTarget.WindowsPhone; this.wsaUWPBuildAndRunDeployTargets = targetArray2; this.wsaBuildAndRunDeployTargetStrings = new GUIContent[] { EditorGUIUtility.TextContent("Local Machine"), EditorGUIUtility.TextContent("Windows Phone"), EditorGUIUtility.TextContent("Local Machine and Windows Phone") }; Dictionary<WSASDK, GUIContent> dictionary = new Dictionary<WSASDK, GUIContent> { { WSASDK.SDK81, EditorGUIUtility.TextContent("8.1") }, { WSASDK.PhoneSDK81, EditorGUIUtility.TextContent("Phone 8.1") }, { WSASDK.UniversalSDK81, EditorGUIUtility.TextContent("Universal 8.1") }, { WSASDK.UWP, EditorGUIUtility.TextContent("Universal 10") } }; this.wsaSDKs = new WSASDK[] { WSASDK.SDK81 }; this.wsaSDKStrings = new GUIContent[this.wsaSDKs.Length]; for (int i = 0; i < this.wsaSDKs.Length; i++) { this.wsaSDKStrings[i] = dictionary[this.wsaSDKs[i]]; } this.targetExtension = targetExtension; }