Пример #1
0
        private void btnExecute_Click(object sender, System.EventArgs e)
        {
            if (ReorgStartup.reorgPending())
            {
                btnExecute.Enabled                    = false;
                GXReorganization._ReorgReader         = this;
                GXReorganization.ignoreResume         = ReorgStartup.ignoreresume;
                GXReorganization.noPreCheck           = ReorgStartup.noprecheck;
                GXReorganization.printOnlyRecordCount = ReorgStartup.onlyRecordCount;
                if (ReorgStartup.gxReorganization.GetCreateDataBase())
                {
                    GXReorganization.SetCreateDataBase();
                }

                //
                // Start the thread
                //
                try
                {
                    if (ReorgStartup.gxReorganization.BeginResume())
                    {
                        m_oThread        = new Thread(new ThreadStart(ReorgStartup.gxReorganization.ExecForm));
                        reorgRunning     = true;
                        btnClose.Enabled = false;

                        lblStatus.Text = GXResourceManager.GetMessage("GXM_ids_run");
                        m_oThread.Start();
                        timer1.Enabled = true;
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                    imgCancel.Visible      = true;
                    imgOk.Visible          = false;
                    imgEqual.Visible       = false;
                    imgReorg.Visible       = false;
                    reorgRunning           = false;
                    btnClose.Enabled       = true;
                    lblStatus.Text         = GXResourceManager.GetMessage("GXM_ids_failed");
                    ReorgStartup.errorCode = -1;
                    return;
                }
                imgCancel.Visible  = false;
                imgOk.Visible      = false;
                imgEqual.Visible   = false;
                imgReorg.Visible   = false;
                btnExecute.Enabled = false;
            }
            else
            {
                MessageBox.Show(GXResourceManager.GetMessage("GXM_ids_noneeded"), "GeneXus.NET");
                Close();
            }
        }
Пример #2
0
 void IReorgReader.NotifyEnd(string id)
 {
     timer1.Enabled = false;
     reorgRunning   = false;
     ReorgStartup.EndReorg();
     btnClose.Enabled = true;
     try
     {
         imgCancel.Visible = false;
         imgOk.Visible     = true;
         imgEqual.Visible  = false;
         imgReorg.Visible  = false;
     }
     catch
     {
     }
     output.Items.Insert(output.Items.Count, GXResourceManager.GetMessage("GXM_ids_ok"));
     lblStatus.Text         = GXResourceManager.GetMessage("GXM_ids_ok");
     ReorgStartup.errorCode = 0;
 }
Пример #3
0
 private void EnableButtons()
 {
     if (!ReorgStartup.reorgPending())
     {
         btnExecute.Enabled = false;
         btnClose.Enabled   = true;
         lblStatus.Text     = GXResourceManager.GetMessage("GXM_ids_noneeded");
         imgCancel.Visible  = false;
         imgOk.Visible      = false;
         imgEqual.Visible   = true;
         imgReorg.Visible   = false;
     }
     else
     {
         btnExecute.Enabled = true;
         imgCancel.Visible  = false;
         imgOk.Visible      = false;
         imgEqual.Visible   = false;
         imgReorg.Visible   = true;;
         lblStatus.Text     = GXResourceManager.GetMessage("GXM_ids_needed");
     }
 }
Пример #4
0
 void IReorgReader.NotifyEnd(string id)
 {
     ReorgStartup.EndReorg();
 }
Пример #5
0
        public static int Main(string[] args)
        {
#if NETCORE
            var configFilePath = Path.Combine(FileUtil.GetStartupDirectory(), CLIENT_EXE_CONFIG);
            if (File.Exists(configFilePath))
            {
                GeneXus.Configuration.Config.ConfigFileName = configFilePath;
            }
#else
            string parentConfigFile = Path.Combine("..", CLIENT_EXE_CONFIG);
            if (File.Exists(CLIENT_EXE_CONFIG))
            {
                GeneXus.Configuration.Config.ConfigFileName = CLIENT_EXE_CONFIG;
            }
            else if (File.Exists(parentConfigFile))
            {
                GeneXus.Configuration.Config.ConfigFileName = parentConfigFile;
            }
            else
            {
                string configPath = Path.Combine(GxContext.StaticPhysicalPath(), CLIENT_EXE_CONFIG);
                if (File.Exists(configPath))
                {
                    GeneXus.Configuration.Config.ConfigFileName = configPath;
                }
            }
            bool nogui = false;
#endif
            bool notexecute = false;
            foreach (string sw in args)
            {
                if (sw.ToLower().StartsWith("\\config:") || sw.ToLower().StartsWith("-config:"))
                {
                    string configFile = sw.Substring(8);
                    GeneXus.Configuration.Config.ConfigFileName = configFile;
                    REORG_FILE_3 = Path.Combine(Path.GetDirectoryName(configFile), REORGPGM_GEN);
                }
#if !NETCORE
                else if (sw.ToLower().Trim() == "-nogui")
                {
                    nogui = true;
                }
#endif
                else if (sw.ToLower().Trim() == "-force")
                {
                    force = true;
                }
                else if (sw.ToLower().Trim() == "-recordcount")
                {
                    onlyRecordCount = true;
                }
                else if (sw.ToLower().Trim() == "-ignoreresume")
                {
                    ignoreresume = true;
                }
                else if (sw.ToLower().Trim() == "-noverifydatabaseschema")
                {
                    noprecheck = true;
                }
                else if (sw.ToLower().Trim() == "-donotexecute")
                {
                    notexecute = true;
                }
            }

            if (notexecute)
            {
                SetStatus(GXResourceManager.GetMessage("GXM_dbnotreorg"));
                errorCode = 0;
            }
            else
            {
                try
                {
                    GxContext.isReorganization = true;
                    gxReorganization           = GetReorgProgram();
#if !NETCORE
                    if (nogui)
                    {
                        try
                        {
                            Console.OutputEncoding = Encoding.Default;
                        }
                        catch (IOException)                         //Docker: System.IO.IOException: The parameter is incorrect.
                        {
                            try
                            {
                                Console.OutputEncoding = Encoding.UTF8;
                            }
                            catch (IOException)
                            {
                            }
                        }
#endif
                    GXReorganization._ReorgReader         = new NoGuiReorg();
                    GXReorganization.printOnlyRecordCount = onlyRecordCount;
                    GXReorganization.ignoreResume         = ignoreresume;
                    GXReorganization.noPreCheck           = noprecheck;
                    if (gxReorganization.GetCreateDataBase())
                    {
                        GXReorganization.SetCreateDataBase();
                    }

                    if (ReorgStartup.reorgPending())
                    {
                        if (gxReorganization.BeginResume())
                        {
                            gxReorganization.ExecForm();
                        }
                        if (GXReorganization.Error)
                        {
                            SetStatus(GXResourceManager.GetMessage("GXM_reorgnotsuccess"));
                            if (GXReorganization.ReorgLog != null && GXReorganization.ReorgLog.Count > 0)
                            {
                                SetStatus((string)GXReorganization.ReorgLog[GXReorganization.ReorgLog.Count - 1]);
                            }
                            errorCode = -1;
                        }
                        else
                        {
                            SetStatus(GXResourceManager.GetMessage("GXM_reorgsuccess"));
                            errorCode = 0;
                        }
                    }
                    else
                    {
                        SetStatus(GXResourceManager.GetMessage("GXM_ids_noneeded"));
                        errorCode = 0;
                    }
#if !NETCORE
                }
                else
                {
                    FreeConsole();
                    System.Windows.Forms.Application.Run(new GuiReorg());
                }
#endif
                }
                catch (Exception ex)
                {
#if !NETCORE
                    if (GXUtil.IsBadImageFormatException(ex) && !GXUtil.ExecutingRunX86())
                    {
                        GXReorganization.CloseResumeFile();
                        int exitCode;
                        if (GXUtil.RunAsX86(GXUtil.REOR, args, DataReceived, out exitCode))
                        {
                            return(exitCode);
                        }
                        else
                        {
                            SetStatus(GXResourceManager.GetMessage("GXM_reorgnotsuccess"));
                            SetStatus(GXResourceManager.GetMessage("GXM_callerr", GXUtil.RUN_X86));
                            errorCode = -1;
                        }
                    }
                    else
#endif
                    {
                        SetStatus(GXResourceManager.GetMessage("GXM_reorgnotsuccess"));
                        SetStatus(ex.Message);

                        errorCode = -1;
                    }
                }
            }
            return(errorCode);
        }