Skip to content

Commit

Permalink
replaced every wcerr with wcout, then replaced the registry related o…
Browse files Browse the repository at this point in the history
…nes with MessageBox
  • Loading branch information
Nicholas O'Connor committed Jan 9, 2016
1 parent 07a179e commit c50c815
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions Tilandis/Tilandis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* by Nicholas "Lavacano" O'Connor
* Purpose: I'll make my own TileCreator proxy! With blackjack! And hookers!
*/

#include <iostream>
// Tilandis code
#include "Tilandis.h"
#include "exceptions.h"
Expand All @@ -24,7 +24,7 @@ int CALLBACK wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR, int nShow) {

Tilandis::BaseDirectory = Utility::basedir(argvzerostr);
if (!Tilandis::Links::PrepareTheLinkDocument()) {
std::wcerr << "Failed to prepare the link document." << std::endl;
std::wcout << "Failed to prepare the link document." << std::endl;
return 1;
}
if (Tilandis::UsingCommandLine(argc, argv)) { // FIXME: Commandline processing, while it works, is extremely friggin weird because I wrote it stoned
Expand All @@ -35,24 +35,28 @@ int CALLBACK wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR, int nShow) {
try {
bool success = Tilandis::Links::CreateLink();
if (!success) {
std::wcerr << Tilandis::Err << std::endl;
std::wcout << Tilandis::Err << std::endl;
}
}
catch (Tilandis::Exceptions::BadCommandLine exc) {
std::wcerr << exc.what() << std::endl;
std::wcout << exc.what() << std::endl;
return 1;
}
}
if (Tilandis::AddToRegistry) {
bool result = Tilandis::RegisterProtocol();
if (!result) {
std::wcerr << "Failed to register Tilandis with specified protocol (hint: this function needs administrator rights)" << std::endl;
MessageBox(NULL, L"Failed to register Tilandis with specified protocol (hint: this function needs administrator rights)", L"Tilandis", 0);
return 1;
}
else {
MessageBox(NULL, L"Tilandis has \"successfully\" registered itself with the specified protocol.\r\nBe aware that though no error is reported, many failure cases aren't currently detected. You'll have to double-check the registry yourself.", L"Tilandis", 0);
return 0;
}
}
}
catch (Tilandis::Exceptions::BadCommandLine exc) {
std::wcerr << exc.what() << std::endl;
std::wcout << exc.what() << std::endl;
return 1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tilandis/cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool Tilandis::UsingCommandLine(int argc, wchar_t* argv[]) {
lookingforarg = true;
break;
default:
std::wcerr << "Unrecognized argument: " << curargstr << std::endl;
std::wcout << "Unrecognized argument: " << curargstr << std::endl;
Tilandis::PrintUsage(argv[0]);
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions Tilandis/linkmgmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool Tilandis::Links::PrepareTheLinkDocument() {
*/
FILE* infile;
std::wstring configfilename = Tilandis::BaseDirectory + L"\\links.json";
std::wcerr << configfilename << std::endl;
//std::wcerr << configfilename << std::endl;
errno_t errcode = _wfopen_s(&infile, configfilename.c_str(), L"r");
rapidjson::ParseResult result;
if (errcode == 0) {
Expand All @@ -47,7 +47,7 @@ bool Tilandis::Links::PrepareTheLinkDocument() {
result = Tilandis::Links::LinkDocument->Parse(L"{}");
}
if (!result) { // It failed
std::cerr << result.Code() << std::endl;
//std::cerr << result.Code() << std::endl;
return false;
}
else { return true; }
Expand Down

0 comments on commit c50c815

Please sign in to comment.