public override void Execute(MDTableContext context) { var ask = new AskForInput(); ask.Owner = MainWindow.Instance; ask.Title = "Go to RID"; ask.label.Content = "_RID"; ask.ShowDialog(); if (ask.DialogResult != true) { return; } string error; uint rid = NumberVMUtils.ParseUInt32(ask.textBox.Text, 1, context.MetaDataTableVM.Rows, out error); if (!string.IsNullOrEmpty(error)) { MainWindow.Instance.ShowMessageBox(error); return; } if (rid == 0 || rid > context.MetaDataTableVM.Rows) { MainWindow.Instance.ShowMessageBox(string.Format("Invalid RID: {0}", rid)); return; } var recVM = context.MetaDataTableVM.Get((int)(rid - 1)); UIUtils.ScrollSelectAndSetFocus(context.ListView, recVM); }
protected override void Execute(DnHexBox dnHexBox) { var sel = dnHexBox.Selection; if (sel == null) { return; } var ask = new AskForInput(); ask.Owner = MainWindow.Instance; ask.Title = "Enter Value"; ask.label.Content = "_Byte"; ask.textBox.Text = "0xFF"; ask.ShowDialog(); if (ask.DialogResult != true) { return; } string error; byte b = NumberVMUtils.ParseByte(ask.textBox.Text, byte.MinValue, byte.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { MainWindow.Instance.ShowMessageBox(error); return; } dnHexBox.FillBytes(sel.Value.StartOffset, sel.Value.EndOffset, b); dnHexBox.Selection = null; }
public string GetString(out string s) { string error; s = NumberVMUtils.ParseString(text, true, out error); return(error); }
internal static uint?AskForToken(string title) { var ask = new AskForInput(); ask.Owner = MainWindow.Instance; ask.Title = title; ask.label.Content = "_Metadata token"; ask.textBox.Text = ""; ask.textBox.ToolTip = "Enter an MD token: 0x06001234 or 0x0200ABCD"; ask.ShowDialog(); if (ask.DialogResult != true) { return(null); } string tokenText = ask.textBox.Text; tokenText = tokenText.Trim(); if (string.IsNullOrEmpty(tokenText)) { return(null); } string error; uint token = NumberVMUtils.ParseUInt32(tokenText, uint.MinValue, uint.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { MainWindow.Instance.ShowMessageBox(error); return(null); } return(token); }
bool SelectMember(IAppCommandLineArgs args) { if (string.IsNullOrEmpty(args.SelectMember)) { return(false); } string error; uint token = NumberVMUtils.ParseUInt32(args.SelectMember, uint.MinValue, uint.MaxValue, out error); if (string.IsNullOrEmpty(error)) { var mod = GetLoadedFiles(args).FirstOrDefault(); var member = mod == null ? null : mod.ResolveToken(token); if (member == null) { return(false); } fileTabManager.FollowReference(member); return(true); } foreach (var mod in GetLoadedFiles(args)) { var member = XmlDocKeyProvider.FindMemberByKey(mod, args.SelectMember); if (member != null) { fileTabManager.FollowReference(member); return(true); } } return(false); }
static IDnlibDef AskForDef(string title, ITokenResolver resolver) { return(Shared.App.MsgBox.Instance.Ask(dnSpy_Resources.GoToToken_Label, null, title, s => { string error; uint token = NumberVMUtils.ParseUInt32(s, uint.MinValue, uint.MaxValue, out error); var memberRef = resolver.ResolveToken(token); var member = ResolveDef(memberRef); return member; }, s => { string error; uint token = NumberVMUtils.ParseUInt32(s, uint.MinValue, uint.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { return error; } var memberRef = resolver.ResolveToken(token); var member = ResolveDef(memberRef); if (memberRef == null) { return string.Format(dnSpy_Resources.GoToToken_InvalidToken, token); } else if (member == null) { return string.Format(dnSpy_Resources.GoToToken_CouldNotResolve, token); } return string.Empty; })); }
public override void Execute(DnHexBox dnHexBox) { var sel = dnHexBox.Selection; if (sel == null) { return; } var res = messageBoxManager.Ask <byte?>(dnSpy_Shared_Resources.FillSelection_Label, "0xFF", dnSpy_Shared_Resources.FillSelection_Title, s => { string error; byte b = NumberVMUtils.ParseByte(s, byte.MinValue, byte.MaxValue, out error); return(string.IsNullOrEmpty(error) ? b : (byte?)null); }, s => { string error; byte b = NumberVMUtils.ParseByte(s, byte.MinValue, byte.MaxValue, out error); return(error); }); if (res == null) { return; } dnHexBox.FillBytes(sel.Value.StartOffset, sel.Value.EndOffset, res.Value); dnHexBox.Selection = null; }
internal static void Execute() { DecompileTabState tabState; var module = GetModule(out tabState); if (module == null) { return; } var ask = new AskForInput(); ask.Owner = MainWindow.Instance; ask.Title = "Go to MD Token"; ask.label.Content = "_Metadata token"; ask.textBox.Text = ""; ask.textBox.ToolTip = "Enter an MD token: 0x06001234 or 0x0200ABCD"; ask.ShowDialog(); if (ask.DialogResult != true) { return; } string tokenText = ask.textBox.Text; tokenText = tokenText.Trim(); if (string.IsNullOrEmpty(tokenText)) { return; } string error; uint token = NumberVMUtils.ParseUInt32(tokenText, uint.MinValue, uint.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { MainWindow.Instance.ShowMessageBox(error); return; } var memberRef = module.ResolveToken(token) as IMemberRef; var member = MainWindow.ResolveReference(memberRef); if (member == null) { if (memberRef == null) { MainWindow.Instance.ShowMessageBox(string.Format("Invalid metadata token: 0x{0:X8}", token)); } else { MainWindow.Instance.ShowMessageBox(string.Format("Could not resolve member reference token: 0x{0:X8}", token)); } return; } MainWindow.Instance.JumpToReference(tabState.TextView, member); }
static int ParseInt32(string s) { string error; var v = NumberVMUtils.ParseInt32(s, int.MinValue, int.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { throw new ErrorException(error); } return(v); }
string ReadStringsHeap(int index) { var mdt = (MetaDataTableTreeNode)Parent; var tableInfo = mdt.TableInfo; var s = NumberVMUtils.ToString(mdt.MetaDataTableVM.ReadStringsHeap(ReadFieldValue(mdt.Document, tableInfo.Columns[index])), false); Debug.Assert(s.Length >= 2); if (s.Length < 2) { return(s); } return(s.Substring(1, s.Length - 2)); }
bool SelectMember(IAppCommandLineArgs args) { if (string.IsNullOrEmpty(args.SelectMember)) { return(false); } string error; uint token = NumberVMUtils.ParseUInt32(args.SelectMember, uint.MinValue, uint.MaxValue, out error); if (string.IsNullOrEmpty(error)) { var mod = GetLoadedFiles(args).FirstOrDefault(); var member = mod == null ? null : mod.ResolveToken(token); if (member == null) { return(false); } fileTabManager.FollowReference(member); return(true); } foreach (var mod in GetLoadedFiles(args)) { const string XMLDOC_NS_PREFIX = "N:"; bool isNamespace = args.SelectMember.StartsWith(XMLDOC_NS_PREFIX); if (isNamespace) { var ns = args.SelectMember.Substring(XMLDOC_NS_PREFIX.Length); var modNode = fileTabManager.FileTreeView.FindNode(mod); var nsNode = modNode == null ? null : fileTabManager.FileTreeView.FindNamespaceNode(modNode.DnSpyFile, ns); if (nsNode != null) { fileTabManager.FollowReference(nsNode); return(true); } } else { var member = XmlDocKeyProvider.FindMemberByKey(mod, args.SelectMember); if (member != null) { fileTabManager.FollowReference(member); return(true); } } } return(false); }
public override bool SetText(string newText) { string fullName = FullName; Value val = null; try { val = this.Expression.Evaluate(WindowsDebugger.DebuggedProcess); if (val.Type.IsInteger && newText.StartsWith("0x")) { try { val.PrimitiveValue = long.Parse(newText.Substring(2), NumberStyles.HexNumber); } catch (FormatException) { throw new NotSupportedException(); } catch (OverflowException) { throw new NotSupportedException(); } } else if (val.Type.FullName == typeof(string).FullName) { string error; newText = NumberVMUtils.ParseString(newText, false, out error); if (!string.IsNullOrEmpty(error)) { MainWindow.Instance.ShowMessageBox(string.Format("The string is not a valid C# string. Error: {0}", error)); return(false); } val.PrimitiveValue = newText; } else { val.PrimitiveValue = newText; } this.Text = newText; return(true); } catch (NotSupportedException) { string format = "Can not convert {0} to {1}"; string msg = string.Format(format, newText, val.Type.PrimitiveType); MainWindow.Instance.ShowMessageBox(msg); } catch (COMException) { // COMException (0x80131330): Cannot perfrom SetValue on non-leaf frames. // Happens if trying to set value after exception is breaked MainWindow.Instance.ShowMessageBox("UnknownError"); } return(false); }
void WriteStringId(BamlContext ctx, ushort id) { string str; if (id > 0x7fff) { str = ctx.KnownThings.Strings((short)-id); } else if (ctx.StringIdMap.ContainsKey(id)) { str = ctx.StringIdMap[id].Value; } else { str = null; } string reference = null; if (str != null) { reference = NumberVMUtils.ToString(str, true); } output.WriteReference(string.Format("0x{0:x4}", id), BamlToolTipReference.Create(reference), TextTokenKind.Number, true); }
static MetaDataTableRecordVM Ask(string title, MDTableContext context) { return(Shared.App.MsgBox.Instance.Ask(dnSpy_AsmEditor_Resources.GoToMetaDataTableRow_RID, null, title, s => { string error; uint rid = NumberVMUtils.ParseUInt32(s, 1, context.MetaDataTableVM.Rows, out error); if (!string.IsNullOrEmpty(error)) { return null; } return context.MetaDataTableVM.Get((int)(rid - 1)); }, s => { string error; uint rid = NumberVMUtils.ParseUInt32(s, 1, context.MetaDataTableVM.Rows, out error); if (!string.IsNullOrEmpty(error)) { return error; } if (rid == 0 || rid > context.MetaDataTableVM.Rows) { return string.Format(dnSpy_AsmEditor_Resources.GoToRowIdentifier_InvalidRowIdentifier, rid); } return string.Empty; })); }
void WriteString(string value) { string str = NumberVMUtils.ToString(value, true); output.Write(str, TextTokenKind.String); }
public static string ValueToString(object value, bool addCast) { if (value == null) { return("null"); } switch (ModelUtils.GetElementType(value.GetType())) { case ElementType.Boolean: return(NumberVMUtils.ToString((bool)value)); case ElementType.Char: return(NumberVMUtils.ToString((char)value)); case ElementType.I1: return(AddCast(NumberVMUtils.ToString((sbyte)value), addCast, value.GetType().FullName)); case ElementType.U1: return(AddCast(NumberVMUtils.ToString((byte)value), addCast, value.GetType().FullName)); case ElementType.I2: return(AddCast(NumberVMUtils.ToString((short)value), addCast, value.GetType().FullName)); case ElementType.U2: return(AddCast(NumberVMUtils.ToString((ushort)value), addCast, value.GetType().FullName)); case ElementType.I4: return(AddCast(NumberVMUtils.ToString((int)value), addCast, value.GetType().FullName)); case ElementType.U4: return(AddCast(NumberVMUtils.ToString((uint)value), addCast, value.GetType().FullName)); case ElementType.I8: return(AddCast(NumberVMUtils.ToString((long)value), addCast, value.GetType().FullName)); case ElementType.U8: return(AddCast(NumberVMUtils.ToString((ulong)value), addCast, value.GetType().FullName)); case ElementType.R4: return(AddCast(NumberVMUtils.ToString((float)value), addCast, value.GetType().FullName)); case ElementType.R8: return(AddCast(NumberVMUtils.ToString((double)value), addCast, value.GetType().FullName)); case ElementType.String: return(NumberVMUtils.ToString((string)value, true)); } if (value is TypeSig) { return(string.Format("typeof({0})", value)); } var valueType = value.GetType(); if (value is IList <bool> ) { return(ArrayToString(value, typeof(bool))); } if (value is IList <char> ) { return(ArrayToString(value, typeof(char))); } if (value is IList <sbyte> && valueType != typeof(byte[])) { return(ArrayToString(value, typeof(sbyte))); } if (value is IList <short> && valueType != typeof(ushort[])) { return(ArrayToString(value, typeof(short))); } if (value is IList <int> && valueType != typeof(uint[])) { return(ArrayToString(value, typeof(int))); } if (value is IList <long> && valueType != typeof(ulong[])) { return(ArrayToString(value, typeof(long))); } if (value is IList <byte> && valueType != typeof(sbyte[])) { return(ArrayToString(value, typeof(byte))); } if (value is IList <ushort> && valueType != typeof(short[])) { return(ArrayToString(value, typeof(ushort))); } if (value is IList <uint> && valueType != typeof(int[])) { return(ArrayToString(value, typeof(uint))); } if (value is IList <ulong> && valueType != typeof(long[])) { return(ArrayToString(value, typeof(ulong))); } if (value is IList <float> ) { return(ArrayToString(value, typeof(float))); } if (value is IList <double> ) { return(ArrayToString(value, typeof(double))); } if (value is IList <string> ) { return(ArrayToString(value, typeof(string))); } if (value is IList <TypeSig> ) { return(ArrayToString(value, typeof(Type))); } if (value is IList <object> ) { return(ArrayToString(value, typeof(object))); } return(value.ToString()); }
void WriteDefinition(string value, string def = null) { string str = NumberVMUtils.ToString(value, true); output.WriteDefinition(str, BamlToolTipReference.Create(def ?? IdentifierEscaper.Escape(value)), TextTokenKind.String, true); }
void ParseCommandLine(string[] args) { if (args.Length == 0) { throw new ErrorException(dnSpy_Console_Resources.MissingOptions); } bool canParseCommands = true; ILanguage lang = null; Dictionary <string, Tuple <IDecompilerOption, Action <string> > > langDict = null; for (int i = 0; i < args.Length; i++) { if (lang == null) { lang = GetLanguage(); langDict = CreateLanguageOptionsDictionary(lang); } var arg = args[i]; var next = i + 1 < args.Length ? args[i + 1] : null; if (arg.Length == 0) { continue; } // ********************************************************************** // If you add more '--' options here, also update 'string[] ourOptions' // ********************************************************************** if (canParseCommands && arg[0] == '-') { string error; switch (arg.Remove(0, 1)) { case "": canParseCommands = false; break; case "r": case "-recursive": isRecursive = true; break; case "o": case "-output-dir": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingOutputDir); } outputDir = next; i++; break; case "l": case "-lang": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingLanguageName); } language = next; i++; if (GetLanguage() == null) { throw new ErrorException(string.Format(dnSpy_Console_Resources.LanguageDoesNotExist, language)); } lang = null; langDict = null; break; case "-asm-path": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingAsmSearchPath); } asmPaths.AddRange(next.Split(new char[] { PATHS_SEP }, StringSplitOptions.RemoveEmptyEntries)); i++; break; case "-user-gac": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingUserGacPath); } userGacPaths.AddRange(next.Split(new char[] { PATHS_SEP }, StringSplitOptions.RemoveEmptyEntries)); i++; break; case "-no-gac": useGac = false; break; case "-no-stdlib": addCorlibRef = false; break; case "-no-sln": createSlnFile = false; break; case "-sln-name": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingSolutionName); } slnName = next; i++; if (Path.IsPathRooted(slnName)) { throw new ErrorException(string.Format(dnSpy_Console_Resources.InvalidSolutionName, slnName)); } break; case "-threads": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingNumberOfThreads); } i++; numThreads = NumberVMUtils.ParseInt32(next, int.MinValue, int.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { throw new ErrorException(error); } break; case "-vs": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingVSVersion); } i++; int vsVer; vsVer = NumberVMUtils.ParseInt32(next, int.MinValue, int.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { throw new ErrorException(error); } switch (vsVer) { case 2005: projectVersion = ProjectVersion.VS2005; break; case 2008: projectVersion = ProjectVersion.VS2008; break; case 2010: projectVersion = ProjectVersion.VS2010; break; case 2012: projectVersion = ProjectVersion.VS2012; break; case 2013: projectVersion = ProjectVersion.VS2013; break; case 2015: projectVersion = ProjectVersion.VS2015; break; default: throw new ErrorException(string.Format(dnSpy_Console_Resources.InvalidVSVersion, vsVer)); } break; case "-no-resources": unpackResources = false; break; case "-no-resx": createResX = false; break; case "-no-baml": decompileBaml = false; break; case "t": case "-type": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingTypeName); } i++; typeName = next; break; case "-md": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingMDToken); } i++; mdToken = NumberVMUtils.ParseInt32(next, int.MinValue, int.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { throw new ErrorException(error); } break; case "-gac-file": if (next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingGacFile); } i++; gacFiles.Add(next); break; case "-project-guid": if (next == null || !Guid.TryParse(next, out projectGuid)) { throw new ErrorException(dnSpy_Console_Resources.InvalidGuid); } i++; break; default: Tuple <IDecompilerOption, Action <string> > tuple; if (langDict.TryGetValue(arg, out tuple)) { bool hasArg = tuple.Item1.Type != typeof(bool); if (hasArg && next == null) { throw new ErrorException(dnSpy_Console_Resources.MissingOptionArgument); } if (hasArg) { i++; } tuple.Item2(next); break; } throw new ErrorException(string.Format(dnSpy_Console_Resources.InvalidOption, arg)); } } else { files.Add(arg); } } }
static ulong?ParseIntegerConstant(CorElementType etype, string c, out string error) { error = null; long smin, smax; ulong max; switch (etype) { case CorElementType.Boolean: smin = 0; smax = 1; max = 1; break; case CorElementType.I: if (IntPtr.Size == 4) { goto case CorElementType.I4; } goto case CorElementType.I8; case CorElementType.U: case CorElementType.Ptr: case CorElementType.FnPtr: if (UIntPtr.Size == 4) { goto case CorElementType.U4; } goto case CorElementType.U8; case CorElementType.I1: case CorElementType.U1: smin = sbyte.MinValue; smax = sbyte.MaxValue; max = byte.MaxValue; break; case CorElementType.I2: case CorElementType.U2: smin = short.MinValue; smax = short.MaxValue; max = ushort.MaxValue; break; case CorElementType.I4: case CorElementType.U4: smin = int.MinValue; smax = int.MaxValue; max = uint.MaxValue; break; case CorElementType.I8: case CorElementType.U8: smin = long.MinValue; smax = long.MaxValue; max = ulong.MaxValue; break; default: return(null); } ulong v = NumberVMUtils.ParseUInt64(c, 0, max, out error); if (string.IsNullOrEmpty(error)) { return(v); } v = (ulong)NumberVMUtils.ParseInt64(c, smin, smax, out error); if (string.IsNullOrEmpty(error)) { return(v); } return(null); }
public virtual void WriteShort(ITextOutput output, ILanguage language, bool showOffset) { language.WriteCommentBegin(output, true); output.WriteOffsetComment(this, showOffset); output.WriteDefinition(NameUtils.CleanName(Name), this, TextTokenKind.Comment); string extra = null; switch (resource.ResourceType) { case ResourceType.AssemblyLinked: extra = ((AssemblyLinkedResource)resource).Assembly.FullName; break; case ResourceType.Linked: var file = ((LinkedResource)resource).File; extra = string.Format("{0}, {1}, {2}", file.Name, file.ContainsNoMetaData ? "ContainsNoMetaData" : "ContainsMetaData", NumberVMUtils.ByteArrayToString(file.HashValue)); break; case ResourceType.Embedded: extra = string.Format(dnSpy_Shared_Resources.NumberOfBytes, ((EmbeddedResource)resource).Data.Length); break; } output.Write(string.Format(" ({0}{1}, {2})", extra == null ? string.Empty : string.Format("{0}, ", extra), resource.ResourceType, resource.Attributes), TextTokenKind.Comment); language.WriteCommentEnd(output, true); output.WriteLine(); }
public virtual void Decompile(Language language, ITextOutput output) { language.WriteComment(output, string.Empty); output.WriteOffsetComment(this); output.WriteDefinition(UIUtils.CleanUpName(Name), this, TextTokenType.Comment); string extra = null; if (r.ResourceType == ResourceType.AssemblyLinked) { extra = ((AssemblyLinkedResource)r).Assembly.FullName; } else if (r.ResourceType == ResourceType.Linked) { var file = ((LinkedResource)r).File; extra = string.Format("{0}, {1}, {2}", file.Name, file.ContainsNoMetaData ? "ContainsNoMetaData" : "ContainsMetaData", NumberVMUtils.ByteArrayToString(file.HashValue)); } else if (r.ResourceType == ResourceType.Embedded) { extra = string.Format("{0} bytes", ((EmbeddedResource)r).Data.Length); } output.Write(string.Format(" ({0}{1}, {2})", extra == null ? string.Empty : string.Format("{0}, ", extra), r.ResourceType, r.Attributes), TextTokenType.Comment); output.WriteLine(); }
public string GetPrimitiveValue(CorType type, out byte[] bytes) { bytes = null; if (type == null) { return("Internal error: CorType is null"); } if (type.IsEnum) { return(GetEnumValue(type, out bytes)); } string error; var etype = type.TryGetPrimitiveType; switch (etype) { case CorElementType.Boolean: { var value = NumberVMUtils.ParseBoolean(text, out error); if (!string.IsNullOrEmpty(error)) { return(error); } bytes = BitConverter.GetBytes(value); return(null); } case CorElementType.Char: { var value = NumberVMUtils.ParseChar(text, out error); if (!string.IsNullOrEmpty(error)) { return(error); } bytes = BitConverter.GetBytes(value); return(null); } case CorElementType.R4: { var value = NumberVMUtils.ParseSingle(text, out error); if (!string.IsNullOrEmpty(error)) { return(error); } bytes = BitConverter.GetBytes(value); return(null); } case CorElementType.R8: { var value = NumberVMUtils.ParseDouble(text, out error); if (!string.IsNullOrEmpty(error)) { return(error); } bytes = BitConverter.GetBytes(value); return(null); } case CorElementType.ValueType: if (type.IsSystemDecimal) { var value = NumberVMUtils.ParseDecimal(text, out error); if (!string.IsNullOrEmpty(error)) { return(error); } bytes = GetBytes(value); return(null); } return(null); case CorElementType.Class: return(null); case CorElementType.I: case CorElementType.U: case CorElementType.Ptr: case CorElementType.FnPtr: if (text.Trim() == "null") { bytes = new byte[IntPtr.Size]; return(null); } break; } ulong?res = ParseIntegerConstant(etype, text, out error); if (res == null) { return(error ?? "Invalid number"); } switch (etype) { case CorElementType.I1: bytes = new byte[1] { (byte)res.Value }; return(null); case CorElementType.U1: bytes = new byte[1] { (byte)res.Value }; return(null); case CorElementType.I2: bytes = BitConverter.GetBytes((short)res.Value); return(null); case CorElementType.U2: bytes = BitConverter.GetBytes((ushort)res.Value); return(null); case CorElementType.I4: bytes = BitConverter.GetBytes((int)res.Value); return(null); case CorElementType.U4: bytes = BitConverter.GetBytes((uint)res.Value); return(null); case CorElementType.I8: bytes = BitConverter.GetBytes((long)res.Value); return(null); case CorElementType.U8: bytes = BitConverter.GetBytes(res.Value); return(null); case CorElementType.I: case CorElementType.U: case CorElementType.Ptr: case CorElementType.FnPtr: if (IntPtr.Size == 4) { goto case CorElementType.I4; } goto case CorElementType.I8; } return("Unknown number type"); }