コード例 #1
0
        public BusinessInstaller(InstallerConfiguration config)
        {
            BeforeInstall   += new InstallEventHandler((obj, state) => { Initialize(config); });
            BeforeUninstall += new InstallEventHandler((obj, state) => { Initialize(config); });

            InitializeComponent();
        }
コード例 #2
0
        public BusinessInstaller(InstallerConfiguration config)
        {
            BeforeInstall += new InstallEventHandler((obj, state) => { Initialize(config); });
            BeforeUninstall += new InstallEventHandler((obj, state) => { Initialize(config); });

            InitializeComponent();
        }
コード例 #3
0
        public DeskBandInstaller()
        {
            InitializeComponent();

            AfterInstall    += new InstallEventHandler(DeskBandInstaller_AfterInstall);
            BeforeUninstall += new InstallEventHandler(DeskBandInstaller_BeforeUninstall);
            AfterUninstall  += new InstallEventHandler(DeskBandInstaller_AfterUninstall);
        }
コード例 #4
0
        public ProjectInstaller()
        {
            // This call is required by the Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitializeComponent call
            AfterInstall += new InstallEventHandler(ProjectInstaller_AfterInstall);
        }
コード例 #5
0
        public InstallCustomAction()
        {
            // This call is required by the Designer.
            InitializeComponent();

            AfterInstall    += new InstallEventHandler(AfterInstallEventHandler);
            BeforeRollback  += new InstallEventHandler(BeforeRollbackEventHandler);
            BeforeUninstall += new InstallEventHandler(BeforeUninstallEventHandler);
        }
コード例 #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AdvancedServiceInstaller()
            : base()
        {
            FailureActions = new List<FailureAction>();
            FailCountResetTime = SERVICE_NO_CHANGE;
            StartTimeoutSeconds = 15;
            StartOnInstall = true;

            Committed += new InstallEventHandler(UpdateServiceConfig);
            Committed += new InstallEventHandler(StartIfNeeded);
        }
コード例 #7
0
        /// <summary>
        /// Constructeur pour une désinstallation.
        /// </summary>
        /// <param name="serviceAssembly">Assembly du service à installer. Faire <c>Assembly.GetExecutingAssembly()</c>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="serviceAssembly"/> est nul.</exception>
        public ServiceInstallerComponent(Assembly serviceAssembly)
        {
            // Cet appel est requis par le Concepteur de composants.
            InitializeComponent();

            // Bind des évènements
            BeforeUninstall += new InstallEventHandler(OnBeforeUninstall);
            AfterInstall    += new InstallEventHandler(OnAfterInstall);

            // Récupération des paramètres
            this.ServiceAssemblyPath = (serviceAssembly ?? throw new ArgumentNullException(nameof(serviceAssembly))).Location;
        }
コード例 #8
0
        public static void Uninstall(ServiceController service, InstallEventHandler handler = null)
        {
            if (service != null)
            {
                ServiceInstaller installer = new ServiceInstaller();
                installer.Context     = new InstallContext();
                installer.ServiceName = service.ServiceName;
                installer.Uninstall(null);

                if (handler != null)
                {
                    installer.AfterUninstall += handler;
                }
            }
        }
コード例 #9
0
        public ProjectInstaller()
        {
            // This call is required by the Designer.
            InitializeComponent();


            AfterInstall += new InstallEventHandler(AfterInstallEventHandler);

            eventLogInstaller                 = new EventLogInstaller();
            eventLogInstaller.Source          = EVENT_LOG_SOURCE;
            eventLogInstaller.Log             = EVENT_LOG;
            eventLogInstaller.UninstallAction = UninstallAction.NoAction;

            Installers.Add(eventLogInstaller);
        }
コード例 #10
0
        public TServiceInstaller()
        {
            serviceInstaller = new ServiceInstaller
            {
                DisplayName = "TServiceNew6",
                ServiceName = "TServiceNew6",
                StartType   = ServiceStartMode.Automatic,
                Description = "T Service New6"
            };

            processInstaller = new ServiceProcessInstaller {
                Account = ServiceAccount.LocalSystem
            };

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);

            InitializeComponent();

            AfterInstall += new InstallEventHandler(TServiceInstaller_AfterInstall);
        }
