private void AsynchAddLineToLog( String line) { if (AddLine == null) AddLine = new AddLineDelegate(AddLineToLog); if (log != null) { log.WriteLine(line); } mLogText.BeginInvoke(AddLine, line); }
private void AsynchAddLineToLog(String line) { if (AddLine == null) { AddLine = new AddLineDelegate(AddLineToLog); } if (log != null) { log.WriteLine(line); } mLogText.BeginInvoke(AddLine, line); }
public LogViewer(EmuDebugger debugger) : this() { this.Debugger = debugger; string[] names = Enum.GetNames(typeof(Feature)); _features = new FeatureInfo[names.Length]; foreach (string name in names) { FeatureInfo feature = new FeatureInfo(name); int value = ( int )Enum.Parse(typeof(Feature), name); _features[value] = feature; } Log.Instance = this; _addLine = new AddLineDelegate(this.AddLine); listView_Resize(this, EventArgs.Empty); criticalToolStripMenuItem.ForeColor = Color.DarkRed; verboseToolStripMenuItem.ForeColor = Color.DarkGreen; everythingToolStripMenuItem.ForeColor = Color.Blue; _lines = new List <ListViewItem>(10000); if ((System.Diagnostics.Debugger.IsAttached == true) && (System.Diagnostics.Debugger.IsLogging() == true)) { _debugEnabled = true; } else { _debugEnabled = false; } debugWriteToolStripButton.Visible = _debugEnabled; toolStripSeparator3.Visible = _debugEnabled; Bitmap image = Properties.Resources.OutputIcon as Bitmap; this.Icon = Icon.FromHandle(image.GetHicon()); this.LoadSettings(); this.Refilter(); }
public LogViewer( EmuDebugger debugger ) : this() { this.Debugger = debugger; string[] names = Enum.GetNames( typeof( Feature ) ); _features = new FeatureInfo[ names.Length ]; foreach( string name in names ) { FeatureInfo feature = new FeatureInfo( name ); int value = ( int )Enum.Parse( typeof( Feature ), name ); _features[ value ] = feature; } Log.Instance = this; _addLine = new AddLineDelegate( this.AddLine ); listView_Resize( this, EventArgs.Empty ); criticalToolStripMenuItem.ForeColor = Color.DarkRed; verboseToolStripMenuItem.ForeColor = Color.DarkGreen; everythingToolStripMenuItem.ForeColor = Color.Blue; _lines = new List<ListViewItem>( 10000 ); if( ( System.Diagnostics.Debugger.IsAttached == true ) && ( System.Diagnostics.Debugger.IsLogging() == true ) ) { _debugEnabled = true; } else { _debugEnabled = false; } debugWriteToolStripButton.Visible = _debugEnabled; toolStripSeparator3.Visible = _debugEnabled; Bitmap image = Properties.Resources.OutputIcon as Bitmap; this.Icon = Icon.FromHandle( image.GetHicon() ); this.LoadSettings(); this.Refilter(); }
// Test a given script path for being a singleton // Returns whether the script was indeed a singleton and was changed public static bool TestScript(string path) { var file = new FileInfo(path); // Find the monoscript associated with this script var monoscript = AssetDatabase.LoadAssetAtPath(path, typeof(MonoScript)) as MonoScript; if (monoscript == null) { // Not an indexed script, can't be the singleton root class return(false); } var classType = monoscript.GetClass(); if (classType == null) { //Not supported by unity (probably a generic) return(false); } if (!typeof(SerializedSingletonBase).IsAssignableFrom(classType)) { // isn't a singleton return(false); } List <string> namespaces = new List <string>(); using (StreamReader sr = new StreamReader(path)) { string line; bool commentedOut; while ((line = sr.ReadLine()) != null) { int usingInd = line.LastIndexOf("using"); if (usingInd != -1) { int semicolonInd = line.LastIndexOf(';'); if (semicolonInd == -1) { continue; } int start = usingInd + 6; int end = semicolonInd - start; namespaces.Add(line.Substring(usingInd + 6, end)); } } } if (!namespaces.Contains("System")) { namespaces.Add("System"); } // Generate filename for _Instance class file = new FileInfo( path.Substring(0, path.Length - file.Extension.Length) + "_Instance" + file.Extension ); // Get all static fields on the singleton var fields = classType.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); // Build the _Instance class var builder = new StringBuilder(); int tab = 0; AddLineDelegate addLine = (text) => { for (int i = 0; i < tab; i++) { builder.Append("\t"); } foreach (var s in text) { builder.Append(s.ToString()); } builder.Append("\n"); }; foreach (var n in namespaces) { addLine("using " + n + ";"); } addLine(); addLine("public partial class ", classType.Name); addLine("{"); addLine(); tab++; foreach (var field in fields) { if (field.IsNotSerialized) { continue; } addLine("[SerializeField]"); addLine(field.FieldType.Name, " _", field.Name, ";"); addLine(); } tab--; addLine("}"); // Compile builder var fileData = builder.ToString(); // Nothing has changed, no need to recompile! if (File.Exists(file.FullName) && File.ReadAllText(file.FullName) == fileData) { return(false); } // Write out to the file File.WriteAllText(file.FullName, builder.ToString()); // And return that something has changed return(true); }
public void Addline(ChatWindow cw, string sUser, string sMessage) { AddLineDelegate handler = new AddLineDelegate(AddLineHandler); Factory.MainForm.BeginInvoke(handler, new object[] { cw, sUser, sMessage }); }
public void Addline(ChatWindow cw, string sUser, string sMessage) { AddLineDelegate handler = new AddLineDelegate(AddLineHandler); Factory.MainForm.BeginInvoke(handler, new object[] {cw, sUser, sMessage}); }
private void LineaFactura_Load(object sender, EventArgs e) { globalFacturas = new GlobalFacturas(); globalFacturas.Show(); addLineEvent += AddLineHandler; }