public GxMySql(string id)
 {
     if (GxContext.isReorganization && !GXUtil.ExecutingRunX86())
     {
         MYSQL_FIELD_FACTORY.GetInstance();                //Force libmysql load
     }
 }
示例#2
0
        public GxMySql(string id)
        {
#if NETCORE
            if (assembly == null)
            {
                using (var dynamicContext = new AssemblyResolver(Path.Combine(FileUtil.GetStartupDirectory(), "MySql.Data.dll")))
                {
                    assembly = dynamicContext.Assembly;
                }
                using (var dynamicContext = new AssemblyResolver(Path.Combine(FileUtil.GetStartupDirectory(), "System.Configuration.ConfigurationManager.dll"))) { }
            }
#else
            if (GxContext.isReorganization && !GXUtil.ExecutingRunX86())
            {
                MYSQL_FIELD_FACTORY.GetInstance();                //Force libmysql load
            }
#endif
        }
示例#3
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);
        }