コード例 #11
0
 public InstallerClass() : base()
 {
     Committed += new InstallEventHandler(MyInstaller_Committed);
 }
コード例 #12
0
 public MiInstaller()
 {
     InitializeComponent();
     BeforeInstall += new InstallEventHandler(MiInstaller_BeforeInstall);
     AfterInstall  += new InstallEventHandler(MiInstaller_AfterInstall);
 }
コード例 #13
0
ファイル: SetupManager.cs プロジェクト: huchao007/bbsmax
        //��װ���ݿ�
        public static void InstallDatabase(InstallEventHandler onProcess)
        {
            ResourceManager rm = Install_Bin.ResourceManager;
#if SQLSERVER

            bool isSql2000 = IsSQL2000();

            bool isNew = (SetupMode.New == Settings.Current.SetupMode);
            //string connStr = GetConnectionString();// + "Max pool size=200;";
            if (isNew)//ȫ�°�װ������ԭ�����ݿ������°�װ
            {
                //����������򴴽����ݿ�
                onProcess(1, "�����Ƿ����");
                CheckCreateDatabase();

                //�����ǰ�������ݿ��еı���洢���̡�������������
                onProcess(5, "����ԭ�нṹ������");

                if (isSql2000)
                    ExecuteSqlFromFile(rm, "clean_all_2000");
                else
                    ExecuteSqlFromFile(rm, "clean_all");

                //�����������
                onProcess(30, "����bbsmax���ݿ�");
                ExecuteSqlFromFile(rm, "create", 31, 97, onProcess);

                UpdateUrlFormat(Settings.Current.UrlFormat);
                ////�����������
                //onProcess(17, "�����������");
                //ExecuteSqlFromFile(rm, "schemes");

                ////�����ʹ洢���̡����� Sql05����
                //onProcess(40, "�����洢����");
                //ExecuteSqlFromFile(rm, "procedures");

                ////����Ĭ������ Vs����
                //onProcess(70, "����Ĭ������");
                //ExecuteSqlFromFile(rm, "data");

                onProcess(98, "��¼��ǰ�汾");
                UpdateVersion(Settings.Version);

                onProcess(100, "���");

            }
            else//���°�װ2.0->2.3->3.0 �Ժ�İ汾Ҫ�жϵ�ǰ�ǵڼ����汾��
            {
                onProcess(1, "׼������");

                try
                {
                    if (isSql2000)
                        ExecuteSqlFromFile(rm, "first_2000");
                    else
                        ExecuteSqlFromFile(rm, "first");
                }
                catch
                { }


                //�������ݿ��
                string[] versions = Settings.Versions;
                string currentVersion = GetCurrentVersion();

                int currentV = int.Parse(currentVersion[0].ToString());

                if (currentV < 4)
                {
                    if (V4Exists() == false)
                    {
                        //�����������
                        onProcess(1, "����bbsmax4���ݿ�");
                        ExecuteSqlFromFile(rm, "create", 1, 51, onProcess);
                    }
                }

                UpdateUrlFormat(Settings.Current.UrlFormat);



                //������� �����ǰ�������ݿ��еĴ洢���̡�������������
                onProcess(55, "������ڵĴ洢���̡�������������");

                if (isSql2000)
                    ExecuteSqlFromFile(rm, "clean_upgrade_2000");
                else
                    ExecuteSqlFromFile(rm, "clean_upgrade");


                bool updateStarted = false;
                foreach (string version in versions)
                {
                    if (!updateStarted && string.Compare(version, currentVersion, true) == 0)
                    {
                        //�汾�����ҵ��˵�ǰ�汾,��ô���¸��汾��ʼ����
                        updateStarted = true;
                        continue;
                    }

                    if (updateStarted)
                    {
                        try
                        {
                            ExecuteSqlFromFile(rm, "_" + version.Replace(".", "_"));
                            UpdateVersion(version);
                        }
                        catch (Exception ex)
                        {
                            CreateLog(ex);
                            throw new Exception("�������ݿ�汾�� " + version + " ʱʧ�ܣ�" + ex.Message);
                        }
                    }
                }

                if (!updateStarted)
                    throw new Exception("������ʹ����δ�������еİ汾���������޷��������������ϵ�ٷ���Ա�ṩ����");


                ////���´����洢���̡�������������
                //onProcess(60, "�ؽ��洢���̡�������������");
                //ExecuteSqlFromFile(rm, "procedures");

                //����ȫ������
                onProcess(80, "��������ȫ������");
                CheckResetFulltext();

                ExecuteSqlFromFile(rm, "lastsql");


                ////���첿�� ȫ�°�װ����
                //onProcess(80, "����������У�ԺͲ���");


                //Stream dbStream = new MemoryStream(Encoding.UTF8.GetBytes(Install_Bin.scheme_xml));
                //string errorLog;
                //DbDeployer.Update(Settings.Current.IConnectionString, dbStream, out errorLog);
                //if (!string.IsNullOrEmpty(errorLog))
                //    CreateLog(errorLog);
            }
#endif
#if SQLITE
            bool isNew = (SetupMode.New == Settings.Current.SetupMode);
            if (isNew)
            {
                try
                {
                    onProcess(20, "��װ���ݿ�");
                    //CanelReadOnly(Globals.RootPath() + Settings.Current.BbsMaxFilePath);
                    //CanelReadOnly(Globals.RootPath() + Settings.Current.IdMaxFilePath);
                    //File.WriteAllBytes(Globals.RootPath() + Settings.Current.BbsMaxFilePath, Install_Bin.sqlite_bbsMax);
                    onProcess(50, "��װ���ݿ�");
                    //File.WriteAllBytes(Globals.RootPath() + Settings.Current.IdMaxFilePath, Install_Bin.sqlite_idMax);
                }
                catch (Exception ex)
                {
                    CreateLog(ex);
                    throw new Exception("��װ���ݿ�ʧ�ܡ�" + ex.Message);
                }
            }
            else
            {
                onProcess(1, "�������ݿ�");
                //CheckResetFulltext();

                //�������ݿ��
                string[] versions = Settings.Versions;
                string currentVersion = GetCurrentVersion();
                onProcess(20, "�������ݿ�");

                bool updateStarted = false;
                foreach (string version in versions)
                {
                    if (!updateStarted && string.Compare(version, currentVersion, true) == 0)
                    {
                        //�汾�����ҵ��˵�ǰ�汾,��ô���¸��汾��ʼ����
                        updateStarted = true;
                        continue;
                    }

                    if (updateStarted)
                    {
                        try
                        {
                            ExecuteSqlFromFile(rm, "sqlite_bbsMax_" + version.Replace(".", "_"));
                            ExecuteSqlFromFile(rm, "sqlite_idMax_" + version.Replace(".", "_"));
                            UpdateVersion(version);
                        }
                        catch (Exception ex)
                        {
                            CreateLog(ex);
                            throw new Exception("�������ݿ�汾�� " + version + " ʱʧ�ܣ�" + ex.Message);
                        }
                    }
                }
                onProcess(95, "�������ݿ�");
                if (!updateStarted)
                    throw new Exception("������ʹ����δ�������еİ汾���������޷��������������ϵ�ٷ���Ա�ṩ����");
            }
#endif
        }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProjectInstaller"/> class.
 /// </summary>
 public ProjectInstaller()
 {
     this.InitializeComponent();
     BeforeInstall += new InstallEventHandler(ProjectInstaller_BeforeInstall);
 }
