631{
632 if (
pSettings->checkingForUpdates) _endthread();
633 else
634 {
635
637
638
639 }
640
641 bool silent = *((bool*)param);
642 int updates = 0;
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674 strcat(listOfURLs,
pSettings->pluginsRepository);
675
676
677
679 {
681 strcat(path, "update.log");
682
684
685
686
688 {
693
695 {
698 {
702
703 sprintf(parameter, "%s.version:", plugin);
704 strcpy(onlineVersion,
ReadString(path, parameter,
""));
705 if (!strlen(onlineVersion))
706 {
707
709 continue;
710 }
711 sprintf(parameter, "%s.date:", plugin);
712 strcpy(onlineDate,
ReadString(path, parameter,
"xxxx-xx-xx"));
713
714
715
716
717 if (!_stricmp(currentDate, onlineDate))
718 {
719 if (!_stricmp(currentVersion, onlineVersion))
720 {
721
723 continue;
724 }
725 }
726
727
729
730 sprintf(parameter, "%s.author:", plugin);
732
733 sprintf(msg, "\n%s %s by %s (%s) ", plugin, onlineVersion, onlineAuthor, onlineDate);
734 strcat(listOfUpdates, msg);
735 updates++;
736 }
738 }
739 }
740 else
741 {
742 strcpy(msg, "Note: Some repositories were not currently available, \nwhich may affect the result of this check for updates. ");
743 MessageBox(
GetBBWnd(), msg,
"xoblite", MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
744 }
745 }
746
747
748
749 if (!silent)
750 {
752 ULONG *size = 0;
753 void *versionPtr;
754 UINT bytes;
755
756
757
758 DWORD number = GetFileVersionInfoSize("Blackbox.exe", size);
760 GetFileVersionInfo("Blackbox.exe", NULL, number, (LPVOID)temp);
761 VerQueryValue(temp, TEXT("\\StringFileInfo\\000004b0\\FileVersion"), &versionPtr, &bytes);
762 strcpy(xobVersion, (LPCSTR)versionPtr);
763 if ((xobVersion[strlen(xobVersion)-1] == '\n') || (xobVersion[strlen(xobVersion)-1] == '\r')) xobVersion[strlen(xobVersion)-1] = '\0';
764
765
766 strcpy(xobOnlineVersion,
ReadString(path,
"xoblite.version:",
""));
767 if ((xobOnlineVersion[strlen(xobOnlineVersion)-1] == '\n') || (xobOnlineVersion[strlen(xobOnlineVersion)-1] == '\r')) xobOnlineVersion[strlen(xobOnlineVersion)-1] = '\0';
768
769 bool xobliteUpdateFound = false;
770 if (strlen(xobOnlineVersion) && _stricmp(xobVersion, xobOnlineVersion)) xobliteUpdateFound = true;
771
772
773
774
775 if (updates > 0)
776 {
777 if (xobliteUpdateFound) sprintf(msg, "Checking for updates -> xoblite %s and %d updated plugin", xobOnlineVersion, updates);
778 else sprintf(msg, "Checking for updates -> %d updated plugin", updates);
779 if (updates > 1) strcat(msg, "s");
780 strcat(msg, " available.");
781 }
782 else if (xobliteUpdateFound) sprintf(msg, "Checking for updates -> xoblite %s available.", xobOnlineVersion);
783 else strcpy(msg, "Checking for updates -> No updates were found.");
784
786
787
788
789 if (xobliteUpdateFound)
790 {
791 sprintf(msg, "Shell update found! \n\nCurrent version: \nxoblite %s \n\nOnline version: \nxoblite %s \n\nDo you want to download this update? \n(clicking \"Yes\" will take you to the xoblite website) ", xobVersion, xobOnlineVersion);
792
793 if (MessageBox(
GetBBWnd(), msg,
"xoblite", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TOPMOST) == IDYES)
794 {
795
796
797
798 BBExecute(GetDesktopWindow(), NULL,
"http://xoblite.net/", NULL, NULL, SW_SHOWNORMAL,
true);
799 }
800
801
802
803
804
805 }
806
807
808
809 if (updates > 0)
810 {
811 sprintf(msg, "Found %d updated plugins: \n", updates);
812 strcat(msg, listOfUpdates);
813 if (updates == 1) strcat(msg, "\n\nDo you want to download this update? ");
814 else strcat(msg, "\n\nDo you want to download any of these updates? ");
815
816 if (MessageBox(
GetBBWnd(), msg,
"xoblite", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TOPMOST) == IDYES)
817 {
819 {
821 {
825 }
826 }
827 }
828 }
829 else
830 {
831 strcpy(msg, "No updated plugins were found. ");
832 MessageBox(
GetBBWnd(), msg,
"xoblite", MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
833 }
834 }
835
836
837
838
839 time_t systemTime;
840 struct tm localTime;
841 time(&systemTime);
842 localtime_s(&localTime, &systemTime);
843
844 _locale_t timestampLocale = _create_locale(LC_TIME, "en-US");
845 _strftime_l(
pSettings->checkedForUpdates, 20,
"#%j / %Y-%m-%d", &localTime, timestampLocale);
846 _free_locale(timestampLocale);
847
848 bool tempBool =
pSettings->writeProtection;
852
853
854
855
857
858
859 _endthread();
860}
void WriteString(LPCSTR fp, LPCSTR keyword, LPSTR value)
Definition BBApi.cpp:3156
bool DownloadFile(LPCSTR url, LPCSTR path)
Definition BBApi.cpp:3296
bool IsInString(LPCSTR inputString, LPCSTR searchString)
Definition BBApi.cpp:2519
LPSTR ReadString(LPCSTR fp, LPCSTR szString, LPSTR szDefault)
Definition BBApi.cpp:544
bool FileExists(LPCSTR szFileName)
Definition BBApi.cpp:819
bool WINAPI GetBlackboxPath(LPSTR pszPath, int nMaxLen)
Definition BBApi.cpp:214
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
Settings * pSettings
Definition Blackbox.cpp:46
PluginManager * pPluginManager
Definition Blackbox.cpp:43
HWND GetBBWnd()
Definition BBApi.cpp:128
#define PLUGIN_NAME
Definition BBApi.h:266
#define PLUGIN_AUTHOR
Definition BBApi.h:268
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define PLUGIN_RELEASEDATE
Definition BBApi.h:269
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define CONSOLE_INFORMATION_MESSAGE
Definition BBApi.h:298
#define PLUGIN_VERSION
Definition BBApi.h:267
LPCSTR(* pluginInfoFunc)(int)
Definition PluginManager.h:51