1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-20 04:09:16 +00:00

Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin

This commit is contained in:
JWPlatt
2011-03-12 12:34:52 -05:00
commit a20a222fc2
3976 changed files with 1301355 additions and 0 deletions

View File

@ -0,0 +1,232 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
// Migration.cpp : Defines the entry point for the application.
//
#include <windows.h>
#include <windowsx.h>
#include <process.h>
#include <commctrl.h>
#include "resource.h"
#include "Migration.h"
HINSTANCE gInstance;
HWND gDlg;
unsigned int gThreadID;
int gTaskItem = -1;
bool gTasksRunning = false;
LRESULT CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
InitCommonControls();
HWND hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAINDIALOG), NULL, (DLGPROC) DlgProc);
gInstance = hInstance;
gDlg = hWnd;
ShowWindow(hWnd, SW_SHOW);
// Main message loop:
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if (!IsWindow(hWnd) || !IsDialogMessage(hWnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
// Mesage handler for dlg box.
LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT ret = FALSE;
switch (message)
{
case WM_INITDIALOG:
{
HWND hListView = GetDlgItem(hDlg,IDC_TASKLIST);
ListView_SetExtendedListViewStyleEx(hListView, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
LoadTasks(hListView);
LoadTasks(hDlg);
Button_SetCheck(GetDlgItem(hDlg,IDC_RADIOTEST),BST_CHECKED);
ret = TRUE;
}
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_START:
// Start the migration Tasks
SetCursor(LoadCursor(NULL,IDC_WAIT));
Button_Enable(GetDlgItem(hDlg,IDC_START),FALSE);
Button_Enable(GetDlgItem(hDlg,IDC_STOP),TRUE);
Button_Enable(GetDlgItem(hDlg,IDC_RADIOTEST),FALSE);
Button_Enable(GetDlgItem(hDlg,IDC_RADIOLAST),FALSE);
Button_Enable(GetDlgItem(hDlg,IDC_RADIOBRANCH),FALSE);
_beginthreadex(NULL,0,RunTasks,NULL,0,&gThreadID);
gTasksRunning = true;
ret = TRUE;
break;
case IDC_STOP:
// Stop the migration Tasks
SetCursor(LoadCursor(NULL,IDC_ARROW));
Button_Enable(GetDlgItem(hDlg,IDC_START),TRUE);
Button_Enable(GetDlgItem(hDlg,IDC_STOP),FALSE);
Button_Enable(GetDlgItem(hDlg,IDC_RADIOTEST),TRUE);
Button_Enable(GetDlgItem(hDlg,IDC_RADIOLAST),TRUE);
Button_Enable(GetDlgItem(hDlg,IDC_RADIOBRANCH),TRUE);
ListBox_SetCurSel(GetDlgItem(hDlg,IDC_TASKLIST),gTaskItem);
gTasksRunning = false;
ret = TRUE;
break;
default:
break;
}
}
break;
case WM_NOTIFY:
{
switch ((int)wParam)
{
case IDC_TASKLIST:
{
NMHDR* hdr = (NMHDR*)lParam;
switch (hdr->code)
{
case LVN_ITEMCHANGED:
{
NMLISTVIEW* note = (NMLISTVIEW*)lParam;
if (note->iItem != -1)
{
Static_SetText(GetDlgItem(hDlg,IDC_DESCRIPTION),(*(MigrationTaskList::GetInstance()->GetList()))[note->iItem]->GetDescription());
(*(MigrationTaskList::GetInstance()->GetList()))[note->iItem]->SetEnabled(ListView_GetCheckState(hdr->hwndFrom, note->iItem) != 0);
ret = true;
}
}
break;
}
}
break;
}
}
break;
case WM_CLOSE:
PostQuitMessage(-1);
break;
}
return ret;
}
MigrationTaskList::MigrationTaskList()
{
static MigrationTask_Backup backup;
static MigrationTask_CleanUp cleanUp;
static MigrationTask_PatchBuilder patchBuilder;
static MigrationTask_DataMigration dataMigration;
static MigrationTask_InstallClient installClient;
static MigrationTask_GenerateClientManifest generateClientManifest;
static MigrationTask_DropStoredGames dropStoredGames;
static MigrationTask_InstallAges installAges;
static MigrationTask_CopyTestServers copyTestServers;
static MigrationTask_StartLiveServers startLiveServers;
fList.push_back(&backup);
fList.push_back(&cleanUp);
fList.push_back(&patchBuilder);
fList.push_back(&dataMigration);
fList.push_back(&installClient);
fList.push_back(&generateClientManifest);
fList.push_back(&dropStoredGames);
fList.push_back(&installAges);
fList.push_back(&copyTestServers);
fList.push_back(&startLiveServers);
}
MigrationTaskList* MigrationTaskList::GetInstance()
{
static MigrationTaskList mlist;
return &mlist;
}
void LoadTasks(HWND hListView)
{
MigrationTaskList::TaskList* tasktlist = MigrationTaskList::GetInstance()->GetList();
MigrationTaskList::TaskList::iterator it = tasktlist->begin();
int index = 0;
while (it != tasktlist->end())
{
LVITEM item;
ZeroMemory(&item,sizeof(item));
item.pszText = (*it)->GetName();
item.mask = LVIF_TEXT;
item.iItem = index;
ListView_InsertItem(hListView,&item);
it++; index++;
}
}
unsigned int __stdcall RunTasks(void* args)
{
gTaskItem = 0;
MigrationTaskList::TaskList* tasktlist = MigrationTaskList::GetInstance()->GetList();
while(gTasksRunning && gTaskItem < tasktlist->size())
{
if ((*tasktlist)[gTaskItem]->GetEnabled())
{
if (Button_GetCheck(GetDlgItem(gDlg,IDC_RADIOTEST)) == BST_CHECKED)
(*tasktlist)[gTaskItem]->SetServer(MigrationTask::kTest);
if (Button_GetCheck(GetDlgItem(gDlg,IDC_RADIOLAST)) == BST_CHECKED)
(*tasktlist)[gTaskItem]->SetServer(MigrationTask::kLast);
if (Button_GetCheck(GetDlgItem(gDlg,IDC_RADIOBRANCH)) == BST_CHECKED)
(*tasktlist)[gTaskItem]->SetServer(MigrationTask::kBranch);
ListBox_SetCurSel(GetDlgItem(gDlg,IDC_TASKLIST),gTaskItem);
Static_SetText(GetDlgItem(gDlg,IDC_DESCRIPTION),(*tasktlist)[gTaskItem]->GetDescription());
gTasksRunning = (*tasktlist)[gTaskItem]->Run(gInstance,gDlg) == 0;
}
gTaskItem++;
}
gTaskItem = -1;
SendMessage(gDlg,WM_COMMAND,MAKEWPARAM(IDC_STOP,BN_CLICKED),WPARAM(GetDlgItem(gDlg,IDC_STOP)));
return 0;
}

