Exemplo n.º 1
0
		public static void ExportMySQL()
		{
			if (!CMOptions.ModuleEnabled || !CMOptions.MySQLEnabled || !CMOptions.MySQLInfo.IsValid())
			{
				if (_Connection != null)
				{
					_Connection.Dispose();
					_Connection = null;
				}

				return;
			}

			if (_Connection != null && !_Connection.IsDisposed)
			{
				return;
			}

			CMOptions.ToConsole("Updating MySQL database...");
			
			VitaNexCore.TryCatch(
				() =>
				{
					_Connection = new MySQLConnection(CMOptions.MySQLInfo);
					_Connection.ConnectAsync(0, true,() =>
					{
						var a = new Action(UpdateMySQL);

						a.BeginInvoke(
							r =>
							{
								a.EndInvoke(r);
								UpdateMySQL();
							},
							null);
					});
				},
				x =>
				{
					if (_Connection != null)
					{
						_Connection.Dispose();
						_Connection = null;
					}

					CMOptions.ToConsole(x);
				});
		}
Exemplo n.º 2
0
        public static void ExportMySQL()
        {
            if (!CMOptions.ModuleEnabled || !CMOptions.MySQLEnabled || !CMOptions.MySQLInfo.IsValid())
            {
                if (_Connection != null)
                {
                    _Connection.Dispose();
                    _Connection = null;
                }

                return;
            }

            if (_Connection != null && !_Connection.IsDisposed)
            {
                return;
            }

            CMOptions.ToConsole("Updating MySQL database...");

            VitaNexCore.TryCatch(
                () =>
            {
                _Connection = new MySQLConnection(CMOptions.MySQLInfo);
                _Connection.ConnectAsync(0, true, () =>
                {
                    var a = new Action(UpdateMySQL);

                    a.BeginInvoke(
                        r =>
                    {
                        a.EndInvoke(r);
                        UpdateMySQL();
                    },
                        null);
                });
            },
                x =>
            {
                if (_Connection != null)
                {
                    _Connection.Dispose();
                    _Connection = null;
                }

                CMOptions.ToConsole(x);
            });
        }