Beispiel #1
0
 private void cmdMake_Click(object sender, EventArgs e)
 {
     iShopSetting.IniWriteValue(iCrype.CryptString("Setting"), iCrype.CryptString("ShopName"),
                                iCrype.CryptString(txtShopName.Text));
     iShopSetting.IniWriteValue(iCrype.CryptString("Setting"), iCrype.CryptString("ShopCNName"),
                                txtShopCNName.Text)
     ;
     MessageBox.Show(Resources.frmMain_cmdMake_Click_Make_Up_Name_File_OK_);
 }
Beispiel #2
0
        private void cmdInstall_Click(object sender, EventArgs e)
        {
            //保存配置文件
            iniControl.IniWriteValue(iCrype.CryptString("ServiceInfo"), iCrype.CryptString("Duration"),
                                     iCrype.CryptString(txtTime.Text));
            iniControl.IniWriteValue(iCrype.CryptString("ServiceInfo"), iCrype.CryptString("SavePath"),
                                     iCrype.CryptString(txtSavePath.Text));
            iniControl.IniWriteValue(iCrype.CryptString("ServiceInfo"), iCrype.CryptString("CVSPath"),
                                     iCrype.CryptString(txtCVSPath.Text));
            iniControl.IniWriteValue(iCrype.CryptString("ServiceSetting"), iCrype.CryptString("NotifyMe"),
                                     ckbUpdateNotify.Checked ? iCrype.CryptString("1") : iCrype.CryptString("0"));
            //ckbNoBusy
            iniControl.IniWriteValue(iCrype.CryptString("ServiceSetting"), iCrype.CryptString("NoBusyUpdate"),
                                     ckbNoBusy.Checked ? iCrype.CryptString("1") : iCrype.CryptString("0"));
            //ckbAutoUpdateNotify
            iniControl.IniWriteValue(iCrype.CryptString("ServiceSetting"), iCrype.CryptString("AutoUpdateNotify"),
                                     ckbAutoUpdateNotify.Checked ? iCrype.CryptString("1") : iCrype.CryptString("0"));

            //安装服务


            //按需设置服务

            DialogResult = DialogResult.OK;
        }
