private void AdjustConstForType(ReferenceNode node, TypeInfo type) { DAGNode n = node; while (n is ReferenceNode) { n = n.NextNodes[0]; } if (n is LeafNode && n.Data.Length > 0 && (char.IsDigit(n.Data[0]) || n.Data[0] == '.' || n.Data[0] == '-')) { long v = 0; double dv = 0.0; if (n.Data.IndexOf('.') >= 0) { dv = ConstUtility.ParseDouble(n.Data); v = (long)dv; } else { v = ConstUtility.ParseLong(n.Data); dv = (double)v; } n.Data = ConstUtility.ConstToString(type, v, dv); } }
private string AdjustGoto(IlIns il, bool isDecompile) { long lv = IlIns.LabelToValue(il.Value); string label = null; if (switchBlocks.ContainsKey(lv)) { FlowGraphNode gnode = switchBlocks[lv]; DAGNode dnode = switchExpressions[gnode.EndLabelValue]; while (dnode is ReferenceNode) { dnode = dnode.NextNodes[0]; } if (dnode is LeafNode) { DAGNode r = GetVarReference(dnode.Data); if (r != null) { int v = (int)ConstUtility.ParseLong(r.Data); IlIns switchIl = ilLines[gnode.EndLabelValue]; SwitchOperand op = switchIl.Operand as SwitchOperand; if (v >= 0 && v < op.Labels.Count) { label = op.Labels[v]; lv = IlIns.LabelToValue(op.Labels[v]); } } } } string label2 = AdjustGoto(il.LabelValue, lv, isDecompile); if (label2 != null) { return(label2); } else if (label != null) { return(label); } return(null); }