Fix bug of XeRelease Core

This commit is contained in:
daleclack 2024-01-19 21:19:15 +08:00
parent 97e35965f1
commit 1465f3e386
3 changed files with 36 additions and 8 deletions

View File

@ -291,13 +291,41 @@ void MyWin::main_releases()
{
// Get Selection
guint version = drop_down.get_selected();
XeVer rel_version;
char str[57];
// Get Version string
// Get Branch, Version and mode
auto item = drop_list->get_item(version);
auto message = item->get_version_str();
msg_dialog.Init(message);
msg_dialog.present();
rel_version.branch = item->get_branch_str().c_str();
rel_version.version = item->get_version_str().c_str();
guint mode = item->get_branch_mode();
switch (mode)
{
case 0:
// The Release Mode 0
rel_version.year = 2019;
rel_version.month = 1;
rel_version.day = 11;
// Get Relase String and Show
get_release_str(local, rel_version, str);
msg_dialog.Init(str);
msg_dialog.present();
break;
case 1:
default:
// The Release Mode 1(default)
rel_version.year = 2017;
rel_version.month = 5;
rel_version.day = 19;
// Get Relase String and Show
get_release_str(local, rel_version, str);
msg_dialog.Init(str);
msg_dialog.present();
break;
}
// Get Configs
// load_config();
// switch (version) // Use Selection to Perform

View File

@ -58,7 +58,7 @@ int total_day(int year, int month, int day)
default:
printf("Date Wrong!");
}
if (year % 4 == 0 && year % 100 != 0)
if (year % 4 == 0 && year % 100 != 0 && month > 2)
sum = sum + 1;
return sum;
}
@ -127,7 +127,7 @@ void get_release_str(struct tm *local, const XeVer &version1, char *callback_str
month2 = local->tm_mon + 1, day2 = local->tm_mday;
// get release version
lts_ver = total_year_day(version1.year, year2) -
total_day(version1.year, longterm_month, version1.day) +
total_day(version1.year, version1.month, version1.day) +
total_day(year2, month2, day2);
// For show in dialog or console
snprintf(callback_str, 57, "Xeinit %s version:%s.%d\n",

View File

@ -10,8 +10,8 @@ typedef struct{
int year;
int month;
int day;
char *branch;
char *version;
const char *branch;
const char *version;
}XeVer;
int total_day(int year,int month,int day);