public static void SaveReport(string unparsed)
        {
            string sReportFile = Path.Combine(Path.GetTempPath(), $"{BPSUtilities.GetARandomString(8, "abcdefghijklmnopqrstuvwxyz")}.rpt");

            try
            {
                Bentley.DgnPlatformNET.ConfigurationManager.WriteActiveConfigurationSummary(sReportFile);
            }
            catch (Exception ex)
            {
                BPSUtilities.WriteLog("Error: {0}\n{1}", ex.Message, ex.StackTrace);
            }

            if (File.Exists(sReportFile))
            {
                StringBuilder sbDSN = new StringBuilder(1024);

                bool bCheckPW = false;

                if (PWWrapper.aaApi_GetActiveDatasourceName(sbDSN, sbDSN.Capacity))
                {
                    bCheckPW = true;
                }

                DataSet ds = new DataSet();
                ds.Tables.Add(new DataTable("ConfigurationVariables"));

                ds.Tables[0].Columns.Add(new DataColumn("Name", typeof(string)));
                ds.Tables[0].Columns.Add(new DataColumn("Level", typeof(string)));
                ds.Tables[0].Columns.Add(new DataColumn("Value", typeof(string)));
                ds.Tables[0].Columns.Add(new DataColumn("ExpandedValue", typeof(string)));
                ds.Tables[0].Columns.Add(new DataColumn("InvalidPWPaths", typeof(string)));

                SortedList <string, int> slVariableLevels = new SortedList <string, int>()
                {
                    { "Application", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.Application },
                    { "Predefined", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.Predefined },
                    { "Organization", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.Organization },
                    { "WorkSpace", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.WorkSpace },
                    { "System Environment", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.SystemEnvironment },
                    { "System", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.System },
                    { "User", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.User },
                    { "WorkSet", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.WorkSet },
                    { "Role", (int)Bentley.DgnPlatformNET.ConfigurationVariableLevel.Role }
                };

                using (StreamReader sr = new StreamReader(sReportFile))
                {
                    while (!sr.EndOfStream)
                    {
                        string sLine = sr.ReadLine();

                        if (sLine.StartsWith("%level"))
                        {
                            DataRow dr = ds.Tables[0].NewRow();

                            string[] sSplits = sLine.Split(new string[1] {
                                "  "
                            }, StringSplitOptions.RemoveEmptyEntries);

                            if (sSplits.Length > 1)
                            {
                                dr["Level"] = sSplits[1];

                                string sLine2 = sr.ReadLine();

                                string[] sSplits2 = sLine2.Split(new string[1] {
                                    " = "
                                }, StringSplitOptions.RemoveEmptyEntries);

                                if (sSplits2.Length > 1)
                                {
                                    dr["Name"]  = sSplits2[0].Trim();
                                    dr["Value"] = sSplits2[1].Trim();

                                    string sExpandedValue = string.Empty;

                                    if (slVariableLevels.ContainsKey(sSplits[1]))
                                    {
                                        sExpandedValue = Bentley.DgnPlatformNET.ConfigurationManager.GetVariable(sSplits2[0].Trim(),
                                                                                                                 (Bentley.DgnPlatformNET.ConfigurationVariableLevel)slVariableLevels[sSplits[1]]);
                                    }
                                    else
                                    {
                                        sExpandedValue = Bentley.DgnPlatformNET.ConfigurationManager.GetVariable(sSplits2[0].Trim());
                                    }

                                    dr["ExpandedValue"] = sExpandedValue;

                                    if (sExpandedValue.Contains("pw:") && bCheckPW)
                                    {
                                        string[] sSplits3 = sExpandedValue.Split(";".ToCharArray());

                                        SortedList <string, string> slUniqueValues = new SortedList <string, string>();

                                        foreach (string sSplit in sSplits3)
                                        {
                                            slUniqueValues.AddWithCheck(sSplit, sSplit);
                                        }

                                        StringBuilder sbInvalidPaths = new StringBuilder();

                                        foreach (string de in slUniqueValues.Keys)
                                        {
                                            if (de.ToLower().StartsWith("pw:"))
                                            {
                                                if (GetFolderNo(de.ToString()) < 1)
                                                {
                                                    if (sbInvalidPaths.Length > 0)
                                                    {
                                                        sbInvalidPaths.Append(";");
                                                    }

                                                    sbInvalidPaths.Append(de);
                                                }
                                            }
                                        }

                                        dr["InvalidPWPaths"] = sbInvalidPaths.ToString();
                                    }

                                    ds.Tables[0].Rows.Add(dr);
                                }
                            }
                        }
                    } // for each pair of lines in the file
                }

                if (!string.IsNullOrEmpty(unparsed))
                {
                    if (!unparsed.ToLower().EndsWith(".xlsx"))
                    {
                        unparsed += ".xlsx";
                    }
                }
                else
                {
                    SaveFileDialog dlg = new SaveFileDialog();
                    dlg.Title        = "Select Configuration File Report Output Location";
                    dlg.Filter       = "XLSX Files|*.xlsx|All Files|*.*";
                    dlg.DefaultExt   = ".xlsx";
                    dlg.AddExtension = true;

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        unparsed = dlg.FileName;
                    }
                }

                if (ds.Tables[0].Rows.Count > 0 && !string.IsNullOrEmpty(unparsed))
                {
                    try
                    {
                        XLSXDataSetTools.DataSetToXLSXFast(ds, unparsed);

                        if (File.Exists(unparsed))
                        {
                            MessageBox.Show($"Wrote '{unparsed}'", "SetPWVarsCE");
                        }
                    }
                    catch (Exception ex)
                    {
                        BPSUtilities.WriteLog($"{ex.Message}\n{ex.StackTrace}");
                        MessageBox.Show($"Error writing '{unparsed}'", "SetPWVarsCE");
                    }
                }
            }
        }
        public CreatePolyhedronX64(int toolId, int prompt, string sPolyhedronName) : base(toolId, prompt)
        {
            try
            {
                // m_points = new List<DPoint3d>();

                PolyhedronName = sPolyhedronName;

                // string sXMLFileName = string.Empty;

                BPSUtilities.WriteLog($"CreatePolyhedronX64 Initialized '{PolyhedronName}'");

                string sOutputXML2 = Path.Combine(Path.GetTempPath(), $"{BPSUtilities.GetARandomString(8, BPSUtilities.LOWER_CASE)}.xml");

                if (PolyhedraCE.ListOfPolyhedra.Count == 0)
                {
                    string sOutputXML = Path.Combine(Path.GetTempPath(), $"{BPSUtilities.GetARandomString(8, BPSUtilities.LOWER_CASE)}.xml");

                    try
                    {
                        System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();

                        foreach (string sResName in thisExe.GetManifestResourceNames())
                        {
                            if (sResName.ToLower().EndsWith(".polyhedra.xml"))
                            {
                                using (var resourceStream = thisExe.GetManifestResourceStream(sResName))
                                {
                                    resourceStream.CopyTo(new System.IO.FileStream(sOutputXML, FileMode.Create));
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        BPSUtilities.WriteLog($"{ex.Message}\n{ex.StackTrace}");
                    }

                    File.Copy(sOutputXML, sOutputXML2);

                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.Load(sOutputXML2);

                        XmlNode root = xmlDoc.DocumentElement;

                        // need form to list available polyhedra

                        XmlNodeList nodeList = root.SelectNodes(".//polyhedron");

                        List <string> listPolyhedrons = new List <string>();

                        foreach (XmlNode node in nodeList)
                        {
                            string sPolyName = node.Attributes["name"].Value;
                            listPolyhedrons.Add(sPolyName);
                        }

                        foreach (string sPolyName in listPolyhedrons)
                        {
                            try
                            {
                                BPSUtilities.WriteLog($"Processing '{sPolyName}'...");

                                Bentley.DgnPlatformNET.Elements.Element elm = SetPolyhedron(sPolyName, sOutputXML2);

                                if (elm != null)
                                {
                                    PolyhedraCE.ListOfPolyhedra.AddWithCheck(sPolyName, elm);
                                    // elm.AddToModel();
                                    BPSUtilities.WriteLog($"Added '{sPolyName}'");
                                }
                                else
                                {
                                    BPSUtilities.WriteLog($"Error creating '{sPolyName}'");
                                }
                            }
                            catch (Exception ex)
                            {
                                BPSUtilities.WriteLog($"{ex.Message}\n{ex.StackTrace}");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        BPSUtilities.WriteLog($"{ex.Message}\n{ex.StackTrace}");
                    }
                }
                else
                {
                }

                BPSUtilities.WriteLog($"List contains {PolyhedraCE.ListOfPolyhedra.Count} entries.");

                BPSUtilities.WriteLog($"CreatePolyhedronX64: Dynamics {(this.DynamicsStarted ? "is" : "is not")} started.");
            }
            catch (Exception ex)
            {
                BPSUtilities.WriteLog($"CreatePolyhedronX64 {ex.Message}\n{ex.StackTrace}");
            }
        }