Commit 40bd008b authored by Yannick Bass's avatar Yannick Bass
Browse files

clean convert

parent 63e21270
Loading
Loading
Loading
Loading
+10 −10
Changes for Utils/convert.cpp: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -18,10 +18,10 @@ int main(int argc,char* argv[]) {
	wifstream readfile(filename);
	wofstream writefile(outputfile.c_str());
	wstring line;
	wstring key  = wstring(L"^\\s+");
	wstring cleanKey  = wstring(L"^\\s+");
	wstring repl = wstring(L"");

	wstring key2  = wstring(L"(\\d+) (.+)");
	wstring parseKey  = wstring(L"(\\d+) (.+)");
	double sum=0;
	while(readfile.good())
	{
@@ -31,16 +31,16 @@ int main(int argc,char* argv[]) {
    	continue;
		}

		wstring cleanLine = regex_replace(line, std::wregex(key),  repl);
		wsmatch m;
		regex_match(cleanLine,m,std::wregex(key2));
		if(m.size()>2)
		wstring cleanLine = regex_replace(line, std::wregex(cleanKey),  repl);
		wsmatch parsedPassword;
		regex_match(cleanLine,parsedPassword,std::wregex(parseKey));
		if(parsedPassword.size()>2)
		{
			int i=stoi(m[1]);
			sum+=i;
			for(int j=0;j<i;j++)
			int nbPasswords=stoi(parsedPassword[1]);
			sum+=nbPasswords;
			for(int j=0;j<nbPasswords;j++)
			{
				writefile << m[2] << endl;
				writefile << parsedPassword[2] << endl;
			}
		}
  }