private void NewRow(string desc, string propertyName, FormatMethod fm, HorizontalAlign cellAlign) { TableRow row = this.NewRow(); row.CssClass = "tdbg"; row.Cells.Add(NewTitleCell(desc)); for (int i = 0; i < this.ProductInfoList.Count; i++) { ProductDetailInfo info = this.ProductInfoList[i]; string name = string.Empty; if (fm != null) { name = fm(info); } else { MethodInfo method = info.GetType().GetMethod("get_" + propertyName); if (method != null) { name = Convert.ToString(method.Invoke(info, null)); } } TableCell cell = NewCell(name); cell.HorizontalAlign = cellAlign; row.Cells.Add(cell); } this.TbProduct.Rows.Add(row); }
public TagDescription(TagGroupDescription group, string name, string description, Type datatype, int key, FormatMethod formatMethod) { this.group = group; this.name = name; this.description = description; this.datatype = datatype; this.key = key; this.formatMethod = formatMethod; }
static string FormatCodeWithRoslyn(string code, ref int pos, string file) { try { if (RoslynFormat == null) { //need to load dynamically as static loading can only be achieved via compilation and plugin target CLR is older than //the one is Roslyn based on. string rootDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var asmFile = Roslyn.LocateInPluginDir("RoslynIntellisense.exe", "Roslyn", @".\"); var asm = Assembly.LoadFrom(asmFile); MethodInfo method; if (Config.Instance.HybridFormatting) { method = asm.GetType("RoslynIntellisense.Formatter").GetMethod("FormatHybrid"); } else { method = asm.GetType("RoslynIntellisense.Formatter").GetMethod("Format"); } RoslynFormat = (FormatMethod)Delegate.CreateDelegate(typeof(FormatMethod), method); } if (RoslynFormat != null) { var newCode = RoslynFormat(code, file); pos = SyntaxMapper.MapAbsPosition(code, pos, newCode); return(newCode); } } catch (Exception e) { #if !DEBUG Config.Instance.RoslynFormatting = false; Config.Instance.Save(); #endif MessageBox.Show("Cannot use Roslyn Formatter.\nError: " + e.Message + "\n\nThis can be caused by the absence of .NET 4.6.\n\nRoslyn Formatter will be disabled and the default formatter enabled instead. You can always reenable RoslynFormatter from the settings dialog.", "CS-Script"); } return(code); }
private void DecryptRadio_CheckedChanged(object sender, EventArgs e) { FormatMethod = FormatMethod.Decrypt; OutputTextBox.Clear(); }
public TextFormatter(ITextWorker TextWorker, FormatMethod formatMethod) { this.TextWorker = TextWorker; this.formatMethod = formatMethod; }
private static void addToDictionary(TagGroupDescription group, int key, string name, string description, Type datatype, FormatMethod formatMethod) { TagDescription td = new TagDescription(group, name, description, datatype, key, formatMethod); Tags.Add(td.Fullname, td); }
private void NewRow(string desc, string propertyName, FormatMethod fm) { this.NewRow(desc, propertyName, fm, HorizontalAlign.Center); }