网游BUG提交解决方案

1.网游运行中的崩溃异常 etc 需要搜集上传到运营商的服务器上,以便解决问题。

2.在此提供一个FTP上传类。

3.当然上传的文件内容,不容我多说,是程序员自己定义的各种dump日志。

#pragma once

#include <string>
#include <afxinet.h>

using namespace std;

class ZBugZiller
{
public:
	ZBugZiller();
	~ZBugZiller();
	void Release();


	void SetFTPInfo(const string & serverAddress, const int & portNumber = 21);
	void SetAccount (const string & strUserID, const string & strUserPassword);
	void ConnectFTP();
	void Upload(char * strlocalFile, char * strRemoteFile);
	
private:
	string		m_userID;
	string		m_userPassword;
	string		m_strServerAddress;
	int			m_iPortNo;

private:		// MFC classes
	CInternetSession *		m_pSession;
	CFtpConnection *		m_pFtpConnection;
};

#include "StdAfx.h"
#include ".\zbugziller.h"
#include <IO.H>

ZBugZiller::ZBugZiller()
{
	m_userID = "";
	m_userPassword = "";
	m_strServerAddress = "";
	m_iPortNo = 21;

	m_pSession = NULL;
	m_pFtpConnection = NULL;
}
void ZBugZiller::SetFTPInfo(const string & serverAddress, const int & portNumber)
{
	m_strServerAddress = serverAddress;
	m_iPortNo = portNumber;
}
void ZBugZiller::SetAccount (const string & strUserID, const string & strUserPassword)
{
	m_userID = strUserID;
	m_userPassword = strUserPassword;
}
void ZBugZiller::ConnectFTP()
{
	m_pSession = new CInternetSession();
	try
	{
		m_pFtpConnection = m_pSession->GetFtpConnection(m_strServerAddress.c_str(), m_userID.c_str(), m_userPassword.c_str(), m_iPortNo, TRUE);
	}
	catch ( ... )
	{
		Release();
//		MessageBox(HWND_DESKTOP, "[坷幅] : 辑滚俊 立加 且 荐 绝嚼聪促.", "宫氢柯扼牢", MB_OK);
		return;
	}
}
void ZBugZiller::Release()
{
	if ( m_pFtpConnection != NULL )
	{
		m_pFtpConnection->Close();
		delete m_pFtpConnection;
		m_pFtpConnection =NULL;
	}

	if ( m_pSession != NULL )
	{
		m_pSession->Close();
		delete m_pSession;
		m_pSession =NULL;
	}
}
ZBugZiller::~ZBugZiller(void)
{
	Release();
}

void ZBugZiller::Upload(char * strlocalFile, char * strRemoteFile)
{
	if(!m_pFtpConnection || !m_pSession)
		return;

//	CFileStatus aStatus;
//if ( CFile::GetStatus(strlocalFile, aStatus) == TRUE )
//	{
		/*
		CTime creationTime = aStatus.m_ctime;
				CString strTime = "[";
		        strTime += strKey.c_str();
				strTime += "]";
				strTime += creationTime.Format("(%Y-%m-%d)%H-%M-%S");
		*/
		//CString strTime;
		if( _access(strlocalFile, 0) != -1)
		{
			try
			{
				m_pFtpConnection->PutFile(strlocalFile, strRemoteFile, FTP_TRANSFER_TYPE_ASCII);
			}
			catch ( ... )
			{
				Release();
//				MessageBox(HWND_DESKTOP, "[坷幅] : 辑滚俊 肺弊甫 傈崔 且 荐 绝嚼聪促.", "宫氢柯扼牢", MB_OK);
				return;
			}

			while(1)
			{
				if(DeleteFile(strlocalFile) == TRUE)
					break;
				Sleep(200);
			}
		}

//	}
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值