コード例 #15
0
ファイル: SetupManager.cs プロジェクト: huchao007/bbsmax
        private static void ExecuteSqlFromFile(ResourceManager rm, string fileName, int beginPercent, int endPercent, InstallEventHandler onProcess)
        {
            string[] sqlAll = null;
            string sqlFromFile = rm.GetString(fileName);

            if (string.IsNullOrEmpty(sqlFromFile))
                return;

            CreateLog("ִ�нű���" + fileName);

            Regex regSql = new Regex(@"\n\bGO\b", RegexOptions.IgnoreCase);//����+go(GO)

            if (regSql.IsMatch(sqlFromFile))
                sqlAll = regSql.Split(sqlFromFile);
            else
                sqlAll = new string[] { sqlFromFile };

#if SQLSERVER
            if (sqlAll != null)
            {
                int totalPercent = endPercent - beginPercent;

                float unitPercent = (float)totalPercent / (float)sqlAll.Length;

                using (SqlConnection connection = new SqlConnection(Settings.Current.IConnectionString))
                {
                    if (ConnectionState.Closed == connection.State)
                        connection.Open();
                    for (int i = 0; i < sqlAll.Length; i++)
                    {
                        try
                        {
                            if (sqlAll[i] != "")
                            {
                                if (onProcess != null)
                                    onProcess(beginPercent + (int)(unitPercent * i), "����ִ�нű�");

                                SqlCommand cmd = new SqlCommand(sqlAll[i], connection);
                                cmd.CommandTimeout = 3600;
                                cmd.ExecuteNonQuery();
                            }
                        }
                        catch (Exception ex)
                        {
                            if (StringUtil.ContainsIgnoreCase(sqlAll[i], "--ignore error"))
                            {
                                CreateLog("ִ��Sql�����\r\n" + ex.Message);
                            }
                            else if (StringUtil.ContainsIgnoreCase(sqlAll[i], "sp_changeobjectowner"))
                            {
                                CreateLog("�޸ı�������߳����\r\n" + ex.Message);
                            }
                            else
                            {
                                connection.Close();
                                CreateLog(ex);
                                throw new Exception("���ݿ����ʧ�ܣ�\r\n" + sqlAll[i] + "\r\n" + ex.Message);
                            }
                        }
                    }
                }
            }
#endif
#if SQLITE
            //�ֱ�����������ݿ�
            string connStr = "";
            if (sqlAll != null)
            {
                if (fileName.StartsWith("sqlite_bbsMax", false, null))
                    connStr = Settings.Current.bbsMaxConnectionString;
                else if ((fileName.StartsWith("sqlite_idMax", false, null)))
                    connStr = Settings.Current.idMaxConnectionString;
                using (SQLiteConnection connection = new SQLiteConnection(connStr))
                {
                    if (ConnectionState.Closed == connection.State)
                        connection.Open();
                    for (int i = 0; i < sqlAll.Length; i++)
                    {
                        try
                        {
                            if (sqlAll[i] != "")
                            {
                                SQLiteCommand cmd = new SQLiteCommand(sqlAll[i], connection);
                                cmd.CommandTimeout = 3600;
                                cmd.ExecuteNonQuery();
                            }
                        }
                        catch (Exception ex)
                        {
                            connection.Close();
                            CreateLog(ex);
                            throw new Exception("���ݿ����ʧ�ܣ�" + ex.Message);
                        }
                    }
                }
            }
#endif
        }
