public static unsafe void Main()
        {
            int index  = 0;
            int status = 0;
            int datalen;


            string directory1 = @"C:\Program Files\SOFiSTiK\2018\SOFiSTiK 2018\interfaces\64bit";
            string directory2 = @"C:\Program Files\SOFiSTiK\2018\SOFiSTiK 2018";
            string cdbPath    = @"C:\Users\simon\Downloads\so\sof.cdb";

            // Get the path
            string path = Environment.GetEnvironmentVariable("path");

            // Set the new path environment variable + SOFiSTiK dlls path
            path = directory1 + ";" + directory2 + ";" + path;

            // Set the path variable (to read the data from CDB)
            System.Environment.SetEnvironmentVariable("path", path);

            // connect to CDB
            index = sof_cdb_init(cdbPath, 99);
            // check if sof_cdb_flush is working
            status = AccessSofData.sof_cdb_status(index);


            System.Diagnostics.Process          process   = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.FileName  = "cmd.exe";
            startInfo.Arguments = "/k echo Index:" + index;
            process.StartInfo   = startInfo;
            process.Start();

            beamForces getBeamForces = new karambaToSofistik.AccessSofistik.beamForces();

            datalen = Marshal.SizeOf(typeof(karambaToSofistik.AccessSofistik.beamForces));

            int pos = 1;

            while (sof_cdb_get(index, 102, 1, ref getBeamForces, ref datalen, pos) < 2)
            {
                if (sof_cdb_get(index, 102, 1, ref getBeamForces, ref datalen, pos) == 0)
                {
                    SofBeamForces.Add("Beam: " + getBeamForces.m_id.ToString() + " Normal Force:" + getBeamForces.m_n.ToString());
                }

                datalen = Marshal.SizeOf(typeof(karambaToSofistik.AccessSofistik.beamForces));
            }



            // use sof_cdb_flush() and sof_cdb_close()
            sof_cdb_flush(index);
            sof_cdb_close(0);   // close the CDB

            // Output the status after closing the CDB
            ////Console.WriteLine();
            ////if (sof_cdb_status(index) == 0)
            ////{
            ////    Console.WriteLine("CDB Status = 0, CDB closed succesfully");
            ////}
            ////else
            ////{
            ////    Console.WriteLine("CDB Status <> 0, the CDB doesn't closed successfully");
            ////}

            //Console.Write("Press any key to close the application...");
            //Console.ReadKey();
        }
        public static unsafe void Main(string ghpath)
        {
            SofBeamForces.Clear();
            SofBeamN.Clear();
            SofBeamMy.Clear();
            SofBeamMz.Clear();
            SofBeamVy.Clear();
            SofBeamVz.Clear();
            _status.Clear();

            int index  = 0;
            int status = 0;
            int datalen;


            string directory1 = @"C:\Program Files\SOFiSTiK\2018\SOFiSTiK 2018\interfaces\64bit";
            string cdbPath    = @ghpath;

            // Get the path
            string path = Environment.GetEnvironmentVariable("path");

            // Set the new path environment variable + SOFiSTiK dlls path
            string envPath = directory1 + ";" + path;

            // Set the path variable (to read the data from CDB)
            System.Environment.SetEnvironmentVariable("path", envPath);
            // connect to CDB
            index = sof_cdb_init(cdbPath, 99);
            // check if sof_cdb_flush is working
            status = AccessSofData.sof_cdb_status(index);
            if (status == 3)
            {
                _status.Append("Database connected.");


                cs_beam_for getBeamForces = new karambaToSofistik.AccessSofistik.cs_beam_for();
                datalen = Marshal.SizeOf(typeof(karambaToSofistik.AccessSofistik.cs_beam_for));

                int pos = 1;

                while (sof_cdb_get(index, 102, 1, ref getBeamForces, ref datalen, pos) < 2)
                {
                    if (sof_cdb_get(index, 102, 1, ref getBeamForces, ref datalen, pos) == 0)
                    {
                        if (getBeamForces.m_nr == 0)
                        {
                            SofBeamForces.Add("Superpositioned Maximum Beam Forces"
                                              + "\n\nN: " + Math.Round(getBeamForces.m_n, 3).ToString() + " kN "
                                              + "\nMy: " + Math.Round(getBeamForces.m_my, 3).ToString() + " kNm "
                                              + "\nMz: " + Math.Round(getBeamForces.m_mz, 3).ToString() + " kNm "
                                              + "\nVy: " + Math.Round(getBeamForces.m_vy, 3).ToString() + " kN "
                                              + "\nVz: " + Math.Round(getBeamForces.m_vz, 3).ToString() + " kN \n");
                        }
                        else
                        {
                            SofBeamForces.Add("Beam: " + (getBeamForces.m_nr - 1).ToString() //Convert beam number back to Karamba
                                              + "\n\nN: " + Math.Round(getBeamForces.m_n, 3).ToString() + " kN "
                                              + "\nMy: " + Math.Round(getBeamForces.m_my, 3).ToString() + " kNm "
                                              + "\nMz: " + Math.Round(getBeamForces.m_mz, 3).ToString() + " kNm "
                                              + "\nVy: " + Math.Round(getBeamForces.m_vy, 3).ToString() + " kN "
                                              + "\nVz: " + Math.Round(getBeamForces.m_vz, 3).ToString() + " kN \n");

                            SofBeamN.Add(getBeamForces.m_n);
                            SofBeamVy.Add(getBeamForces.m_vy);
                            SofBeamVz.Add(getBeamForces.m_vz);
                            SofBeamMy.Add(getBeamForces.m_my);
                            SofBeamMz.Add(getBeamForces.m_mz);
                        }
                    }

                    datalen = Marshal.SizeOf(typeof(karambaToSofistik.AccessSofistik.cs_beam_for));
                }
                _status.Append("\nBeam forces extracted.");
            }
            else if (status == 4)
            {
                _status.Append("\nCalculating... Database is locked.");
            }
            else
            {
                _status.Append("\nDatabase not connected...");
            }



            // use sof_cdb_flush() and sof_cdb_close()
            sof_cdb_flush(index);
            sof_cdb_close(0);                                        // close the CDB

            System.Environment.SetEnvironmentVariable("path", null); //Delete environment variables

            _status.Append("\nDatabase closed.");

            // Output the status after closing the CDB
            ////Console.WriteLine();
            ////if (sof_cdb_status(index) == 0)
            ////{
            ////    Console.WriteLine("CDB Status = 0, CDB closed succesfully");
            ////}
            ////else
            ////{
            ////    Console.WriteLine("CDB Status <> 0, the CDB doesn't closed successfully");
            ////}

            //Console.Write("Press any key to close the application...");
            //Console.ReadKey();
        }