mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Get System Information works, array of downloads is now also available. Ready to start the download and install process.
This commit is contained in:
parent
dd47b82055
commit
1c092deff6
12 changed files with 213 additions and 82 deletions
scripts/windows/coco-dev-setup
14
scripts/windows/coco-dev-setup/batch/download_and_install_applications.bat
Executable file
14
scripts/windows/coco-dev-setup/batch/download_and_install_applications.bat
Executable file
|
@ -0,0 +1,14 @@
|
|||
call get_system_information
|
||||
call print_dashed_seperator
|
||||
|
||||
if %system_info_os% == XP (
|
||||
call get_local_text install-system-xp
|
||||
echo !install_system_xp!
|
||||
call print_exit
|
||||
)
|
||||
|
||||
call get_category config\\downloads.coco downloads downloads_count general-general general-%system_info_bit% %system_info_os%-%system_info_bit%
|
||||
|
||||
::for /l %%i in (1, 1, %downloads_count%) do (
|
||||
:: echo %downloads[%%i]%
|
||||
::)
|
3
scripts/windows/coco-dev-setup/batch/get_category.bat
Executable file
3
scripts/windows/coco-dev-setup/batch/get_category.bat
Executable file
|
@ -0,0 +1,3 @@
|
|||
for /f "delims=" %%a in ('utilities\\get_category.exe %*') do (
|
||||
%%a
|
||||
)
|
|
@ -6,7 +6,7 @@ call print_dashed_seperator
|
|||
call get_array localisation\\languages.coco languages language_count
|
||||
for /l %%i in (1,1,%language_count%) do (
|
||||
call get_text !languages[%%i]! "global-native"
|
||||
echo [%%i] !native!
|
||||
echo [%%i] !global_native!
|
||||
)
|
||||
|
||||
goto:get_localisation_id
|
||||
|
@ -29,8 +29,8 @@ goto:get_localisation_id
|
|||
set language_id=!languages[%local_id%]!
|
||||
call get_text !language_id! "global-native"
|
||||
call print_dashed_seperator
|
||||
echo You have choosen !native! as your language.
|
||||
echo You have choosen !global_native! as your language.
|
||||
call get_text !language_id! "global-intro"
|
||||
echo !intro!
|
||||
echo !global_intro!
|
||||
call print_seperator
|
||||
)
|
1
scripts/windows/coco-dev-setup/batch/get_local_text.bat
Executable file
1
scripts/windows/coco-dev-setup/batch/get_local_text.bat
Executable file
|
@ -0,0 +1 @@
|
|||
call get_text %language_id% %1
|
31
scripts/windows/coco-dev-setup/batch/get_system_information.bat
Executable file
31
scripts/windows/coco-dev-setup/batch/get_system_information.bat
Executable file
|
@ -0,0 +1,31 @@
|
|||
if exist "%PROGRAMFILES(X86)%" (
|
||||
call:set_bit 64
|
||||
) else (
|
||||
call:set_bit 32
|
||||
)
|
||||
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "5.2" ( call:set_os XP )
|
||||
if "%version%" == "6.0" ( call:set_os Vista )
|
||||
if "%version%" == "6.1" ( call:set_os Win7 )
|
||||
:: we handle win8.0 as win7
|
||||
if "%version%" == "6.2" ( call:set_os Win7 )
|
||||
:: we handle win8.1 as win7
|
||||
if "%version%" == "6.3" ( call:set_os Win7 )
|
||||
|
||||
goto:end
|
||||
|
||||
:set_bit
|
||||
call get_local_text install-system-bit
|
||||
set system_info_bit=%~1
|
||||
echo %system_info_bit%%install_system_bit%
|
||||
goto:eof
|
||||
|
||||
:set_os
|
||||
set system_info_os=%~1
|
||||
call get_local_text install-system-prefix
|
||||
call get_local_text install-system-sufix
|
||||
echo %install_system_prefix% %system_info_os% %install_system_sufix%
|
||||
goto:eof
|
||||
|
||||
:end
|
|
@ -1,42 +1,9 @@
|
|||
[global]
|
||||
native=English
|
||||
intro=From now on we'll send our feedback in English!
|
||||
bye=Bye Bye!
|
||||
[install]
|
||||
begin=Installation has begun, this can take a while... Please stay tuned...
|
||||
close=Don't close any windows please, unless specified explicitly.
|
||||
[dai]
|
||||
title=[DOWNLOADING AND INSTALLING 3RD PARTY SOFTWARE]
|
||||
downloading=downloading:
|
||||
installing=installing:
|
||||
cancel=Download and Installation cancelled...
|
||||
software=Software has been installed...
|
||||
devenv=Installation of the Developers Environment is complete!
|
||||
stop=Installation has been stopped...
|
||||
unpacking=unpacking and moving:
|
||||
bower=Installing bower, brunch, nodemon and sendwithus...
|
||||
[git]
|
||||
stored=CodeCombat is safely stored on a git repository.
|
||||
clapp=Therefore you need a git command-line application (Git-bash).
|
||||
examples=Examples: git-bash, CygWin, ...
|
||||
question=Do you already have git-bash?
|
||||
path=Enter the path to where you installed Git-bash
|
||||
checkout=Checking out the Git Repository...
|
||||
username=Please enter your github username:
|
||||
[nodejs]
|
||||
question=Do you already have the latest version of node-js installed?
|
||||
path=Please enter the full path of the location you installed nodejs to:
|
||||
[ruby]
|
||||
question=Do you already have the latest version of ruby installed?
|
||||
[mongodb]
|
||||
question=Do you already have the latest version of mongo-db installed?
|
||||
path=Enter the path where you would like to install MongoDB:
|
||||
[python]
|
||||
question=Do you already have the latest version of python installed?
|
||||
[error]
|
||||
xp=Sadly we can't support Windows XP... Please upgrade your OS!
|
||||
os=Machine OS cannot be determined...
|
||||
osreport=Report your OS to the developers @ CodeCombat.com...
|
||||
nocleaning=... Cleaning up has been disabled... Terminating Script!
|
||||
git_app_path=The path to your git application is incorrect, please try again...
|
||||
invalid_path=The path you entered is invalid, please try again...
|
||||
[system]
|
||||
bit=-bit computer detected.
|
||||
prefix=The operating system
|
||||
sufix=was detected.
|
||||
xp=We don't support Windows XP, installation cancelled.
|
|
@ -1,42 +1,9 @@
|
|||
[global]
|
||||
native=Nederlands
|
||||
intro=Vanaf nu geven we onze feedback in het Nederlands!
|
||||
bye=Bye Bye!
|
||||
[install]
|
||||
begin=De installatie is begonnen, dit kan een tijdje duren. Geduld alsjeblieft...
|
||||
close=Don't close any windows please, unless specified explicitly.
|
||||
[dai]
|
||||
title=[DOWNLOADING AND INSTALLING 3RD PARTY SOFTWARE]
|
||||
downloading=downloading:
|
||||
installing=installing:
|
||||
cancel=Download and Installation cancelled...
|
||||
software=Software has been installed...
|
||||
devenv=Installation of the Developers Environment is complete!
|
||||
stop=Installation has been stopped...
|
||||
unpacking=unpacking and moving:
|
||||
bower=Installing bower, brunch, nodemon and sendwithus...
|
||||
[git]
|
||||
stored=CodeCombat is safely stored on a git repository.
|
||||
clapp=Therefore you need a git command-line application (Git-bash).
|
||||
examples=Examples: git-bash, CygWin, ...
|
||||
question=Do you already have git-bash?
|
||||
path=Enter the path to where you installed Git-bash
|
||||
checkout=Checking out the Git Repository...
|
||||
username=Please enter your github username:
|
||||
[nodejs]
|
||||
question=Do you already have the latest version of node-js installed?
|
||||
path=Please enter the full path of the location you installed nodejs to:
|
||||
[ruby]
|
||||
question=Do you already have the latest version of ruby installed?
|
||||
[mongodb]
|
||||
question=Do you already have the latest version of mongo-db installed?
|
||||
path=Enter the path where you would like to install MongoDB:
|
||||
[python]
|
||||
question=Do you already have the latest version of python installed?
|
||||
[error]
|
||||
xp=Sadly we can't support Windows XP... Please upgrade your OS!
|
||||
os=Machine OS cannot be determined...
|
||||
osreport=Report your OS to the developers @ CodeCombat.com...
|
||||
nocleaning=... Cleaning up has been disabled... Terminating Script!
|
||||
git_app_path=The path to your git application is incorrect, please try again...
|
||||
invalid_path=The path you entered is invalid, please try again...
|
||||
[system]
|
||||
bit=-bit computer gedetecteerd.
|
||||
prefix=Het besturingsysteem
|
||||
sufix=is gedetecteerd.
|
||||
xp=Wij ondersteunen Windows XP niet, installatie geanulleerd.
|
2
scripts/windows/coco-dev-setup/batch/print_exit.bat
Executable file
2
scripts/windows/coco-dev-setup/batch/print_exit.bat
Executable file
|
@ -0,0 +1,2 @@
|
|||
set /p res="Press any key to exit..."
|
||||
exit
|
|
@ -22,6 +22,8 @@ call sign_license
|
|||
|
||||
call get_language
|
||||
|
||||
call download_and_install_applications
|
||||
|
||||
pause
|
||||
|
||||
endlocal
|
|
@ -10,6 +10,6 @@ call print_dashed_seperator
|
|||
|
||||
if "%result%"=="false" (
|
||||
echo This setup can't happen without an agreement.
|
||||
set /p res="Installation and Setup of the CodeCombat environment is cancelled."
|
||||
exit
|
||||
echo Installation and Setup of the CodeCombat environment is cancelled.
|
||||
call print_exit
|
||||
)
|
138
scripts/windows/coco-dev-setup/src/get_category.cpp
Executable file
138
scripts/windows/coco-dev-setup/src/get_category.cpp
Executable file
|
@ -0,0 +1,138 @@
|
|||
#include "stdafx.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#define tstring std::wstring
|
||||
#define tcout std::wcout
|
||||
|
||||
static const tstring DEF_URL = L"http://www.google.com";
|
||||
|
||||
int ErrorReport(const tstring & str, int value = 0)
|
||||
{
|
||||
tcout << str.c_str();
|
||||
return value;
|
||||
}
|
||||
|
||||
void GetHashInfo(tstring id, std::vector<std::wstring> & info) {
|
||||
while(id.size() > 0)
|
||||
{
|
||||
size_t pos = id.find(L'-');
|
||||
|
||||
tstring substr =
|
||||
id.substr(0, pos == tstring::npos ? id.length() : pos);
|
||||
info.push_back(substr);
|
||||
|
||||
if(pos == tstring::npos) id = L"";
|
||||
else
|
||||
{
|
||||
++pos;
|
||||
id = id.substr(pos, id.length() - pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetArrayVariable(
|
||||
const tstring & name,
|
||||
int id,
|
||||
const tstring & line
|
||||
)
|
||||
{
|
||||
tcout << L"set \"";
|
||||
tcout << name;
|
||||
tcout << L"[" << id << "]";
|
||||
tcout << L"=" << line;
|
||||
tcout << L"\"" << std::endl;
|
||||
}
|
||||
|
||||
void FillArray(
|
||||
const std::vector<tstring> & info,
|
||||
const tstring & name,
|
||||
const tstring & file,
|
||||
int & id
|
||||
)
|
||||
{
|
||||
if(info.size() == 0) return;
|
||||
|
||||
auto it = info.begin();
|
||||
size_t indention = 0;
|
||||
unsigned int nlc = 0;
|
||||
|
||||
std::wifstream infile(file.c_str(), std::ifstream::in);
|
||||
|
||||
if(!infile)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
tcout << file.c_str() << std::endl;
|
||||
tcout << strerror(errno) << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
tstring line;
|
||||
int counter = 1;
|
||||
while (std::getline(infile, line))
|
||||
{
|
||||
size_t cpos = line.find('[');
|
||||
if(cpos == tstring::npos)
|
||||
{
|
||||
cpos = line.find_first_not_of(L" \t\r\n");
|
||||
}
|
||||
if(nlc++ == 0 || cpos == indention)
|
||||
{
|
||||
indention = cpos;
|
||||
if(it == info.end())
|
||||
{
|
||||
size_t pos = line.find(L'=') + 1;
|
||||
SetArrayVariable(
|
||||
name, id++,
|
||||
line.substr(pos, line.size() - pos)
|
||||
);
|
||||
++counter;
|
||||
}
|
||||
else if(line.find(*it) != tstring::npos)
|
||||
{
|
||||
++it;
|
||||
nlc = 0;
|
||||
}
|
||||
}
|
||||
else if(counter > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
infile.close();
|
||||
return;
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if(argc == 1)
|
||||
return ErrorReport(L"Please specify a localisation file.");
|
||||
else if(argc == 2)
|
||||
return ErrorReport(L"Please specify the name of the array");
|
||||
else if(argc == 3)
|
||||
return ErrorReport(L"Please specify the counter parameter");
|
||||
else if(argc == 4)
|
||||
return ErrorReport(L"Please specify one or more categories you are looking for.");
|
||||
|
||||
tstring file, name, counter_name;
|
||||
file = argv[1];
|
||||
name = argv[2];
|
||||
counter_name = argv[3];
|
||||
int id = 1;
|
||||
|
||||
for(int i = 4 ; i < argc ; ++i)
|
||||
{
|
||||
std::vector<tstring> information;
|
||||
GetHashInfo(argv[i], information);
|
||||
FillArray(information, name, file, id);
|
||||
}
|
||||
|
||||
tcout << L"set \"" << counter_name << L"=" << (id - 1) << L"\"";
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -96,7 +96,13 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
std::vector<tstring> information;
|
||||
GetHashInfo(hash, information);
|
||||
|
||||
tcout << GetText(information, file);
|
||||
size_t size = information.size();
|
||||
for(unsigned int i = 0 ; i < size ; ++i)
|
||||
{
|
||||
tcout << information[i];
|
||||
if(i != size - 1) tcout << L"_";
|
||||
}
|
||||
tcout << L"=" << GetText(information, file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue