예제 #1
0
        private static void Main(string[] args)
        {
            bool isFirstInstance;

            using (Mutex mtx = new Mutex(true, InfraSoftwareServer.nameServer, out isFirstInstance))
            {
                if (!isFirstInstance)
                {
                    Application.Exit();
                    return;
                }

                Translator  var_translator = new Translator();
                InstallData var_data       = new InstallData();

                if (!var_data.IsAppInstalled)
                {
                    MessageBox.Show(var_translator.GetMsg(Language.English.ToString(), "ServerSystem.FailRun"), "SYSTEM");
                    return;
                }

                try
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                                        #if DEBUG
                    Application.Run(new UnitTestInterface());
                                        #else
                    if (var_data.IsUpgrade)
                    {
                        Process p = new Process();

                        p.StartInfo.WorkingDirectory = var_data.CopyInstallation(var_data.upgradePath, InfraSoftwareServer.nameServer);
                        p.StartInfo.FileName         = "ServerSetup.exe";
                        p.StartInfo.Arguments        = "";
                        p.StartInfo.CreateNoWindow   = false;
                        p.Start();

                        return;
                    }

                    Application.Run(new ClusterInterface(ref var_translator));
                                        #endif
                }
                catch (System.Security.SecurityException ex)
                {
                    ex.ToString();
                    MessageBox.Show(var_translator.GetMsg(var_data.language, "ServerSystem.Security"), "SYSTEM");
                }
                catch (System.Exception se)
                {
                    MessageBox.Show(se.ToString(), "SYSTEM");
                }
                finally {}
            }
        }
예제 #2
0
        public override bool execute( )
        {
            Registry("execute infra_fetchUpdaterVersion ");

            /// USER [ execute ]

            string upgradePath = new InstallData().upgradePath.Replace("depot\\Server", "depot\\Client\\Data");

            if (Directory.Exists(upgradePath))
            {
                string [] my_files = Directory.GetFiles(upgradePath);
                int       numFiles = my_files.GetLength(0);

                for (int t = 0; t < numFiles; ++t)
                {
                    string fileName = my_files[t];

                    for (int h = fileName.Length - 1; h > 0; --h)
                    {
                        if (fileName [h] == '\\')
                        {
                            fileName = fileName.Substring(h + 1, fileName.Length - h - 1);
                            break;
                        }
                    }

                    Trace(fileName);

                    if (input_tg_windows == Context.TRUE)
                    {
                        if (fileName != "UpdateEngine.dll" && fileName != "Updater.exe")
                        {
                            continue;
                        }
                    }
                    else                     // linux_dist
                    {
                        if (fileName != "UpdateEngine.dll" && fileName != "LinuxUpdater.exe")
                        {
                            continue;
                        }
                    }

                    DataPortable port = new DataPortable();

                    string filePath = upgradePath + "\\" + fileName;

                    FileStream   fs  = new FileStream(filePath, FileMode.Open);
                    BinaryReader br  = new BinaryReader(fs);
                    byte[]       bin = br.ReadBytes(Convert.ToInt32(fs.Length));
                    fs.Close();
                    br.Close();

                    StringBuilder hexString = new StringBuilder();

                    for (int i = 0; i < bin.Length; i++)
                    {
                        hexString.Append(bin[i].ToString("X2"));
                    }

                    port.setValue("data", hexString.ToString());

                    output_st_csv_files += fileName + ",";
                    output_st_csv_files += MemorySave(ref port) + ",";
                }
            }

            output_st_csv_files = output_st_csv_files.TrimEnd(',');

            /// USER [ execute ] END

            Registry("execute done infra_fetchUpdaterVersion ");

            return(true);
        }
예제 #3
0
        public override bool execute( )
        {
            Registry("execute schedule_proc_batch ");

            /// USER [ execute ]

            string dir_watch = new SyCrafEngine.InstallData().pathDir + "\\proc\\";

            I_Batch bat = new I_Batch(this);

            Thread.Sleep(3000);                //  Wait to build valid filelist

            if (bat.select_rows_free(Context.FALSE, Context.FALSE))
            {
                while (bat.fetch())
                {
                    string archive = bat.get_st_archive();

                    #region - SETUP -

                    string path = new InstallData().pathDir + "\\Log_" +
                                  DateTime.Now.Year.ToString() +
                                  DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Hour.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Minute.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Second.ToString().PadLeft(2, '0') +
                                  "_batch_" + archive + ".txt.wrk";

                    FileStream   logFile;
                    StreamWriter logStream;

                    if (File.Exists(path))
                    {
                        logFile = new FileStream(path, FileMode.Append, FileAccess.Write);
                    }
                    else
                    {
                        logFile = new FileStream(path, FileMode.Create, FileAccess.Write);
                    }

                    logStream           = new StreamWriter(logFile);
                    logStream.AutoFlush = true;

                    var_Comm.Clear();
                    DB_Access new_access = new DB_Access(ref m_gen_my_access);

                    var_disp.var_Translator = var_Translator;

                    DataPortable port = new DataPortable();

                    port.setValue("archive", archive);

                    new_access.MemorySave("input", ref port);

                    #endregion

                    if (archive.StartsWith("CARGA_EDU_"))
                    {
                        // Runnig in a new thread
                        var_disp.ExecuteThreadTransaction("load_edu",
                                                          Convert.ToInt32(bat.get_identity()),
                                                          ref logStream,
                                                          ref var_Comm,
                                                          ref new_access,
                                                          path);
                    }
                    else if (archive.StartsWith("CARGA_EDUEMPRESASVIRTUAIS"))
                    {
                        // Runnig in a new thread
                        var_disp.ExecuteThreadTransaction("load_edu_emp_virtual",
                                                          Convert.ToInt32(bat.get_identity()),
                                                          ref logStream,
                                                          ref var_Comm,
                                                          ref new_access,
                                                          path);
                    }
                    else if (archive.StartsWith("LEGADO"))
                    {
                        // Runnig in a new thread
                        var_disp.ExecuteThreadTransaction("load_legado",
                                                          Convert.ToInt32(bat.get_identity()),
                                                          ref logStream,
                                                          ref var_Comm,
                                                          ref new_access,
                                                          path);
                    }
                }
            }

            /// USER [ execute ] END

            Registry("execute done schedule_proc_batch ");

            return(true);
        }
예제 #4
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute schedule_nsu ");

            /// USER [ execute ]

            T_PendPayFone pf = new T_PendPayFone(this);

            pf.truncate();

            LOG_NSU l_nsu = new LOG_NSU(this);

            l_nsu.truncate();

            LOG_NS_FAT l_ns_fat = new LOG_NS_FAT(this);

            l_ns_fat.truncate();

            {
                string schel_log = new InstallData().pathDir + "\\log\\scheduler_log";

                if (Directory.Exists(schel_log))
                {
                    string [] my_files = Directory.GetFiles(schel_log);
                    int       numFiles = my_files.GetLength(0);

                    for (int t = 0; t < numFiles; ++t)
                    {
                        string archive = my_files[t];

                        try
                        {
                            System.IO.File.Delete(archive);
                        }
                        catch (System.Exception ex)
                        {
                            Trace(ex.Message);
                        }
                    }
                }
            }

            {
                string schel_log = new InstallData().pathDir + "\\log";

                if (Directory.Exists(schel_log))
                {
                    string [] my_files = Directory.GetFiles(schel_log);
                    int       numFiles = my_files.GetLength(0);

                    for (int t = 0; t < numFiles; ++t)
                    {
                        string archive = my_files[t];

                        try
                        {
                            System.IO.File.Delete(archive);
                        }
                        catch (System.Exception ex)
                        {
                            Trace(ex.Message);
                        }
                    }
                }
            }

            /// USER [ execute ] END

            Registry("execute done schedule_nsu ");

            return(true);
        }