示例#1
0
        private void tbExecute_Click(object sender, System.EventArgs e)
        {
            // --- Create the Geosoft System ---
            CGX_NET pGeo = new CGX_NET("OMScript", "1.0", 0, this, 0);

            if (pGeo != null)
            {
                // --- Is this a GX or a GS ? ---
                // --- Run the GX or Script ---
                string cmd = tbCmd.Text.ToUpper();

                if (cmd.EndsWith(".GX"))
                {
                    CSYS.iRunGX(cmd);
                }
                else
                {
                    CSYS.iRunGS(cmd);
                }


                // --- Cleanup The Geosoft Object ---

                CGX_NET.ShowError();


                // --- Cleanup ---

                pGeo.Dispose();
            }
        }
示例#2
0
        internal void Load(string strSecureToken)
        {
            string strDir = string.Empty;


            CSYS.IGetDirectory(GXNet.Constant.SYS_DIR_USER, ref strDir);
            m_strCSV = System.IO.Path.Combine(strDir, "csv\\Dap_Servers.xml");

            if (!System.IO.File.Exists(m_strCSV))
            {
                string strTemp;

                CSYS.IGetDirectory(GXNet.Constant.SYS_DIR_GEOSOFT, ref strDir);
                strTemp = System.IO.Path.Combine(strDir, "csv\\Dap_Servers.xml");


                // --- Copy file to user directory ---

                if (System.IO.File.Exists(strTemp))
                {
                    System.IO.File.Copy(strTemp, m_strCSV, true);
                }
            }

            UpgradeList();
            LoadInternal(strSecureToken);
        }
示例#3
0
        public int Run()
        {
            DialogResult Result = DialogResult.OK;

            try
            {
                // Initialize the form
                InitializeForm();

                // Are we running interactively?

                if (CSYS.iInteractive() != 0)
                {
                    Result = ShowDialog();
                }
                else
                {
                    ini.RefreshControls();
                }
            }
            catch (ApplicationException e)
            {
                // An empty message indicates a CSYS.Cancel()
                if (e.Message.Length > 0)
                {
                    ShowErrorAndExit(e.Message);
                }
                else
                {
                    Result = DialogResult.Cancel;
                }
            }
            catch (Exception e)
            {
                ShowErrorAndExit(CreateGXFailureMessage(e.Message));
            }

            if (Result == DialogResult.OK)
            {
                try
                {
                    Execute();
                    return(0);
                }
                catch (Exception e)
                {
                    // An empty message indicates a cancel
                    if (e.Message.Length > 0)
                    {
                        ShowErrorAndExit(e.Message);
                    }
                }
            }
            return(1);
        }
