Changeset 105


Ignore:
Timestamp:
Aug 26, 2012, 11:05:22 AM (12 years ago)
Author:
roman
Message:

online result submission

Location:
trunk/Utilities/CaptureClock
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/CaptureClock/CaptureClock_i.c

    r104 r105  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Sun Aug 26 16:38:39 2012
     9/* at Sun Aug 26 17:11:45 2012
    1010 */
    1111/* Compiler settings for CaptureClock.idl:
  • trunk/Utilities/CaptureClock/CaptureClock_i.h

    r104 r105  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Aug 26 16:38:39 2012
     7/* at Sun Aug 26 17:11:45 2012
    88 */
    99/* Compiler settings for CaptureClock.idl:
  • trunk/Utilities/CaptureClock/MainDialog.h

    r104 r105  
    88
    99#include "rodshow.h"
     10#include "rowinhttp.h"
     11#include "rocrypt.h"
    1012#include "AboutDialog.h"
    1113
     
    652654                }
    653655                UpdateControls();
    654                 if(!m_sLog.IsEmpty())
    655                 {
    656                         CString sLog;
    657                         OSVERSIONINFO VersionInformation = { sizeof VersionInformation };
    658                         _W(GetVersionEx(&VersionInformation));
    659                         _A(VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT);
    660                         sLog += AtlFormatString(_T("Windows Version") _T("\t") _T("%d.%d.%d %s") _T("\r\n"), VersionInformation.dwMajorVersion, VersionInformation.dwMinorVersion, VersionInformation.dwBuildNumber, VersionInformation.szCSDVersion);
    661                         CFilterData& VideoFilterData = m_VideoDeviceComboBox.GetItemData(m_VideoDeviceComboBox.GetCurSel());
    662                         sLog += AtlFormatString(_T("Video Device") _T("\t") _T("%ls") _T("\t") _T("%ls") _T("\r\n"), VideoFilterData.GetFriendlyName(), VideoFilterData.GetMonikerDisplayName());
    663                         CFilterData& AudioFilterData = m_AudioDeviceComboBox.GetItemData(m_AudioDeviceComboBox.GetCurSel());
    664                         sLog += AtlFormatString(_T("Audio Device") _T("\t") _T("%ls") _T("\t") _T("%ls") _T("\r\n"), AudioFilterData.GetFriendlyName(), AudioFilterData.GetMonikerDisplayName());
    665                         sLog += _T("\r\n");
    666                         sLog += m_sLog;
    667                         SetClipboardText(m_hWnd, sLog);
    668                         MessageBeep(MB_OK);
    669                 }
     656                #if !_DEVELOPMENT
     657                        if(m_sLog.IsEmpty())
     658                                return 0; // No Effective Log
     659                #endif // !_DEVELOPMENT
     660                #pragma region Log
     661                CString sLog;
     662                TCHAR pszComputerName[256] = { 0 };
     663                DWORD nComputerNameLength = DIM(pszComputerName);
     664                _W(GetComputerName(pszComputerName, &nComputerNameLength));
     665                sLog += AtlFormatString(_T("Computer Name") _T("\t") _T("%s") _T("\r\n"), pszComputerName);
     666                OSVERSIONINFO VersionInformation = { sizeof VersionInformation };
     667                _W(GetVersionEx(&VersionInformation));
     668                _A(VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT);
     669                sLog += AtlFormatString(_T("Windows Version") _T("\t") _T("%d.%d.%d %s") _T("\r\n"), VersionInformation.dwMajorVersion, VersionInformation.dwMinorVersion, VersionInformation.dwBuildNumber, VersionInformation.szCSDVersion);
     670                CFilterData& VideoFilterData = m_VideoDeviceComboBox.GetItemData(m_VideoDeviceComboBox.GetCurSel());
     671                sLog += AtlFormatString(_T("Video Device") _T("\t") _T("%ls") _T("\t") _T("%ls") _T("\r\n"), VideoFilterData.GetFriendlyName(), VideoFilterData.GetMonikerDisplayName());
     672                CFilterData& AudioFilterData = m_AudioDeviceComboBox.GetItemData(m_AudioDeviceComboBox.GetCurSel());
     673                sLog += AtlFormatString(_T("Audio Device") _T("\t") _T("%ls") _T("\t") _T("%ls") _T("\r\n"), AudioFilterData.GetFriendlyName(), AudioFilterData.GetMonikerDisplayName());
     674                sLog += _T("\r\n");
     675                sLog += m_sLog;
     676                #pragma endregion
     677                SetClipboardText(m_hWnd, sLog);
     678                MessageBeep(MB_OK);
     679                #if !_DEVELOPMENT
     680                        if(AtlMessageBoxEx(m_hWnd,
     681                                        _T("The runtime execution data was placed onto clipboard in tab separated value format, you can paste it into a text or a spreadsheet document for further processing or analysis.") _T("\r\n")
     682                                        _T("\r\n")
     683                                        _T("Would you also like to share the results and post them to the website?"), IDS_CONFIRMATION, MB_ICONINFORMATION | MB_YESNO | ((m_nTimerEventIndex < 60) ? MB_DEFBUTTON2 : 0))  != IDYES)
     684                                return 0; // No Submission
     685                #else
     686                        return 0; // No Submission
     687                #endif // !_DEVELOPMENT
     688                #pragma region HTTP POST
     689                CWinHttpPostData PostData;
     690                PostData.AddValue(_T("s"), AtlLoadString(IDS_PROJNAME));
     691                CStringA sTextA = Utf8StringFromString(sLog);
     692                PostData.AddValue(_T("b"), _Base64Helper::Encode<CString>((const BYTE*) (LPCSTR) sTextA, sTextA.GetLength(), _Base64Helper::FLAG_NOPAD | _Base64Helper::FLAG_NOCRLF));
     693                CWinHttpSessionHandle Session = OpenWinHttpSessionHandle(AtlLoadString(IDS_PROJNAME));
     694                __E(Session);
     695                CWinHttpConnectionHandle Connection = Session.Connect(CStringW(_T("alax.info")));
     696                __E(Connection);
     697                CWinHttpRequestHandle Request = Connection.OpenRequest(CStringW(_T("POST")), CStringW(_T("/post.php")));
     698                __E(Request);
     699                CStringW sPostHeaders = PostData.GetHeaders();
     700                CStringA sPostData(PostData.GetValue());
     701                __E(Request.Send(sPostHeaders, -1, const_cast<LPSTR>((LPCSTR) sPostData), sPostData.GetLength(), sPostData.GetLength()));
     702                __E(Request.ReceiveResponse());
     703                DWORD nStatusCode = 0;
     704                __E(Request.QueryNumberHeader(WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, nStatusCode));
     705                __D(nStatusCode == HTTP_STATUS_OK, MAKE_HRESULT(SEVERITY_ERROR, FACILITY_HTTP, nStatusCode));
     706                #pragma endregion
     707                AtlMessageBoxEx(m_hWnd, _T("The results were posted to the website, thank you for sharing them!"), IDS_INFORMATION, MB_ICONINFORMATION | MB_OK);
    670708                return 0;
    671709        }
Note: See TracChangeset for help on using the changeset viewer.