mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Version 1.1 of the windows installer is online and active
This commit is contained in:
parent
cfb8ef0638
commit
9e22b5f47b
18 changed files with 53 additions and 414 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
<variables>
|
<variables>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<author>GlenDC</author>
|
<author>GlenDC</author>
|
||||||
<copyright>CodeCombat.com © 2013-2014</copyright>
|
<copyright>CodeCombat.com © 2013-2014</copyright>
|
||||||
<github_url>https://github.com/codecombat/codecombat.git</github_url>
|
<github_url>https://github.com/codecombat/codecombat.git</github_url>
|
||||||
|
|
|
@ -4,29 +4,31 @@
|
||||||
<b32>
|
<b32>
|
||||||
<nodejs>http://nodejs.org/dist/v0.10.25/node-v0.10.25-x86.msi</nodejs>
|
<nodejs>http://nodejs.org/dist/v0.10.25/node-v0.10.25-x86.msi</nodejs>
|
||||||
<ruby>http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct</ruby>
|
<ruby>http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct</ruby>
|
||||||
<python>http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi</python>
|
<python>http://s3.amazonaws.com/CodeCombatLargeFiles/python-32.msi</python>
|
||||||
</b32>
|
</b32>
|
||||||
<b64>
|
<b64>
|
||||||
<nodejs>http://nodejs.org/dist/v0.10.25/x64/node-v0.10.25-x64.msi</nodejs>
|
<nodejs>http://nodejs.org/dist/v0.10.25/x64/node-v0.10.25-x64.msi</nodejs>
|
||||||
<ruby>http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353-x64.exe?direct</ruby>
|
<ruby>http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353-x64.exe?direct</ruby>
|
||||||
<python>http://www.python.org/ftp/python/2.7.6/python-2.7.6.amd64.msi</python>
|
<python>http://s3.amazonaws.com/CodeCombatLargeFiles/python-64.msi</python>
|
||||||
</b64>
|
</b64>
|
||||||
<gitbash>https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe</gitbash>
|
<general>
|
||||||
|
<gitbash>https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe</gitbash>
|
||||||
|
</general>
|
||||||
</general>
|
</general>
|
||||||
<win7>
|
<Win7>
|
||||||
<b32>
|
<b32>
|
||||||
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</mongodb>
|
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</mongodb>
|
||||||
</b32>
|
</b32>
|
||||||
<b64>
|
<b64>
|
||||||
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.5.4.zip</mongodb>
|
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.5.4.zip</mongodb>
|
||||||
</b64>
|
</b64>
|
||||||
</win7>
|
</Win7>
|
||||||
<vista>
|
<Vista>
|
||||||
<b32>
|
<b32>
|
||||||
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</mongodb>
|
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</mongodb>
|
||||||
</b32>
|
</b32>
|
||||||
<b64>
|
<b64>
|
||||||
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.5.4.zip</mongodb>
|
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.5.4.zip</mongodb>
|
||||||
</b64>
|
</b64>
|
||||||
</vista>
|
</Vista>
|
||||||
</variables>
|
</variables>
|
|
@ -25,7 +25,9 @@ if %system_info_os% == XP (
|
||||||
call print_exit
|
call print_exit
|
||||||
)
|
)
|
||||||
|
|
||||||
call get_category ..\\config\\downloads.coco downloads download_names downloads_count general-general general-%system_info_bit% %system_info_os%-%system_info_bit%
|
call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 0 general general
|
||||||
|
call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 1 %system_info_os% b%system_info_bit%
|
||||||
|
call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 2 general b%system_info_bit%
|
||||||
|
|
||||||
call get_local_text install_process_s1 install process s1
|
call get_local_text install_process_s1 install process s1
|
||||||
call get_local_text install_process_s2 install process s2
|
call get_local_text install_process_s2 install process s2
|
||||||
|
|
4
scripts/windows/coco-dev-setup/batch/scripts/get_variables.bat
Executable file
4
scripts/windows/coco-dev-setup/batch/scripts/get_variables.bat
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
set count=0
|
||||||
|
for /F "delims=" %%F in ('call run_script.bat .\\get_variables.ps1 %*') do (
|
||||||
|
%%F
|
||||||
|
)
|
33
scripts/windows/coco-dev-setup/batch/scripts/get_variables.ps1
Executable file
33
scripts/windows/coco-dev-setup/batch/scripts/get_variables.ps1
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
$xml_file = [xml](get-content $args[0])
|
||||||
|
$arr_value = $args[1]
|
||||||
|
$arr_name = $args[2]
|
||||||
|
$arr_counter = $args[3]
|
||||||
|
$counter = $args[4]
|
||||||
|
|
||||||
|
if($args.count -eq 6)
|
||||||
|
{
|
||||||
|
$root = $xml_file.variables.($args[5])
|
||||||
|
}
|
||||||
|
elseif($args.count -eq 7)
|
||||||
|
{
|
||||||
|
$root = $xml_file.variables.($args[5]).($args[6])
|
||||||
|
}
|
||||||
|
elseif($args.count -eq 8)
|
||||||
|
{
|
||||||
|
$root = $xml_file.variables.($args[5]).($args[6]).($args[7])
|
||||||
|
}
|
||||||
|
elseif($args.count -eq 9)
|
||||||
|
{
|
||||||
|
$nodes = $xml_file.variables.($args[5]).($args[6]).($args[7]).($args[8])
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($node in $root.ChildNodes)
|
||||||
|
{
|
||||||
|
$counter += 1
|
||||||
|
$value = $node.InnerText
|
||||||
|
$name = $node.Name
|
||||||
|
Write-Host set "$arr_value[$counter]=$value"
|
||||||
|
Write-Host set "$arr_name[$counter]=$name"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host set "$arr_counter=$counter"
|
|
@ -1 +1,2 @@
|
||||||
|
@echo off
|
||||||
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& "%*"
|
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& "%*"
|
|
@ -2,7 +2,7 @@
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
Color 0A
|
Color 0A
|
||||||
mode con: cols=78 lines=55
|
mode con: cols=79 lines=55
|
||||||
|
|
||||||
call print_header
|
call print_header
|
||||||
call print_dashed_seperator
|
call print_dashed_seperator
|
||||||
|
@ -33,7 +33,7 @@ call print_finished_header
|
||||||
call print_dashed_seperator
|
call print_dashed_seperator
|
||||||
|
|
||||||
call get_local_text end_succesfull end succesfull
|
call get_local_text end_succesfull end succesfull
|
||||||
call get_local_text end_thankyou end_thankyou
|
call get_local_text end_thankyou end thankyou
|
||||||
echo %end_succesfull%
|
echo %end_succesfull%
|
||||||
echo %end_thankyou%
|
echo %end_thankyou%
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
|
||||||
<variables>
|
|
||||||
<version>1.0</version>
|
|
||||||
<author>GlenDC</author>
|
|
||||||
<copyright>CodeCombat.com © 2013-2014</copyright>
|
|
||||||
</variables>
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
|
||||||
<variables>
|
|
||||||
<general>
|
|
||||||
<b32>
|
|
||||||
<nodejs>http://nodejs.org/dist/v0.10.25/node-v0.10.25-x86.msi</nodejs>
|
|
||||||
<ruby>http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct</ruby>
|
|
||||||
<python>http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi</python>
|
|
||||||
</b32>
|
|
||||||
<b64>
|
|
||||||
<nodejs>http://nodejs.org/dist/v0.10.25/x64/node-v0.10.25-x64.msi</nodejs>
|
|
||||||
<ruby>http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353-x64.exe?direct</ruby>
|
|
||||||
<python>http://www.python.org/ftp/python/2.7.6/python-2.7.6.amd64.msi</python>
|
|
||||||
</b64>
|
|
||||||
<gitbash>https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe</gitbash>
|
|
||||||
</general>
|
|
||||||
<win7>
|
|
||||||
<b32>mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</b32>
|
|
||||||
<b64>mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.5.4.zip</b64>
|
|
||||||
</win7>
|
|
||||||
<vista>
|
|
||||||
<b32>mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</b32>
|
|
||||||
<b64>mongodb=http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.5.4.zip</b64>
|
|
||||||
</vista>
|
|
||||||
</variables>
|
|
|
@ -1,53 +0,0 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
|
||||||
<variables>
|
|
||||||
<global>
|
|
||||||
<native>English</native>
|
|
||||||
<bye>Bye Bye!</bye>
|
|
||||||
</global>
|
|
||||||
<install>
|
|
||||||
<begin>Installation has begun, this can take a while... Please stay tuned...</begin>
|
|
||||||
<close>Don't close any windows please, unless specified explicitly.</close>
|
|
||||||
</install>
|
|
||||||
<dai>
|
|
||||||
<title>[DOWNLOADING AND INSTALLING 3RD PARTY SOFTWARE]</title>
|
|
||||||
<downloading>downloading:</downloading>
|
|
||||||
<installing>installing:</installing>
|
|
||||||
<cancel>Download and Installation cancelled...</cancel>
|
|
||||||
<software>Software has been installed...</software>
|
|
||||||
<devenv>Installation of the Developers Environment is complete!</devenv>
|
|
||||||
<stop>Installation has been stopped...</stop>
|
|
||||||
<unpacking>unpacking and moving:</unpacking>
|
|
||||||
<bower>Installing bower, brunch, nodemon and sendwithus...</bower>
|
|
||||||
</dai>
|
|
||||||
<git>
|
|
||||||
<stored>CodeCombat is safely stored on a git repository.</stored>
|
|
||||||
<clapp>Therefore you need a git command-line application (Git-bash).</clapp>
|
|
||||||
<examples>Examples: git-bash, CygWin, ...</examples>
|
|
||||||
<question>Do you already have git-bash?</question>
|
|
||||||
<path>Enter the path to where you installed Git-bash</path>
|
|
||||||
<checkout>Checking out the Git Repository...</checkout>
|
|
||||||
<username>Please enter your github username:</username>
|
|
||||||
</git>
|
|
||||||
<nodejs>
|
|
||||||
<question>Do you already have the latest version of node-js installed?</question>
|
|
||||||
<path>Please enter the full path of the location you installed nodejs to:</path>
|
|
||||||
</nodejs>
|
|
||||||
<ruby>
|
|
||||||
<question>Do you already have the latest version of ruby installed?</question>
|
|
||||||
</ruby>
|
|
||||||
<mongodb>
|
|
||||||
<question>Do you already have the latest version of mongo-db installed?</question>
|
|
||||||
<path>Enter the path where you would like to install MongoDB:</path>
|
|
||||||
</mongodb>
|
|
||||||
<python>
|
|
||||||
<question>Do you already have the latest version of python installed?</question>
|
|
||||||
</python>
|
|
||||||
<error>
|
|
||||||
<xp>Sadly we can't support Windows XP... Please upgrade your OS!</xp>
|
|
||||||
<os>Machine OS cannot be determined...</os>
|
|
||||||
<osreport>Report your OS to the developers @ CodeCombat.com...</osreport>
|
|
||||||
<nocleaning>... Cleaning up has been disabled... Terminating Script!</nocleaning>
|
|
||||||
<git_app_path>The path to your git application is incorrect, please try again...</git_app_path>
|
|
||||||
<invalid_path>The path you entered is invalid, please try again...</invalid_path>
|
|
||||||
</error>
|
|
||||||
</variables>
|
|
|
@ -1,3 +0,0 @@
|
||||||
powershell .\get_var.ps1 config.coco %1 > var.tmp
|
|
||||||
set /p %1= < var.tmp
|
|
||||||
del /q var.tmp
|
|
|
@ -1,4 +0,0 @@
|
||||||
@ECHO off
|
|
||||||
powershell .\get_var.ps1 downloads.coco %2 %3 %4 %5 %6 > var.tmp
|
|
||||||
set /p %1= < var.tmp
|
|
||||||
del /q var.tmp
|
|
|
@ -1,4 +0,0 @@
|
||||||
@ECHO off
|
|
||||||
powershell .\get_var.ps1 %1.coco %3 %4 %5 %6 %7 > var.tmp
|
|
||||||
set /p %2= < var.tmp
|
|
||||||
del /q var.tmp
|
|
|
@ -1,17 +0,0 @@
|
||||||
$xml_file = [xml](get-content $args[0])
|
|
||||||
if($args.count -eq 2)
|
|
||||||
{
|
|
||||||
$xml_file.variables.($args[1])
|
|
||||||
}
|
|
||||||
elseif($args.count -eq 3)
|
|
||||||
{
|
|
||||||
$xml_file.variables.($args[1]).($args[2])
|
|
||||||
}
|
|
||||||
elseif($args.count -eq 4)
|
|
||||||
{
|
|
||||||
$xml_file.variables.($args[1]).($args[2]).($args[3])
|
|
||||||
}
|
|
||||||
elseif($args.count -eq 5)
|
|
||||||
{
|
|
||||||
$xml_file.variables.($args[1]).($args[2]).($args[3]).($args[4])
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
@echo off
|
|
||||||
powershell "& "%*"
|
|
|
@ -1,146 +0,0 @@
|
||||||
#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 & id_array_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)
|
|
||||||
);
|
|
||||||
SetArrayVariable(
|
|
||||||
id_array_name, id++,
|
|
||||||
line.substr(cpos, pos - 3)
|
|
||||||
);
|
|
||||||
++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 name of the name-array.");
|
|
||||||
else if(argc == 4)
|
|
||||||
return ErrorReport(L"Please specify the counter parameter.");
|
|
||||||
else if(argc == 5)
|
|
||||||
return ErrorReport(L"Please specify one or more categories you are looking for.");
|
|
||||||
|
|
||||||
tstring file, name, counter_name, id_array_name;
|
|
||||||
file = argv[1];
|
|
||||||
name = argv[2];
|
|
||||||
id_array_name = argv[3];
|
|
||||||
counter_name = argv[4];
|
|
||||||
int id = 1;
|
|
||||||
|
|
||||||
for(int i = 5 ; i < argc ; ++i)
|
|
||||||
{
|
|
||||||
std::vector<tstring> information;
|
|
||||||
GetHashInfo(argv[i], information);
|
|
||||||
FillArray(information, name, id_array_name, file, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
tcout << L"set \"" << counter_name << L"=" << (id - 1) << L"\"";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
#include "stdafx.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <vector>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#define tstring std::wstring
|
|
||||||
#define tcout std::wcout
|
|
||||||
|
|
||||||
int ErrorReport(const tstring & str, int value = 0)
|
|
||||||
{
|
|
||||||
tcout << str.c_str();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _tmain(int argc, _TCHAR* argv[])
|
|
||||||
{
|
|
||||||
if(argc == 1)
|
|
||||||
return ErrorReport(L"Please specify a download URL.");
|
|
||||||
if(argc == 2)
|
|
||||||
return ErrorReport(L"Please specify a name for your variable.");
|
|
||||||
|
|
||||||
tstring url, name, extension;
|
|
||||||
url = argv[1];
|
|
||||||
name = argv[2];
|
|
||||||
|
|
||||||
if(url.find(L"exe") != tstring::npos) extension = L"exe";
|
|
||||||
else if(url.find(L"msi") != tstring::npos) extension = L"msi";
|
|
||||||
else if(url.find(L"zip") != tstring::npos) extension = L"zip";
|
|
||||||
|
|
||||||
tcout << L"set \"" << name << L"=";
|
|
||||||
tcout << extension << L"\"";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,108 +0,0 @@
|
||||||
#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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring GetText(const std::vector<tstring> & info, const tstring & file)
|
|
||||||
{
|
|
||||||
if(info.size() == 0) return L"Info Size is 0.";
|
|
||||||
|
|
||||||
auto it = info.begin();
|
|
||||||
auto last = info.end() - 1;
|
|
||||||
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 L"File couldn't be opened.";
|
|
||||||
}
|
|
||||||
|
|
||||||
tstring line;
|
|
||||||
while (std::getline(infile, line))
|
|
||||||
{
|
|
||||||
size_t cpos = line.find('[');
|
|
||||||
if(nlc++ == 0 || cpos == indention)
|
|
||||||
{
|
|
||||||
indention = cpos;
|
|
||||||
if(line.find(*it) != tstring::npos)
|
|
||||||
{
|
|
||||||
if(it == last)
|
|
||||||
{
|
|
||||||
size_t pos = line.find(L'=') + 1;
|
|
||||||
infile.close();
|
|
||||||
return line.substr(pos, line.size() - pos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++it;
|
|
||||||
nlc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
infile.close();
|
|
||||||
return L"Var couldn't be found.";
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ID you are looking for.");
|
|
||||||
|
|
||||||
tstring file, hash;
|
|
||||||
file = argv[1];
|
|
||||||
hash = argv[2];
|
|
||||||
|
|
||||||
std::vector<tstring> information;
|
|
||||||
GetHashInfo(hash, information);
|
|
||||||
|
|
||||||
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…
Reference in a new issue