protected override void DoCommandAction() { // reset PRIOR to reading otherwise high lighter in gui might crash CommandExecuter.Instance.Execute(new Reset()); GZipStream gz = null; bool decompress = false; //Opens a file and deserialize it into FPGA.FPGA.Instance StreamDecorator stream = new StreamDecorator(FileName, this); BinaryFormatter formatter = new BinaryFormatter(); try { FPGA.FPGA.Instance = (FPGA.FPGA)formatter.Deserialize(stream); } catch (Exception) { // upon error try to decompress stream.Position = 0; decompress = true; gz = new GZipStream(stream, CompressionMode.Decompress); FPGA.FPGA.Instance = (FPGA.FPGA)formatter.Deserialize(gz); } finally { if (!decompress) { stream.Close(); } else { gz.Close(); stream.Close(); } } FPGA.FPGA.Instance.DoPostSerializationTasks(); CommandExecuter.Instance.Execute(new Reset()); CommandExecuter.Instance.Execute(new GC()); // no LoadFPGAFamilyScript here! LoadFPGAFamilyScript is called through Reset // remember for other stuff how we read in this FPGA Blackboard.Instance.LastLoadCommandForFPGA = ToString(); // familiy related warnings if (FPGA.FPGA.Instance.Family == FPGATypes.FPGAFamily.Spartan6 && FPGA.FPGA.Instance.GetAllTiles().Count(t => t.HasNonstopoverBlockedPorts) == 0) { OutputManager.WriteWarning("There are no tiles with bidirectional wires excluded from blocking"); OutputManager.WriteWarning("Consider using ExcludePipsToBidirectionalWiresFromBlocking for avoiding RUGs"); } // Reset tcl context TclAPI.ResetContext(); }
public static unsafe int ClearContext(IntPtr clientData, IntPtr interp, int objc, IntPtr *argv) { if (objc == 1) { TclAPI.ResetContext(); GUI.ConsoleCtrl.TCLTerminal_output.AppendText("'clearcontext' was executed manually." + NL + "Warning: your existing TCL variables pointing to C# objects will no longer hold a correct reference." + NL, System.Drawing.Color.OrangeRed);; return(0); } return(1); }