コード例 #16
0
ファイル: SetupManager.cs プロジェクト: huchao007/bbsmax
        public static void ConvertAvatars(InstallEventHandler onProcess)
        {
            string rootPath = Globals.RootPath();

            AvatarBuilder.SetAvatarDirectory(rootPath + "UserFiles\\Avatar");

            List<KeyValuePair<int, string>> list = new List<KeyValuePair<int, string>>();

            //�����ο͡�everyone
            string sql = @"SELECT UserID,AvatarSrc FROM bx_Users WITH (NOLOCK) WHERE AvatarSrc LIKE 'upload://.%'";
            using (SqlConnection connection = new SqlConnection(Settings.Current.IConnectionString))
            {
                SqlCommand command = new SqlCommand(sql, connection);
                command.CommandTimeout = 600;
                connection.Open();
                try
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int userID = (int)reader["UserID"];
                            string avatarSrc = (string)reader["AvatarSrc"];


                            list.Add(new KeyValuePair<int, string>(userID, avatarSrc));
                        }
                    }
                }
                catch (Exception ex)
                {
                    CreateLog(ex);
                    throw new Exception("����ͷ������ʧ��" + ex.Message + sql);
                }
                finally
                {
                    connection.Close();
                }
            }

            int count = list.Count;
            if (count > 0)
            {
                int i = 0;
                foreach (KeyValuePair<int, string> item in list)
                {
                    i++;

                    int percent = 1;
                    if (i == count - 1)
                        percent = 100;
                    else
                    {
                        float a = (float)i / (float)count;


                        string b = a.ToString();
                        if (b.Length >= 4)
                            percent = int.Parse(b.Substring(2, 2));
                        else if (b.Length >= 3)
                            percent = int.Parse(b.Substring(2, 1));
                        else
                            percent = 100;
                    }

                    onProcess(percent, "�Ѵ���" + i + "��ͷ��");

                    try
                    {
                        string path = GetSrcAvatarPath(item.Key, item.Value);
                        if (File.Exists(path))
                        {
                            AvatarBuilder.GenerateAvatar(item.Key, item.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        CreateLog(ex.Message);
                    }
                }

//                sql = @"
//UPDATE bx_Users SET AvatarSrc = '' WHERE AvatarSrc NOT LIKE 'upload://.%'
//UPDATE bx_Users SET AvatarSrc = SUBSTRING(AvatarSrc, 11, 5) WHERE AvatarSrc LIKE 'upload://.%'";
//                using (SqlConnection connection = new SqlConnection(Settings.Current.IConnectionString))
//                {
//                    connection.Open();
//                    SqlCommand command = new SqlCommand(sql, connection);
//                    command.CommandTimeout = 3600;
//                    command.ExecuteNonQuery();
//                }
            }

        }
コード例 #17
0
ファイル: Installer1.cs プロジェクト: ltvinh/FRDB-SQLite
 public Installer1()
     : base()
 {
     InitializeComponent();
     AfterInstall += new InstallEventHandler(Installer1_AfterInstall);
 }
コード例 #18
0
 public ProjectInstaller()
 {
     InitializeComponent();
     BeforeInstall += new InstallEventHandler(BeforeInstallEventHandler);
 }
コード例 #19
0
 public ProjectInstaller()
 {
     InitializeComponent();
     AfterInstall += new InstallEventHandler(ProjectInstaller_AfterInstall);
 }
コード例 #20
0
// <Snippet1>
    // MyInstaller is derived from the class 'Installer'.
    MyInstaller() : base()
    {
        AfterInstall += new InstallEventHandler(AfterInstallEventHandler);
    }
コード例 #21
0
 public ProjectInstaller()
 {
     InitializeComponent();
     AfterInstall += new InstallEventHandler(ProjectInstaller_AfterInstall);
 }
コード例 #22
0
// <Snippet1>
    // MyInstaller is derived from the class 'Installer'.
    MyInstaller() : base()
    {
        BeforeUninstall += new InstallEventHandler(BeforeUninstallEventHandler);
    }
コード例 #23
0
ファイル: demo.cs プロジェクト: nobled/mono
	public MyInstall ()
	{
		Committed += new InstallEventHandler(MyInstaller_Committed);
	}
コード例 #24
0
 public MyInstaller()
 {
     // Add handlers to the events.
     BeforeCommit += new InstallEventHandler(BeforeCommitHandler);
     AfterCommit  += new InstallEventHandler(AfterCommitHandler);
 }
コード例 #25
0
ファイル: demo.cs プロジェクト: pmq20/mono_forked
 public MyInstall()
 {
     Committed += new InstallEventHandler(MyInstaller_Committed);
 }