Beispiel #3
0
        private void cmdOption_Click(object sender, EventArgs e)
        {
            fbdMain.Reset();
            fbdMain.Description         = Resources.frmMian_cmdOption_Click_Select_APK_Files_Path;
            fbdMain.ShowNewFolderButton = true;

            if (fbdMain.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            lsvSoftware.Items.Clear();

            lblPath.Text = fbdMain.SelectedPath;

            if (lblPath.Text.Substring(lblPath.Text.Length - 1) == "\\")
            {
                lblPath.Text = lblPath.Text.Substring(0, lblPath.Text.Length - 1);
            }
            iniController.IniWriteValue("SYSTEM", "PATH", lblPath.Text);
            ListSoftware(fbdMain.SelectedPath);
            cmdStart.Enabled = true;
            //判断是否存在指定文件夹 没有则创建?
        }
Beispiel #4
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            cmdOK.Enabled = false;
            try
            {
                iniControl.IniWriteValue("Network", "MysqlAccount", iCrype.CryptString(txtSQLAccount.Text));
                iniControl.IniWriteValue("Network", "MysqlDatabase", iCrype.CryptString(txtSQLDatabase.Text));
                iniControl.IniWriteValue("Network", "MysqlURL", iCrype.CryptString(txtSQLIP.Text));
                iniControl.IniWriteValue("Network", "MysqlPassword", iCrype.CryptString(txtSQLPass.Text));
                iniControl.IniWriteValue("Network", "FTPAccount", iCrype.CryptString(txtFTPAccount.Text));
                iniControl.IniWriteValue("Network", "FTPURL", iCrype.CryptString(txtFTPIP.Text));
                iniControl.IniWriteValue("Network", "FTPPassword", iCrype.CryptString(txtFTPPassword.Text));
                iniControl.IniWriteValue("System", "CMSPassword", iCrype.CryptString(txtLXCMS.Text));
                iniControl.IniWriteValue("System", "CRMFakePassword", iCrype.CryptString(txtLXCRMYG.Text));
                iniControl.IniWriteValue("System", "CRMPassword", iCrype.CryptString(txtLXCRM.Text));
                iniControl.IniWriteValue("System", "TOOLSPassword", iCrype.CryptString(txtLXTool.Text));

                iniControl.IniWriteValue("Pay", "P1", iCrype.CryptString(txtP1.Text));
                iniControl.IniWriteValue("Pay", "P2", iCrype.CryptString(txtP2.Text));
                iniControl.IniWriteValue("Pay", "P3", iCrype.CryptString(txtP3.Text));
                iniControl.IniWriteValue("Pay", "P4", iCrype.CryptString(txtP4.Text));
                iniControl.IniWriteValue("Pay", "P5", iCrype.CryptString(txtP5.Text));
                iniControl.IniWriteValue("Pay", "P6", iCrype.CryptString(txtP6.Text));
                iniControl.IniWriteValue("Pay", "P7", iCrype.CryptString(txtP7.Text));
                MessageBox.Show(Resources.frmSetting_cmdOK_Click_修改配置成功_, Application.ProductName, MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(Resources.frmSetting_cmdOK_Click_ + ex.Message, Application.ProductName,
                                MessageBoxButtons.OK);
            }
            cmdOK.Enabled = true;
            DialogResult  = DialogResult.OK;
        }
Beispiel #5
0
        private void frmInstall_Shown(object sender, EventArgs e)
        {
            lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                           DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                           Resources.frmInstall_frmInstall_Shown_系统初始化结束;
            prbMain.Value = prbMain.Value + 1;
            lblText.Text  = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                            DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                            Resources.frmInstall_frmInstall_Shown_请等待完成;
            prbMain.Value = prbMain.Value + 1;
            lblText.Text  = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                            DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                            Resources.frmInstall_frmInstall_Shown_正在判别操作系统版本_;
            prbMain.Value = prbMain.Value + 1;

            installBaseSQL();

            Stream sm;

            if (Distinguish64or32System() == "32")
            {
                //32位
                lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                               DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                               Resources.frmInstall_frmInstall_Shown_正在为32位系统初始化_;
                sm = Assembly.GetEntryAssembly().GetManifestResourceStream("DataAssistant.X86.7z");
            }
            else
            {
                //64位
                lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                               DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                               Resources.frmInstall_frmInstall_Shown_正在为64位系统初始化_;
                sm = Assembly.GetEntryAssembly().GetManifestResourceStream("DataAssistant.X64.7z");
            }

            var ext = new SevenZipExtractor(sm);

            for (int i = 0; i < ext.FilesCount; ++i)
            {
                ext.ExtractFiles(Application.StartupPath + @"\core", i);
                prbMain.Value = prbMain.Value + 1;
                Application.DoEvents();
            }

            lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                           DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                           Resources.frmInstall_frmInstall_Shown_初始化完毕_等待写入数据文件;
            //////////所有定制文件解压完毕
            prbMain.Value = prbMain.Value + 1;

            sm           = Assembly.GetEntryAssembly().GetManifestResourceStream("DataAssistant.SQLdata.7z");
            lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                           DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                           Resources.frmInstall_frmInstall_Shown_正在写入数据文件;
            ext = new SevenZipExtractor(sm);
            for (int i = 0; i < ext.FilesCount; ++i)
            {
                ext.ExtractFiles(Application.StartupPath + @"\core", i);
                prbMain.Value = prbMain.Value + 1;
                Application.DoEvents();
            }
            lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                           DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                           Resources.frmInstall_frmInstall_Shown_数据文件写入完毕_等待配置;

            prbMain.Value = prbMain.Value + 1;
            //数据文件写入完毕,下面进行配置
            //先写入my.ini 然后对my.ini进行配置
            sm = Assembly.GetEntryAssembly().GetManifestResourceStream("DataAssistant.my.ini");
            var sr = new StreamReader(sm);
            var sw = new StreamWriter(Application.StartupPath + @"\core\bin\my.ini");

            sw.Write(sr.ReadToEnd());
            sw.Flush();
            sw.Close();
            sr.Close();

            var iniControl = new clsINI(Application.StartupPath + @"\core\bin\my.ini");

            iniControl.IniWriteValue("mysqld", "basedir",
                                     "\"" + (Application.StartupPath + @"\core\").Replace(@"\", @"/") + "\"");

            lblText.Text = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                           DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                           Resources.frmInstall_frmInstall_Shown_配置完毕;
            prbMain.Value = prbMain.Value + 1;
            //然后写入start.bat 用于启动sql 当然 这个只是预设.现在没考虑如何实现数据库
            sm = Assembly.GetEntryAssembly().GetManifestResourceStream("DataAssistant.start.bat");
            var sr1 = new StreamReader(sm);
            var sw1 = new StreamWriter(Application.StartupPath + @"\core\start.bat");

            sw1.Write(sr1.ReadToEnd());
            sw1.Flush();
            sw1.Close();
            sr1.Close();
            prbMain.Value = prbMain.Value + 1;
            lblText.Text  = DateTime.Now.Hour.ToString("00") + Resources.frmInstall_installBaseSQL__ +
                            DateTime.Now.Minute.ToString("00") + Resources.frmInstall_installBaseSQL______ +
                            Resources.frmInstall_frmInstall_Shown_所有操作全部完毕;
            MessageBox.Show(Resources.frmInstall_frmInstall_Shown_所有操作全部完毕, Application.ProductName,
                            MessageBoxButtons.OK);
            Application.Exit();
        }
Beispiel #6
0
        private void inConfig(string iPath, ServerType iType, ApproNum iNum, int iPort, CharSet iChar)
        {
            var iIni = new clsINI(iPath + "\\bin\\my.ini");

            //This will effect about 7 values
            switch (iType)
            {
            case ServerType.Server:

                iIni.IniWriteValue("mysqld", "tmp_table_size", "205M");
                iIni.IniWriteValue("mysqld", "myisam_sort_buffer_size", "410M");
                iIni.IniWriteValue("mysqld", "key_buffer_size", "354M");
                iIni.IniWriteValue("mysqld", "innodb_additional_mem_pool_size", "15M");
                iIni.IniWriteValue("mysqld", "innodb_log_buffer_size", "7M");
                iIni.IniWriteValue("mysqld", "innodb_buffer_pool_size", "686M");
                iIni.IniWriteValue("mysqld", "innodb_log_file_size", "343M");
                break;

            case ServerType.Developer:
                //It is the default set of the my.ini setting , so do nothing
                break;

            case ServerType.Dedicated_MySQL_Server:
                iIni.IniWriteValue("mysqld", "tmp_table_size", "369M");
                iIni.IniWriteValue("mysqld", "myisam_sort_buffer_size", "738M");
                iIni.IniWriteValue("mysqld", "key_buffer_size", "641M");
                iIni.IniWriteValue("mysqld", "innodb_additional_mem_pool_size", "26M");
                iIni.IniWriteValue("mysqld", "innodb_log_buffer_size", "13M");
                iIni.IniWriteValue("mysqld", "innodb_buffer_pool_size", "1242M");
                iIni.IniWriteValue("mysqld", "innodb_log_file_size", "621M");
                break;
            }
            if (iNum == ApproNum.OLTP)
            {
                iIni.IniWriteValue("mysqld", "max_connections", "700");
                iIni.IniWriteValue("mysqld", "query_cache_size", "18M");
                iIni.IniWriteValue("mysqld", "table_cache", "1400");
                iIni.IniWriteValue("mysqld", "tmp_table_size", "16M");
                iIni.IniWriteValue("mysqld", "thread_cache_size", "34");
            }
            switch (iChar)
            {
            case CharSet.big5:
                iIni.IniWriteValue("mysql", "default-character-set", "big5");
                iIni.IniWriteValue("mysqld", "character-set-server", "big5");
                break;

            case CharSet.utf8:
                //default value
                break;

            case CharSet.gbk:
                iIni.IniWriteValue("mysql", "default-character-set", "gbk");
                iIni.IniWriteValue("mysqld", "character-set-server", "gbk");
                break;

            case CharSet.Latin1:
                iIni.IniWriteValue("mysql", "default-character-set", "latin1");
                iIni.IniWriteValue("mysqld", "character-set-server", "latin1");
                break;
            }
            iIni.IniWriteValue("mysqld", "port", iPort.ToString(CultureInfo.InvariantCulture));
        }
Beispiel #7
0
        /// <summary>
        ///   Install Mysql X86/X64 will auto detected and install.
        /// </summary>
        /// <param name="iPath"> The path you want to install </param>
        /// <param name="iType"> Database Mechine Type, Developer is enough </param>
        /// <param name="iNum"> OLAP/OLTP </param>
        /// <param name="iPort"> Listening port </param>
        /// <param name="iChar"> character-set-server </param>
        public void Install(string iPath, ServerType iType = ServerType.Developer, ApproNum iNum = ApproNum.OLAP,
                            int iPort = 9998, CharSet iChar = CharSet.Latin1)
        {
            //Deal with "\" for some baby programmer:)
            if (iPath.EndsWith("\\"))
            {
                iPath = iPath.Substring(0, iPath.Length - 1);
            }
            var i7Z = new clsSevenZip();

            //Need Install as following list
            //1. CORE.PART
            //2. 32.PART
            //3. 64.PART
            //4. my.ini
            i7Z.Initialize();
            //First Copy files from the resources
            byte[] iSave = Resources.core;
            var    fsObj = new FileStream(Environment.CurrentDirectory + "\\core.part", FileMode.Create);

            fsObj.Write(iSave, 0, iSave.Length);
            fsObj.Close();
            //Call clsSevenZip

            i7Z.ExtractFile(Environment.CurrentDirectory + "\\core.part", iPath);
            File.Delete(Environment.CurrentDirectory + "\\core.part");
            //Detect the system version 32/64
            if (!clsOS.InternalCheckIsWow64())
            {
                byte[] iSave32 = Resources._32;
                var    fsObj32 = new FileStream(Environment.CurrentDirectory + "\\32.part", FileMode.Create);
                fsObj32.Write(iSave32, 0, iSave32.Length);
                fsObj32.Close();
                i7Z.ExtractFile(Environment.CurrentDirectory + "\\32.part", iPath);
                File.Delete(Environment.CurrentDirectory + "\\32.part");

                byte[] iSave32a = Resources.mysqladmin32;
                var    fsObj32a = new FileStream(Environment.CurrentDirectory + "\\mysqladmin32.part", FileMode.Create);
                fsObj32a.Write(iSave32a, 0, iSave32a.Length);
                fsObj32a.Close();
                i7Z.ExtractFile(Environment.CurrentDirectory + "\\mysqladmin32.part", iPath + "\\bin");
                File.Delete(Environment.CurrentDirectory + "\\mysqladmin32.part");
            }
            else
            {
                byte[] iSave64 = Resources._64;
                var    fsObj64 = new FileStream(Environment.CurrentDirectory + "\\64.part", FileMode.Create);
                fsObj64.Write(iSave64, 0, iSave64.Length);
                fsObj64.Close();
                i7Z.ExtractFile(Environment.CurrentDirectory + "\\64.part", iPath);
                File.Delete(Environment.CurrentDirectory + "\\64.part");

                byte[] iSave64a = Resources.mysqladmin64;
                var    fsObj64a = new FileStream(Environment.CurrentDirectory + "\\mysqladmin64.part", FileMode.Create);
                fsObj64a.Write(iSave64a, 0, iSave64a.Length);
                fsObj64a.Close();
                i7Z.ExtractFile(Environment.CurrentDirectory + "\\mysqladmin64.part", iPath + "\\bin");
                File.Delete(Environment.CurrentDirectory + "\\mysqladmin64.part");
            }
            i7Z.Release();
            //Release my.ini to config Mysql
            byte[] iSavei = Resources.my;
            var    fsObji = new FileStream(iPath + "\\bin\\my.ini", FileMode.Create);

            fsObji.Write(iSavei, 0, iSavei.Length);
            fsObji.Close();
            //And We need config default value to make no error.
            var iIni = new clsINI(iPath + "\\bin\\my.ini");

            iPath = iPath.Replace("\\", "/");
            iIni.IniWriteValue("mysqld", "basedir", "\"" + iPath + "/\"");
            iIni.IniWriteValue("mysqld", "datadir", "\"" + iPath + "/Data/\"");
            //Need config detailed.
            inConfig(iPath, iType, iNum, iPort, iChar);
            //All finished
            if (InstallComplete != null)
            {
                InstallComplete();
            }
        }