View File

@ -0,0 +1,49 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef PLASMA_MIGRATION_TOOL
#define PLASMA_MIGRATION_TOOL
#include "MigrationTask.h"
#include <vector>
void LoadTasks(HWND hListView);
unsigned int __stdcall RunTasks(void* args);
class MigrationTaskList
{
public:
typedef std::vector<MigrationTask*> TaskList;
private:
TaskList fList;
public:
MigrationTaskList();
static MigrationTaskList* GetInstance();
TaskList* GetList() { return &fList; }
};
#endif //PLASMA_MIGRATION_TOOL

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,126 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MIGRATION ICON DISCARDABLE "Migration.ICO"
IDI_SMALL ICON DISCARDABLE "SMALL.ICO"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAINDIALOG DIALOG DISCARDABLE 0, 0, 290, 221
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Migrate the Test Servers to Live"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Start",IDC_START,207,13,50,14
PUSHBUTTON "Stop",IDC_STOP,207,30,50,14,WS_DISABLED
LTEXT "Tasks to perform:",IDC_STATIC,19,13,93,8
LTEXT "Description:",IDC_STATIC,190,51,45,9
EDITTEXT IDC_DESCRIPTION,192,67,81,98,ES_MULTILINE |
ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN
CONTROL "List1",IDC_TASKLIST,"SysListView32",LVS_LIST |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,19,26,158,179
GROUPBOX "From Server:",IDC_STATIC,189,168,94,39
CONTROL "Test",IDC_RADIOTEST,"Button",BS_AUTORADIOBUTTON,199,176,
31,13
CONTROL "Last",IDC_RADIOLAST,"Button",BS_AUTORADIOBUTTON,241,176,
29,13
CONTROL "Branch",IDC_RADIOBRANCH,"Button",BS_AUTORADIOBUTTON,217,
189,38,13
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_MAINDIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 283
TOPMARGIN, 7
BOTTOMMARGIN, 214
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,419 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "MigrationTask.h"
#include "OptionalDialog.h"
#include "commctrl.h"
#include "resource.h"
#include "windowsx.h"
#include "shellapi.h"
#define SHARENAME "\\\\data.dni\\Parable-Root"
#define LIVECLIENTDIR "\\dataservers\\live\\game_Clients\\drcExplorer"
#define LIVEEXPANDEDINSTALLDIR "\\dataservers\\live\\game_Install\\Expanded"
int MigrationTask_Backup::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// SSH In & Run the backup Script...
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Server Backup Running";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
ret = !CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"backuplive.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return ret;
}
int MigrationTask_CleanUp::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// Clean up the Test Directory
char* dataloc;
switch (GetServer())
{
case kTest:
dataloc = SHARENAME "\\dataservers\\test\\game_Data";
break;
case kLast:
dataloc = SHARENAME "\\dataservers\\test-last\\game_Data";
break;
case kBranch:
dataloc = SHARENAME "\\dataservers\\branch\\game_Data";
break;
}
ShellExecute(hDlg,"open",dataloc,NULL,NULL,SW_SHOWNORMAL);
if (MessageBox(hDlg, "Press OK to Continue...","Continue", MB_OKCANCEL) == IDCANCEL)
ret = -1;
return ret;
}
int MigrationTask_PatchBuilder::Run(HINSTANCE hInst, HWND hDlg)
{
// Connect to the Data Servers by mapping the share
// Run the patch builder on the Test and Live directories
return 0;
}
int MigrationTask_DataMigration::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// SSH In; Copy the Data to the live
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Migrate the Data sets";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
char* migratecmd;
switch (GetServer())
{
case kTest:
migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-data-live.sh\"";
break;
case kLast:
migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-last-data-live.sh\"";
break;
case kBranch:
migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-branch-data-live.sh\"";
break;
}
ret = !CreateProcess(NULL,migratecmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return ret;
}
int MigrationTask_InstallClient::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// migrate the client support files
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Migrate Client Support";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
char* migratecmd;
switch (GetServer())
{
case kTest:
migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-client-live.sh\"";
break;
case kLast:
migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-test-last-client-live.sh\"";
break;
case kBranch:
migratecmd = "ssh2 parable@build.bone.cyan.com \"migrate-branch-client-live.sh\"";
break;
}
ret = CreateProcess(NULL,migratecmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
// Connect to the Data Servers by mapping the share
NETRESOURCE netres;
memset(&netres,0,sizeof(netres));
netres.lpRemoteName = SHARENAME;
netres.dwDisplayType = RESOURCETYPE_DISK;
ret = (WNetAddConnection3(hDlg,&netres,NULL,NULL,CONNECT_INTERACTIVE) != NO_ERROR);
if (ret == 0)
{
char exe[MAX_PATH];
OPENFILENAME ofn;
SHFILEOPSTRUCT shFileOpt;
// Choose a client to copy across
memset(&exe, 0, sizeof(exe));
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = exe;
ofn.nMaxFile = sizeof(exe);
ofn.lpstrFilter = "Executable (*.EXE)\0*.EXE\0All (*.*)\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = "Choose client exe to be used as drcExplorer.exe";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
while(!GetOpenFileName(&ofn));
// copy the client across
memset(&shFileOpt,0,sizeof(shFileOpt));
shFileOpt.hwnd = hDlg;
shFileOpt.wFunc = FO_COPY;
shFileOpt.pFrom = exe;
shFileOpt.pTo = SHARENAME LIVECLIENTDIR "\\drcExplorer.exe\0";
ret = SHFileOperation(&shFileOpt);
// Choose a client config to copy across
memset(&exe, 0, sizeof(exe));
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = exe;
ofn.nMaxFile = sizeof(exe);
ofn.lpstrFilter = "Executable (*.EXE)\0*.EXE\0All (*.*)\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = "Choose client setup exe to be used as drcConfig.exe";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
while(!GetOpenFileName(&ofn));
// copy the client across
memset(&shFileOpt,0,sizeof(shFileOpt));
shFileOpt.hwnd = hDlg;
shFileOpt.wFunc = FO_COPY;
shFileOpt.pFrom = exe;
shFileOpt.pTo = SHARENAME LIVEEXPANDEDINSTALLDIR "\\drcConfig.exe\0";
ret = SHFileOperation(&shFileOpt);
// Choose a patcher to copy across
memset(&exe, 0, sizeof(exe));
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = exe;
ofn.nMaxFile = sizeof(exe);
ofn.lpstrFilter = "Executable (*.EXE)\0*.EXE\0All (*.*)\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = "Choose patcher exe to be used as drcPatcher.exe";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
while(!GetOpenFileName(&ofn));
// copy the client across
memset(&shFileOpt,0,sizeof(shFileOpt));
shFileOpt.hwnd = hDlg;
shFileOpt.wFunc = FO_COPY;
shFileOpt.pFrom = exe;
shFileOpt.pTo = SHARENAME LIVEEXPANDEDINSTALLDIR "\\drcPatcher.exe\0";
ret = SHFileOperation(&shFileOpt);
// Choose a python.dll to copy across
memset(&exe, 0, sizeof(exe));
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = exe;
ofn.nMaxFile = sizeof(exe);
ofn.lpstrFilter = "Dynamic Lib (*.DLL)\0*.DLL\0All (*.*)\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = "Choose python dll to be used as cypython21.dll";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
while(!GetOpenFileName(&ofn));
// copy the client across
memset(&shFileOpt,0,sizeof(shFileOpt));
shFileOpt.hwnd = hDlg;
shFileOpt.wFunc = FO_COPY;
shFileOpt.pFrom = exe;
shFileOpt.pTo = SHARENAME LIVEEXPANDEDINSTALLDIR "\\cypython21.dll\0";
ret = SHFileOperation(&shFileOpt);
}
return ret;
}
int MigrationTask_GenerateClientManifest::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// Run generate manifest on the directoy on the server
// Connect to the Data Servers by mapping the share
NETRESOURCE netres;
memset(&netres,0,sizeof(netres));
netres.lpRemoteName = SHARENAME;
netres.dwDisplayType = RESOURCETYPE_DISK;
ret = (WNetAddConnection3(hDlg,&netres,NULL,NULL,CONNECT_INTERACTIVE) != NO_ERROR);
if (ret == 0)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
ret = !CreateProcess(NULL,"plGenClientManifest.exe client=drcExplorer.exe dir=" SHARENAME LIVECLIENTDIR,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
}
return ret;
}
int MigrationTask_DropStoredGames::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// SSH In & Run the drop Script...
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Live Game Reset";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
ret = CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"reset-live-games.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return ret;
}
int MigrationTask_InstallAges::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// SSH In; Copy the Age Files from the data to the server AgeFiles folder
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Install Ages";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
ret = !CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"install-live-ages.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return ret;
}
int MigrationTask_CopyTestServers::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// SSH In; Delete ~/Servers; copy ~/Servers-Test to ~/Servers
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Copy Test Servers";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
switch (GetServer())
{
case kTest:
ret = !CreateProcess(NULL,
"ssh2 parable@build.bone.cyan.com \"rm -frv ~/Servers; cp -rv ~/Servers-Test ~/Servers\"",
NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
break;
case kLast:
ret = !CreateProcess(NULL,
"ssh2 parable@build.bone.cyan.com \"rm -frv ~/Servers; cp -rv ~/Servers-Test-Last ~/Servers\"",
NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
break;
case kBranch:
ret = !CreateProcess(NULL,
"ssh2 parable@build.bone.cyan.com \"rm -frv ~/Servers; cp -rv ~/Servers-Branch ~/Servers\"",
NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
break;
}
WaitForSingleObject(pi.hProcess,INFINITE);
return ret;
}
int MigrationTask_StartLiveServers::Run(HINSTANCE hInst, HWND hDlg)
{
int ret = 0;
// SSH In; Start the Live Servers
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USECOUNTCHARS | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_MINIMIZE;
si.lpTitle = "Start Live Servers";
si.dwXCountChars = 80;
si.dwYCountChars = 25;
ZeroMemory( &pi, sizeof(pi) );
ret = !CreateProcess(NULL,"ssh2 parable@build.bone.cyan.com \"start-live-servers.sh\"",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
WaitForSingleObject(pi.hProcess,INFINITE);
return ret;
}

View File

@ -0,0 +1,139 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef MIGRATION_TASK_H
#define MIGRATION_TASK_H
#include <windows.h>
class MigrationTask
{
public:
enum Servers
{
kTest,
kLast,
kBranch
};
private:
bool fEnabled;
Servers fServer;
public:
MigrationTask() : fEnabled(false) {}
virtual char* GetName() = 0;
virtual char* GetDescription() = 0;
bool GetEnabled() const { return fEnabled; }
void SetEnabled(bool val) { fEnabled = val; }
Servers GetServer() const { return fServer; }
void SetServer(Servers server) { fServer = server; }
virtual int Run(HINSTANCE hInst, HWND hDlg) = 0;
};
class MigrationTask_Backup : public MigrationTask
{
public:
char* GetName() { return "Backup Task"; }
char* GetDescription() { return "Backing up Live Data and Live Servers."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_CleanUp : public MigrationTask
{
public:
char* GetName() { return "Test Data Clean-Up"; }
char* GetDescription() { return "Clean up the test data for copying to the live server."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_PatchBuilder : public MigrationTask
{
public:
char* GetName() { return "Patch Building Task"; }
char* GetDescription() { return "Building the patch set to upgrade the client's data."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_DataMigration : public MigrationTask
{
public:
char* GetName() { return "Data Migration Task"; }
char* GetDescription() { return "Copying the data from the Test Server to the Live Server"; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_InstallClient : public MigrationTask
{
public:
char* GetName() { return "Install the Client Files"; }
char* GetDescription() { return "Installs the Client files from a specified directory."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_GenerateClientManifest : public MigrationTask
{
public:
char* GetName() { return "Generate The Client Manifest"; }
char* GetDescription() { return "Generates the Client Manifest from the Client Files on the Server."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_DropStoredGames : public MigrationTask
{
public:
char* GetName() { return "Drop Live Stored Games"; }
char* GetDescription() { return "Drops the Stored Games that are on the live server."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_InstallAges : public MigrationTask
{
public:
char* GetName() { return "Install the Ages"; }
char* GetDescription() { return "Installs the Ages from the live data into the Lookup Server."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_CopyTestServers : public MigrationTask
{
public:
char* GetName() { return "Copy the Test Servers to Live"; }
char* GetDescription() { return "Copy the Test server executables to the Live server."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
class MigrationTask_StartLiveServers : public MigrationTask
{
public:
char* GetName() { return "Start the Live Servers"; }
char* GetDescription() { return "Starts the Live Servers."; }
int Run(HINSTANCE hInst, HWND hDlg);
};
#endif //MIGRATION_TASK_H

View File

@ -0,0 +1,106 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "OptionalDialog.h"
#include "resource.h"
#include <windowsx.h>
LRESULT CALLBACK OptionalDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
bool OptionalDialog(HINSTANCE hInstance, HWND hParent, char* desc, unsigned int timeoutsecs, bool defaultyes)
{
HWND hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_OPTIONALDIALOG), hParent, (DLGPROC) OptionalDialogProc);
ShowWindow(hWnd, SW_SHOW);
if (timeoutsecs > 0)
{
// Set up timer
SetTimer(hWnd,WM_USER+1,timeoutsecs*1000,NULL);
char timeStr[20];
Static_SetText(GetDlgItem(hWnd,IDC_TIMELEFT),itoa(timeoutsecs,timeStr,10));
}
Static_SetText(GetDlgItem(hWnd,IDC_DESCRIPTION),desc);
if (defaultyes)
{
SetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_YES),GWL_STYLE,
GetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_YES),GWL_STYLE) | BS_DEFPUSHBUTTON);
Static_SetText(GetDlgItem(hWnd,IDC_DEFAULT),"Default: Yes");
}
else
{
SetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_NO),GWL_STYLE,
GetWindowLong(GetDlgItem(hWnd,IDC_BUTTON_NO),GWL_STYLE) | BS_DEFPUSHBUTTON);
Static_SetText(GetDlgItem(hWnd,IDC_DEFAULT),"Default: No");
}
// Main message loop:
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if (!IsWindow(hWnd) || !IsDialogMessage(hWnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
DestroyWindow(hWnd);
return msg.wParam == -1 ? defaultyes : (bool)(msg.wParam);
}
// Mesage handler for about box.
LRESULT CALLBACK OptionalDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_TIMER:
PostQuitMessage(-1);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON_YES:
PostQuitMessage(1);
return TRUE;
case IDC_BUTTON_NO:
PostQuitMessage(0);
return TRUE;
default:
return FALSE;
}
break;
}
return FALSE;
}

View File

@ -0,0 +1,33 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef OPTIONAL_DIALOG_H
#define OPTIONAL_DIALOG_H
#include <windows.h>
bool OptionalDialog(HINSTANCE hInstance, HWND hParent, char* desc, unsigned int timeoutsecs, bool defaultyes);
#endif //OPTIONAL_DIALOG_H

View File

@ -0,0 +1,30 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Migration.rc
//
#define IDD_MIGRATION_DIALOG 102
#define IDI_MIGRATION 107
#define IDI_SMALL 108
#define IDD_MAINDIALOG 129
#define IDD_OPTIONALDIALOG 130
#define IDC_TASKLIST 1005
#define IDC_START 1008
#define IDC_STOP 1009
#define IDC_DESCRIPTION 1010
#define IDC_BUTTON_YES 1011
#define IDC_BUTTON_NO 1012
#define IDC_RADIOTEST 1018
#define IDC_RADIOLAST 1019
#define IDC_RADIOBRANCH 1020
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1020
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B