示例#4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (!bValidateDialog())
         {
             // This to not close the dialog
             DialogResult = DialogResult.None;
             return;
         }
         ini.SyncDiskToMatchCurrentControls();
     }
     catch (Exception ex)
     {
         // Show errors and clear it so that it will not present again on GX exit
         if (ex.Message.Length > 0)
         {
             MessageBox.Show(ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         CSYS.iClearErrAP();
         // This to not close the dialog
         DialogResult = DialogResult.None;
     }
 }
示例#5
0
        public void FillComboBoxes()
        {
            // --- For 8.5 restrict larger page sizes to a select "in" group ---

            bool bigData = (CSYS.iInteractive() == 0) || (CSYS.iGetInt(ini.GroupName, _n("PAGESIZE")) > 16384);

            // --- In the following two controls, the "Value" part
            //     is the pagesize; the two controls are locked together ---

            m_cbMaxDataPerChan.AddItem(_("4 Megabytes"), 64);
            m_cbMaxDataPerChan.AddItem(_("8 Megabytes"), 128);
            m_cbMaxDataPerChan.AddItem(_("16 Megabytes"), 256);
            m_cbMaxDataPerChan.AddItem(_("32 Megabytes"), 512);
            m_cbMaxDataPerChan.AddItem(_("64 Megabytes (Standard)"), 1024);
            m_cbMaxDataPerChan.AddItem(_("128 Megabytes"), 2048);
            m_cbMaxDataPerChan.AddItem(_("256 Megabytes"), 4096);
            m_cbMaxDataPerChan.AddItem(_("512 Megabytes"), 8192);
            m_cbMaxDataPerChan.AddItem(_("1 Gigabyte"), 16384);
            if (bigData)
            {
                m_cbMaxDataPerChan.AddItem(_("2 Gigabytes"), 32768);
                m_cbMaxDataPerChan.AddItem(_("4 Gigabytes"), 65536);
                m_cbMaxDataPerChan.AddItem(_("8 Gigabytes"), 131072);
                m_cbMaxDataPerChan.AddItem(_("16 Gigabytes"), 262144);
                m_cbMaxDataPerChan.AddItem(_("32 Gigabytes"), 524288);
                m_cbMaxDataPerChan.AddItem(_("64 Gigabytes"), 1048576);
            }

            m_cbMaxData.AddItem(_("256 Gigabytes"), 64);
            m_cbMaxData.AddItem(_("512 Gigabytes"), 128);
            m_cbMaxData.AddItem(_("1 Terabyte"), 256);
            m_cbMaxData.AddItem(_("2 Terabytes"), 512);
            m_cbMaxData.AddItem(_("4 Terabytes (Standard)"), 1024);
            m_cbMaxData.AddItem(_("8 Terabytes"), 2048);
            m_cbMaxData.AddItem(_("16 Terabytes"), 4096);
            m_cbMaxData.AddItem(_("32 Terabytes"), 8192);
            m_cbMaxData.AddItem(_("64 Terabytes"), 16384);
            if (bigData)
            {
                m_cbMaxData.AddItem(_("128 Terabytes"), 32768);
                m_cbMaxData.AddItem(_("256 Terabytes"), 65536);
                m_cbMaxData.AddItem(_("512 Terabytes"), 131072);
                m_cbMaxData.AddItem(_("1 Exabyte"), 262144);
                m_cbMaxData.AddItem(_("2 Exabytes"), 524288);
                m_cbMaxData.AddItem(_("4 Exabytes"), 1048576);
            }

            m_cbCompression.AddItem(_("No compression"), 0);
            m_cbCompression.AddItem(_("Compress for speed"), 1);
            m_cbCompression.AddItem(_("Compress for size"), 2);

            string szCompression = string.Empty;

            if (CSYS.IiGlobal("MONTAJ.DB_COMPRESS", ref szCompression) == 0)
            {
                m_cbCompression.SetValue(szCompression);
            }

            ini.RefreshControls();
            m_cbMaxData.SetValue(m_cbMaxDataPerChan.strGetValue());
        }
示例#6
0
        private void Execute()
        {
            // Always validate using this call first
            string strError = String.Empty;

            if (!bValidateDialog(ref strError, false))
            {
                ShowErrorAndExit(strError);
            }

            // --- is the database loaded? ---

            var szName = "";

            m_sDBName.GetFilePath(ref szName);
            CSTR.IFileExt(szName, ".gdb", ref szName, GeoEngine.Core.GXNet.Constant.FILE_EXT_FORCE);
            if (CEDB.iLoaded(szName) == 1)
            {
                CEDB.UnLoad(szName);
            }

            // --- Get Parameters ---

            int iLines    = m_iLines.iGetValue();
            int iChannels = m_iChannels.iGetValue();
            int iCompress = Convert.ToInt32(m_cbCompression.strGetValue());
            int iPageSize = Convert.ToInt32(m_cbMaxData.strGetValue());

            int    iBlobs     = ini.GetInt("BLOBS");
            int    iUsers     = ini.GetInt("USERS");
            int    iErase     = ini.GetInt("ERASE");
            string szSuper    = ini.GetString("SUPER");
            string szPassword = ini.GetString("PASSWORD");
            string szCurDB    = ini.GetString("CURDB");

            int iMinBlobs = iLines + iChannels + 100;

            if (iBlobs < iMinBlobs)
            {
                iBlobs = iMinBlobs;
            }

            if (iUsers <= 0 || iUsers == GeoEngine.Core.GXNet.Constant.iDUMMY)
            {
                iUsers = 10;
            }

            if (iErase <= 0 || iErase == GeoEngine.Core.GXNet.Constant.iDUMMY)
            {
                iErase = Convert.ToInt32(iLines * iChannels * 0.05);
                if (iErase < 100)
                {
                    iErase = 100;
                }
                if (iErase > 10000)
                {
                    iErase = 10000;
                }
            }

            if (szSuper.Length == 0)
            {
                szSuper = "SUPER";
            }

            if (szPassword.Length == 0)
            {
                szPassword = "";
            }

            if (szCurDB.Length > 0 && szCurDB.CompareTo(szName) == 0)
            {
                ShowErrorAndExit(_("Specified database is protected against overwrite."));
            }

            if (CSYS.iScript() == 0)
            {
                CPROJ.iRemoveDocument(szName);
            }

            CDB.CreateComp(szName, iLines, iChannels, iBlobs, iUsers, iErase, szSuper, szPassword, iPageSize, iCompress);

            if (CSYS.iScript() != 1)
            {
                CEDB.LoadNew(szName);
            }
        }
示例#7
0
        /// <summary>
        /// Update with any required new servers on upgrades
        /// </summary>
        protected void UpgradeList(int iMajorVersion, int iMinorVersion, int iSPVersion, System.Collections.Generic.Dictionary <string, ServerUpgradeInfo> URLs)
        {
            XmlDocument  oDoc;
            XmlNode      oNode, oRoot;
            XmlAttribute oAttr;

            try
            {
                string strDir = string.Empty;
                CSYS.IGetDirectory(GXNet.Constant.SYS_DIR_USER, ref strDir);
                string strUpdated = System.IO.Path.Combine(strDir, string.Format("csv\\Dap_Servers{0}{1}{2}.updated", iMajorVersion, iMinorVersion, iSPVersion));

                // --- Only update once per version ---
                if (!System.IO.File.Exists(strUpdated))
                {
                    bool bFound;

                    oDoc = new XmlDocument();
                    oDoc.Load(m_strCSV);
                    oRoot = oDoc.DocumentElement;


                    // --- See if the URL has not been added manually already ---
                    foreach (string strURL in URLs.Keys)
                    {
                        bFound = false;
                        foreach (XmlNode oServerNode in oRoot.ChildNodes)
                        {
                            oNode = oServerNode.Attributes.GetNamedItem(Constant.Xml.Attr.Url);
                            if (oNode == null)
                            {
                                throw new ApplicationException("Missing url attribute in server node");
                            }
                            if (String.Compare(oNode.Value, strURL, true) == 0)
                            {
                                bFound = true;
                                break;
                            }
                        }
                        if (!bFound)
                        {
                            // --- Add the server ---

                            XmlNode oServerNode = oRoot.OwnerDocument.CreateElement(Constant.Xml.Tag.Server);

                            oAttr       = oRoot.OwnerDocument.CreateAttribute(Constant.Xml.Attr.Name);
                            oAttr.Value = URLs[strURL].Name;
                            oServerNode.Attributes.Append(oAttr);

                            oAttr       = oRoot.OwnerDocument.CreateAttribute(Constant.Xml.Attr.Url);
                            oAttr.Value = strURL;
                            oServerNode.Attributes.Append(oAttr);

                            oAttr       = oRoot.OwnerDocument.CreateAttribute(Constant.Xml.Attr.Status);
                            oAttr.Value = URLs[strURL].eStatus.ToString();
                            oServerNode.Attributes.Append(oAttr);

                            oAttr       = oRoot.OwnerDocument.CreateAttribute(Constant.Xml.Attr.Major_Version);
                            oAttr.Value = URLs[strURL].iMajorVersion.ToString();
                            oServerNode.Attributes.Append(oAttr);

                            oAttr       = oRoot.OwnerDocument.CreateAttribute(Constant.Xml.Attr.Minor_Version);
                            oAttr.Value = URLs[strURL].iMinorVersion.ToString();
                            oServerNode.Attributes.Append(oAttr);

                            oAttr       = oRoot.OwnerDocument.CreateAttribute(Constant.Xml.Attr.CacheVersion);
                            oAttr.Value = "";
                            oServerNode.Attributes.Append(oAttr);

                            oRoot.AppendChild(oServerNode);
                        }
                    }

                    oDoc.Save(m_strCSV);

                    // --- Only update once per version ---
                    using (StreamWriter sw = new StreamWriter(strUpdated))
                        sw.WriteLine();
                }
            }
            catch
            {
            }
        }