Ejemplo n.º 1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine($"Netlist: {NetList}");
            sb.AppendLine("Transistor");
            sb.AppendLine(
                $"  Vtn: (Threshold, Sigma, NumberOfSigma) {string.Join(", ", Vtn.Split('_').Where((_, i) => i % 2 == 1).Select(x => decimal.Parse(x, NumberStyles.Float)))}");
            sb.AppendLine(
                $"  Vtp: (Threshold, Sigma, NumberOfSigma) {string.Join(", ", Vtp.Split('_').Where((_, i) => i % 2 == 1).Select(x => decimal.Parse(x, NumberStyles.Float)))}");

            sb.AppendLine("Includes");
            foreach (var s in Includes.Split(':'))
            {
                sb.AppendLine($"  - {s}");
            }

            sb.AppendLine("Signals");
            foreach (var signal in Signals.Split(':'))
            {
                sb.AppendLine($"  - {signal}");
            }

            sb.AppendLine($"Simulation Time: {Time}");

            sb.AppendLine($"Temperature: {Temperature}");
            sb.AppendLine($"Voltage: \n  VDD: {Vdd}\n  GND: {Gnd}");
            sb.AppendLine($".IC");
            foreach (var s in IcCommand.Split(':'))
            {
                sb.AppendLine($"  - {s}");
            }

            sb.AppendLine("Hspice");
            sb.AppendLine($"  Path:    {Hspice}");
            sb.AppendLine($"  Options: {HspiceOption}");

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        private void _buildAndExecuteCode(object sender, EventArgs e)
        {
            wwScripting wwScript = null;

            try
            {
                //log.Info("User Context Code is running under: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);

                wwScript = new wwScripting(Language);
                wwScript.lSaveSourceCode = false;

                //TODO: figure out how to add these from the GAC or by relative path
                //It looks like we have to use a file path: http://www.databaseforum.info/25/860284.aspx
                //however GAC does have a file path behind it (i.e. C:\Windows\assembly\GAC_MSIL\wwScripting\1.0.4486.26865__e7bb1946e9e55389\wwScripting.dll)
                wwScript.cSupportAssemblyPath = "C:\\Installs\\";
                Environment.CurrentDirectory  = System.IO.Path.GetTempPath();

                //TODO: fix wwScript.dll to get AppDomains working: currently fails on 371 of the
                //CreateInstance method because the RemoteLoader dll cant be found, will need to
                //change reference to use full assembly name, ie. RemoteLoader, Version=1.0.4406.26870, Culture=neutral, PublicKeyToken=739e02ea3855a61b
                //to pull it from the GAC.  I have already signed them for a strong name and put them there
                wwScript.CreateAppDomain("Insight.FIM.Workflow.CustomCode");  // force into AppDomain

                //loScript.AddAssembly("system.windows.forms.dll", "System.Windows.Forms");
                //loScript.AddAssembly("system.web.dll","System.Web");
                //wwScript.AddNamespace("System.Net");
                foreach (string ns in Includes.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    //log.Info("Adding namespace: " + ns);
                    if (!string.IsNullOrEmpty(ns.Trim()))
                    {
                        wwScript.AddNamespace(ns.Trim());
                    }
                }

                foreach (string a in Assemblies.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    //log.Info("Adding assembly: " + a);
                    if (!string.IsNullOrEmpty(a.Trim()))
                    {
                        wwScript.AddAssembly(a.Trim());
                    }
                }

                //user is passing in a return type, do we need to perform
                //some conversion here - No, we dont.  we just need to pass the
                //type on to the ChangeAttributeCodeActivity
                //what if we want to return a multi-value/array?
                CodeReturnValue = (string)wwScript.ExecuteCode(Code, paramArrayResolved);

                if (wwScript.bError)
                {
                    throw new Exception("Error from wwScript - " + wwScript.cErrorMsg);
                }

                log.Debug("Custom code execution complete.  Return value: " + CodeReturnValue);
            }
            catch (Exception ex)
            {
                log.Error("An exception occured while executing the custom code.  Details: " + ex.ToString());

                if (ex.InnerException != null)
                {
                    log.Error("InnerException: " + ex.InnerException.ToString());
                }

                throw;
            }
            finally
            {
                if (wwScript != null)
                {
                    wwScript.Dispose();
                }
            }
        }