public void SetUp() { EngineCallbackStub callback = new EngineCallbackStub( new [] { "mscorlib", "System", "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" }, new string[0] ); IIdeEngine engine = EngineFactory.Create(callback, new TraceWriter(), false); }
internal static GotoInfo[] GenerateSource(GotoInfo[] infos, IIdeEngine engine, out string captiopn) { Debug.Assert(infos != null && infos.Length == 1, "GenerateSource lacks required parameter"); GotoInfo info = infos[0]; Debug.Assert(info != null && info.MemberInfo != null, "GenerateSource lacks required parameter"); MemberInfo mi = info.MemberInfo; Type type = (mi.MemberType == MemberTypes.TypeInfo || mi.MemberType == MemberTypes.NestedType) ? (Type)mi : mi.DeclaringType; captiopn = type.Name + "[from metadata]"; Debug.WriteLineIf(TS.TraceVerbose, string.Format("Generating source for ({0})", type.FullName), TS.DisplayName); string tempFileName = string.Format("{0}{1}${2}v{3}${4}.n", Path.GetTempPath(), type.FullName, Path.GetFileName(info.FilePath), type.Assembly.GetName().Version, Process.GetCurrentProcess().Id); string text = null; if (File.Exists(tempFileName)) { text = File.ReadAllText(tempFileName, Encoding.UTF8); } GotoInfo[] resulr = new GotoInfo[0]; var fileIndex = Location.GetFileIndex(tempFileName); using (TextWriter w = new StringWriter()) { resulr = new GotoInfo[] { engine.GenerateCode(info.Member, fileIndex, w) }; var newText = w.ToString(); var needSave = text == null || !string.Equals(newText, text, StringComparison.Ordinal); if (needSave) { if (text != null) { File.SetAttributes(tempFileName, FileAttributes.Normal); } File.WriteAllText(tempFileName, newText, Encoding.UTF8); File.SetAttributes(tempFileName, FileAttributes.ReadOnly | FileAttributes.Temporary); } } return(resulr); }
internal static GotoInfo[] GenerateSource(GotoInfo[] infos, IIdeEngine engine, out string captiopn) { Debug.Assert(infos != null && infos.Length == 1, "GenerateSource lacks required parameter"); GotoInfo info = infos[0]; Debug.Assert(info != null && info.MemberInfo != null, "GenerateSource lacks required parameter"); MemberInfo mi = info.MemberInfo; Type type = (mi.MemberType == MemberTypes.TypeInfo || mi.MemberType == MemberTypes.NestedType) ? (Type)mi : mi.DeclaringType; captiopn = type.Name + "[from metadata]"; Debug.WriteLineIf(TS.TraceVerbose, string.Format("Generating source for ({0})", type.FullName), TS.DisplayName); string tempFileName = string.Format("{0}{1}${2}v{3}${4}.n", Path.GetTempPath(), type.FullName, Path.GetFileName(info.FilePath), type.Assembly.GetName().Version, Process.GetCurrentProcess().Id); string text = null; if (File.Exists(tempFileName)) text = File.ReadAllText(tempFileName, Encoding.UTF8); GotoInfo[] resulr = new GotoInfo[0]; var fileIndex = Location.GetFileIndex(tempFileName); using (TextWriter w = new StringWriter()) { resulr = new GotoInfo[] { engine.GenerateCode(info.Member, fileIndex, w) }; var newText = w.ToString(); var needSave = text == null || !string.Equals(newText, text, StringComparison.Ordinal); if (needSave) { if (text != null) File.SetAttributes(tempFileName, FileAttributes.Normal); File.WriteAllText(tempFileName, newText, Encoding.UTF8); File.SetAttributes(tempFileName, FileAttributes.ReadOnly | FileAttributes.Temporary); } } return resulr; }
public HighlightingLexer(IIdeEngine engine, string code) : base((ManagerClass)engine, /*fileIndex*/ 0, code, /*storeComments*/ true) { }
public bool IsDefaultEngine(IIdeEngine engine) { return engine == DefaultEngine; }
public bool IsDefaultEngine(IIdeEngine engine) { return(engine == DefaultEngine); }