public void Remove(IPsbPlugin plugin) { if (plugin is IPsbImageFormatter f) { f.Extensions.ForEach(ext => ImageFormatters.Remove(ext)); } if (plugin is IPsbAudioFormatter a) { a.Extensions.ForEach(ext => AudioFormatters.Remove(ext)); } if (plugin is IPsbShell s) { Shells.Remove(s.Name); } if (plugin is IPsbSpecialType t) { SpecialTypes.Remove(t.TypeId); } if (plugin is IPsbKeyProvider) { _keyProvider = null; } _plugins.Remove(plugin); }
public Transpiler(Solution solution) { this.solution = solution; var coreLibProject = solution.coreLibProject; specialTypes = new SpecialTypes(coreLibProject.compilation); }
internal override NamedTypeSymbol GetDeclaredSpecialType(SpecialType type) { #if DEBUG foreach (var module in this.Modules) { Debug.Assert(module.GetReferencedAssemblies().Length == 0); } #endif if (_lazySpecialTypes == null) { Interlocked.CompareExchange( ref _lazySpecialTypes, new NamedTypeSymbol[(int)SpecialType.Count + 1], null ); } if ((object)_lazySpecialTypes[(int)type] == null) { MetadataTypeName emittedFullName = MetadataTypeName.FromFullName( SpecialTypes.GetMetadataName(type), useCLSCompliantNameArityEncoding: true ); NamedTypeSymbol corType = new MissingMetadataTypeSymbol.TopLevel( this.moduleSymbol, ref emittedFullName, type ); Interlocked.CompareExchange(ref _lazySpecialTypes[(int)type], corType, null); } return(_lazySpecialTypes[(int)type]); }
private IPageElementConstructor <TGroup, TPage> FindConstructor(Type type, IAttributeSet atts) { if (atts == null) { throw new ArgumentNullException(nameof(atts)); } IPageElementConstructor <TGroup, TPage> constr = null; if (atts.Has <ISpecificConstructorAttribute>()) { var constrType = atts.Get <ISpecificConstructorAttribute>().ConstructorType; var constrs = m_SpecificConstructors.Where(c => constrType.IsAssignableFrom(c.Key)); if (constrs.Count() == 1) { constr = constrs.First().Value; } else if (!constrs.Any()) { throw new ConstructorNotFoundException(type, "Specific constructor is not registered"); } else { throw new ConstructorNotFoundException(type, "Too many constructors registered"); } } else { if (!m_DefaultConstructors.TryGetValue(type, out constr)) { constr = m_DefaultConstructors.FirstOrDefault( t => t.Key.IsAssignableFrom(type)).Value; if (constr == null) { foreach (var specType in SpecialTypes.FindMathingSpecialTypes(type)) { if (m_SpecialTypeConstructors.TryGetValue(specType, out constr)) { break; } } } } } if (constr != null) { return(constr); } else { throw new ConstructorNotFoundException(type); } }
public Card(int newCardID, string newCardName, string newCardInfo, CardTypes newCardType, ElementTypes newElement, SpecialTypes newSpecial, int maxHP, int maxAP, int maxDP, bool newPiercing) { this.cardID = newCardID; this.cardType = newCardType; this.cardName = newCardName; this.cardInfo = newCardInfo; this.elementType = newElement; this.specialType = newSpecial; this.healthPoints = maxHP; this.attackPoints = maxAP; this.defensePoints = maxDP; this.piercing = newPiercing; }
public Map16Editor() { InitializeComponent(); CmbGraphics1.DisplayMember = CmbGraphics2.DisplayMember = CmbPalettes.DisplayMember = CmbDefinitions.DisplayMember = "Name"; foreach (var g in ProjectController.GraphicsManager.GraphicsInfo) { CmbGraphics1.Items.Add(g); CmbGraphics2.Items.Add(g); } foreach (var p in ProjectController.PaletteManager.Palettes) { CmbPalettes.Items.Add(p); } foreach (var l in ProjectController.LevelManager.LevelTypes) { CmbDefinitions.Items.Add(l); } CurrentTable = ProjectController.GraphicsManager.BuildPatternTable(0); PtvTable.CurrentTable = CurrentTable; BlsBlocks.CurrentTable = CurrentTable; BlsBlocks.BlockLayout = ProjectController.LayoutManager.BlockLayouts[0]; BlvCurrent.CurrentTable = CurrentTable; BlsBlocks.SpecialTable = ProjectController.SpecialManager.SpecialTable; BlsBlocks.SpecialPalette = ProjectController.SpecialManager.SpecialPalette; CmbGraphics1.SelectedIndex = 8; CmbGraphics2.SelectedIndex = 0x64; CmbPalettes.SelectedIndex = 0; CmbDefinitions.SelectedIndex = 0; BlsBlocks.SelectionChanged += new EventHandler <TEventArgs <MouseButtons> >(BlsBlocks_SelectionChanged); BlsBlocks.SelectedIndex = 0; solidityMap[0] = BlockProperty.Background; solidityMap[1] = BlockProperty.Foreground; solidityMap[2] = BlockProperty.Water; solidityMap[3] = BlockProperty.Water | BlockProperty.Foreground; solidityMap[4] = BlockProperty.SolidTop; solidityMap[5] = BlockProperty.SolidBottom; solidityMap[6] = BlockProperty.SolidAll; solidityMap[7] = BlockProperty.CoinBlock; for (int i = 0; i < 16; i++) { SpecialTypes.Add(((BlockProperty)(0xF0 | i)).ToString()); } }
public void IntegrityTest() { for (int i = 1; i <= (int)SpecialType.Count; i++) { string name = SpecialTypes.GetMetadataName((SpecialType)i); Assert.Equal((SpecialType)i, SpecialTypes.GetTypeFromMetadataName(name)); } for (int i = 0; i <= (int)SpecialType.Count; i++) { Cci.PrimitiveTypeCode code = SpecialTypes.GetTypeCode((SpecialType)i); if (code != Cci.PrimitiveTypeCode.NotPrimitive) { Assert.Equal((SpecialType)i, SpecialTypes.GetTypeFromMetadataName(code)); } } for (int i = 0; i <= (int)Cci.PrimitiveTypeCode.Invalid; i++) { SpecialType id = SpecialTypes.GetTypeFromMetadataName((Cci.PrimitiveTypeCode)i); if (id != SpecialType.None) { Assert.Equal((Cci.PrimitiveTypeCode)i, SpecialTypes.GetTypeCode(id)); } } Assert.Equal(SpecialType.System_Boolean, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Boolean)); Assert.Equal(SpecialType.System_Char, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Char)); Assert.Equal(SpecialType.System_Void, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Void)); Assert.Equal(SpecialType.System_String, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.String)); Assert.Equal(SpecialType.System_Int64, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Int64)); Assert.Equal(SpecialType.System_Int32, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Int32)); Assert.Equal(SpecialType.System_Int16, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Int16)); Assert.Equal(SpecialType.System_SByte, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Int8)); Assert.Equal(SpecialType.System_UInt64, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.UInt64)); Assert.Equal(SpecialType.System_UInt32, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.UInt32)); Assert.Equal(SpecialType.System_UInt16, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.UInt16)); Assert.Equal(SpecialType.System_Byte, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.UInt8)); Assert.Equal(SpecialType.System_Single, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Float32)); Assert.Equal(SpecialType.System_Double, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.Float64)); Assert.Equal(SpecialType.System_IntPtr, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.IntPtr)); Assert.Equal(SpecialType.System_UIntPtr, SpecialTypes.GetTypeFromMetadataName(Cci.PrimitiveTypeCode.UIntPtr)); }
/// <summary> /// Get symbol for predefined type from Cor Library used by this assembly. /// </summary> /// <param name="type"></param> /// <returns></returns> internal NamedTypeSymbol GetPrimitiveType(Microsoft.Cci.PrimitiveTypeCode type) { return(GetSpecialType(SpecialTypes.GetTypeFromMetadataName(type))); }
/// <summary> /// Get symbol for predefined type from Cor Library used by this assembly. /// </summary> /// <param name="type"></param> /// <returns></returns> internal NamedTypeSymbol GetPrimitiveType(StarkPlatform.Cci.PrimitiveTypeCode type) { return(GetSpecialType(SpecialTypes.GetTypeFromMetadataName(type))); }
CoreType Create(SpecialType type) => CreateFromFullName(SpecialTypes.GetMetadataName(type));
/// <summary> /// Convert a file from source codepage to destination codepage /// </summary> /// <param name="filename">filename</param> /// <param name="destDir">output directory</param> /// <param name="sourceCP">source codepage</param> /// <param name="destCP">destination codepage</param> /// <param name="specialType">SpecialTypes</param> /// <param name="outputMetaTag">True=output meta tag</param> /// <returns></returns> public static bool ConvertFile(string filename, string destDir, int sourceCP, int destCP, SpecialTypes specialType, bool outputMetaTag, byte[] BOM) { //source file data string fileData = ""; //get the encodings Encoding sourceEnc = Encoding.GetEncoding(sourceCP); Encoding destEnc = Encoding.GetEncoding(destCP); System.IO.FileStream fw = null; //get the output filename //john church 05/10/2008 use directory separator char instead of backslash for linux support string outputFilename = filename.Substring(filename.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1); //check if the file exists if (!System.IO.File.Exists(filename)) { throw new System.IO.FileNotFoundException(filename); } try { //check or create the output directory if (!System.IO.Directory.Exists(destDir)) { System.IO.Directory.CreateDirectory(destDir); } //check if we need to output meta tags if (outputMetaTag) { fileData = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + destEnc.WebName + "\" />"; } //check we've got a backslash at the end of the pathname //john church 05/10/2008 use directory separator char instead of backslash for linux support if (destDir.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()) == false) destDir += System.IO.Path.DirectorySeparatorChar; //read in the source file //john church 09/02/2011 add source encoding parameter to ReadAllText call fileData += System.IO.File.ReadAllText(filename, sourceEnc); //check for any special cases switch (specialType) { case SpecialTypes.UnicodeAsDecimal: fileData = ConvertDecimals(fileData); break; case SpecialTypes.None: //do nothing break; } //put the data into an array byte[] bSource = sourceEnc.GetBytes(fileData); //do the conversion byte[] bDest = System.Text.Encoding.Convert(sourceEnc, destEnc, bSource); //write out the file fw = new System.IO.FileStream(destDir + outputFilename, System.IO.FileMode.Create); if (BOM.Length > 0) { fw.Write(BOM, 0, BOM.Length); } fw.Write(bDest, 0, bDest.Length); return true; } catch (Exception ex) { //just throw the exception back up throw ex; } finally { //clean up the stream if (fw != null) { fw.Close(); } fw.Dispose(); } }
/// <summary> /// Convert a file from source codepage to destination codepage /// </summary> /// <param name="filename">filename</param> /// <param name="destDir">output directory</param> /// <param name="sourceCP">source codepage</param> /// <param name="destCP">destination codepage</param> /// <param name="specialType">SpecialTypes</param> /// <param name="outputMetaTag">True=output meta tag</param> /// <returns></returns> public static bool ConvertFile(string filename, string destDir, int sourceCP, int destCP, SpecialTypes specialType, bool outputMetaTag, byte[] BOM) { //source file data string fileData = ""; //get the encodings Encoding sourceEnc = Encoding.GetEncoding(sourceCP); Encoding destEnc = Encoding.GetEncoding(destCP); System.IO.FileStream fw = null; //get the output filename //john church 05/10/2008 use directory separator char instead of backslash for linux support string outputFilename = filename.Substring(filename.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1); //check if the file exists if (!System.IO.File.Exists(filename)) { throw new System.IO.FileNotFoundException(filename); } try { //check or create the output directory if (!System.IO.Directory.Exists(destDir)) { System.IO.Directory.CreateDirectory(destDir); } //check if we need to output meta tags if (outputMetaTag) { fileData = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + destEnc.WebName + "\" />"; } //check we've got a backslash at the end of the pathname //john church 05/10/2008 use directory separator char instead of backslash for linux support if (destDir.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()) == false) { destDir += System.IO.Path.DirectorySeparatorChar; } //read in the source file //john church 09/02/2011 add source encoding parameter to ReadAllText call fileData += System.IO.File.ReadAllText(filename, sourceEnc); //check for any special cases switch (specialType) { case SpecialTypes.UnicodeAsDecimal: fileData = ConvertDecimals(fileData); break; case SpecialTypes.None: //do nothing break; } //put the data into an array byte[] bSource = sourceEnc.GetBytes(fileData); //do the conversion byte[] bDest = System.Text.Encoding.Convert(sourceEnc, destEnc, bSource); //write out the file fw = new System.IO.FileStream(destDir + outputFilename, System.IO.FileMode.Create); if (BOM.Length > 0) { fw.Write(BOM, 0, BOM.Length); } fw.Write(bDest, 0, bDest.Length); return(true); } catch (Exception ex) { //just throw the exception back up throw ex; } finally { //clean up the stream if (fw != null) { fw.Close(); } fw.Dispose(); } }
/// <summary> /// Initializes the types. /// </summary> private void InitializeTypes() { string[] scalarTypes = { "bool", "int", "half", "float", "double", "string", // Actually not a scalar type, but treated similarly. }; foreach (string type in scalarTypes) { ScalarTypes.Add(new TypeCompletionData(type)); } string[] types = { "bool1", "bool2", "bool3", "bool4", "bool1x1", "bool1x2", "bool1x3", "bool1x4", "bool2x1", "bool2x2", "bool2x3", "bool2x4", "bool3x1", "bool3x2", "bool3x3", "bool3x4", "bool4x1", "bool4x2", "bool4x3", "bool4x4", "int1", "int2", "int3", "int4", "int1x1", "int1x2", "int1x3", "int1x4", "int2x1", "int2x2", "int2x3", "int2x4", "int3x1", "int3x2", "int3x3", "int3x4", "int4x1", "int4x2", "int4x3", "int4x4", "half1", "half2", "half3", "half4", "half1x1", "half1x2", "half1x3", "half1x4", "half2x1", "half2x2", "half2x3", "half2x4", "half3x1", "half3x2", "half3x3", "half3x4", "half4x1", "half4x2", "half4x3", "half4x4", "float1", "float2", "float3", "float4", "float1x1", "float1x2", "float1x3", "float1x4", "float2x1", "float2x2", "float2x3", "float2x4", "float3x1", "float3x2", "float3x3", "float3x4", "float4x1", "float4x2", "float4x3", "float4x4", "double1", "double2", "double3", "double4", "double1x1", "double1x2", "double1x3", "double1x4", "double2x1", "double2x2", "double2x3", "double2x4", "double3x1", "double3x2", "double3x3", "double3x4", "double4x1", "double4x2", "double4x3", "double4x4", }; foreach (string type in types) { Types.Add(new TypeCompletionData(type)); } string[] specialTypes = { "void", "sampler","sampler1D", "sampler2D", "sampler3D", "samplerCUBE", "sampler_state", "struct", }; foreach (string type in specialTypes) { SpecialTypes.Add(new TypeCompletionData(type)); } string[] effectTypes = { "technique", "pass", "asm", }; foreach (string type in effectTypes) { EffectTypes.Add(new TypeCompletionData(type)); } }
public void RemoveSpecialVisual(SpecialTypes type) { var visualGameObject = transform.Find("Special/" + Enum.GetName(typeof(SpecialTypes), type)).gameObject; visualGameObject.SetActive(false); }
public GameObject GetVisualOf(SpecialTypes type) { return transform.Find("Special/" + Enum.GetName(typeof(SpecialTypes), type)).gameObject; }
public void SetSpecialVisual(SpecialTypes type, bool preview) { var visualGameObject = transform.Find("Special/" + Enum.GetName(typeof(SpecialTypes), type)).gameObject; var spriteRenderer = visualGameObject.GetComponent<Image>(); if (preview) { if (spriteRenderer != null) { spriteRenderer.color = previewColor; } } else { if (spriteRenderer != null) { spriteRenderer.color = enabledColor; } } visualGameObject.SetActive(true); }
/// <summary> /// Convert a file from source codepage to destination codepage /// </summary> /// <param name="filename">filename</param> /// <param name="destDir">output directory</param> /// <param name="sourceCP">source codepage</param> /// <param name="destCP">destination codepage</param> /// <param name="specialType">SpecialTypes</param> /// <param name="outputMetaTag">True=output meta tag</param> /// <returns></returns> public static bool ConvertFile(string filename, string destDir, int sourceCP, int destCP, SpecialTypes specialType, bool outputMetaTag) { //source file data string fileData = ""; //get the encodings Encoding sourceEnc = Encoding.GetEncoding(sourceCP); Encoding destEnc = Encoding.GetEncoding(destCP); System.IO.FileStream fw = null; //get the output filename string outputFilename = filename.Substring(filename.LastIndexOf("\\") + 1); //check if the file exists if (!System.IO.File.Exists(filename)) { throw new System.IO.FileNotFoundException(filename); } try { //check or create the output directory if (!System.IO.Directory.Exists(destDir)) { System.IO.Directory.CreateDirectory(destDir); } //check if we need to output meta tags if (outputMetaTag) { fileData = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + destEnc.WebName + "\" />"; } //check we've got a backslash at the end of the pathname if (destDir.EndsWith("\\") == false) { destDir += "\\"; } //read in the source file fileData += System.IO.File.ReadAllText(filename); //check for any special cases switch (specialType) { case SpecialTypes.UnicodeAsDecimal: fileData = ConvertDecimals(fileData); break; case SpecialTypes.None: //do nothing break; } //put the data into an array byte[] bSource = sourceEnc.GetBytes(fileData); //do the conversion byte[] bDest = System.Text.Encoding.Convert(sourceEnc, destEnc, bSource); //write out the file fw = new System.IO.FileStream(destDir + outputFilename, System.IO.FileMode.Create); //02/05/2007 need to write first to bytes when saving as unicode if (destEnc.CodePage == 1200) { fw.WriteByte(0xFF); fw.WriteByte(0xFE); } fw.Write(bDest, 0, bDest.Length); return(true); } catch (Exception ex) { //just throw the exception back up throw ex; } finally { //clean up the stream if (fw != null) { fw.Close(); } fw.Dispose(); } }