void ConvertDataValue(WIDATAITEM *UpdateData, char *Data) { char str[MAX_DATA_LEN]; // convert the unit if (strcmp(Data, Translate("<Error>")) && strcmp(Data, NODATA) && strcmp(Data, Translate(NODATA))) { // temperature if (!strcmp(UpdateData->Name, "Temperature") || !strcmp(UpdateData->Name, "High") || !strcmp(UpdateData->Name, "Low") || !strcmp(UpdateData->Name, "Feel") || !strcmp(UpdateData->Name, "Dewpoint") || !_stricmp(UpdateData->Unit, "C") || !_stricmp(UpdateData->Unit, "F") || !_stricmp(UpdateData->Unit, "K")) { GetTemp(Data, UpdateData->Unit, str); strcpy(Data, str); } // pressure else if (!strcmp(UpdateData->Name, "Pressure") || !_stricmp(UpdateData->Unit, "HPA") || !_stricmp(UpdateData->Unit, "KPA") || !_stricmp(UpdateData->Unit, "MB") || !_stricmp(UpdateData->Unit, "TORR") || !_stricmp(UpdateData->Unit, "IN") || !_stricmp(UpdateData->Unit, "MM")) { GetPressure(Data, UpdateData->Unit, str); strcpy(Data, str); } // speed else if (!strcmp(UpdateData->Name, "Wind Speed") || !_stricmp(UpdateData->Unit, "KM/H") || !_stricmp(UpdateData->Unit, "M/S") || !_stricmp(UpdateData->Unit, "MPH") || !_stricmp(UpdateData->Unit, "KNOTS")) { GetSpeed(Data, UpdateData->Unit, str); strcpy(Data, str); } // visibility else if (!strcmp(UpdateData->Name, "Visibility") || !_stricmp(UpdateData->Unit, "KM") || !_stricmp(UpdateData->Unit, "MILES")) { GetDist(Data, UpdateData->Unit, str); strcpy(Data, str); } // converting case for condition to the upper+lower format else if (!_stricmp(UpdateData->Unit, "COND")) CaseConv(Data); // degree sign else if (!_stricmp(UpdateData->Unit, "DEG")) { if (!opt.DoNotAppendUnit) strcat(Data, opt.DegreeSign); } // percent sign else if (!_stricmp(UpdateData->Unit, "%")) { if (!opt.DoNotAppendUnit) strcat(Data, "%"); } // truncating strings for day/month to 2 or 3 characters else if (!_stricmp(UpdateData->Unit, "DAY") || !_stricmp(UpdateData->Unit, "MONTH")) if (opt.dUnit > 1 && strlen(Data) > opt.dUnit) Data[opt.dUnit] = '\0'; } }
void ConvertDataValue(WIDATAITEM *UpdateData, TCHAR *Data) { TCHAR str[MAX_DATA_LEN]; // convert the unit if (mir_tstrcmp(Data, TranslateT("<Error>")) && mir_tstrcmp(Data, NODATA) && mir_tstrcmp(Data, TranslateTS(NODATA))) { // temperature if (!mir_tstrcmp(UpdateData->Name, _T("Temperature")) || !mir_tstrcmp(UpdateData->Name, _T("High")) || !mir_tstrcmp(UpdateData->Name, _T("Low")) || !mir_tstrcmp(UpdateData->Name, _T("Feel")) || !mir_tstrcmp(UpdateData->Name, _T("Dewpoint")) || !mir_tstrcmpi(UpdateData->Unit, _T("C")) || !mir_tstrcmpi(UpdateData->Unit, _T("F")) || !mir_tstrcmpi(UpdateData->Unit, _T("K"))) { GetTemp(Data, UpdateData->Unit, str); mir_tstrcpy(Data, str); } // pressure else if (!mir_tstrcmp(UpdateData->Name, _T("Pressure")) || !mir_tstrcmpi(UpdateData->Unit, _T("HPA")) || !mir_tstrcmpi(UpdateData->Unit, _T("KPA")) || !mir_tstrcmpi(UpdateData->Unit, _T("MB")) || !mir_tstrcmpi(UpdateData->Unit, _T("TORR")) || !mir_tstrcmpi(UpdateData->Unit, _T("IN")) || !mir_tstrcmpi(UpdateData->Unit, _T("MM"))) { GetPressure(Data, UpdateData->Unit, str); mir_tstrcpy(Data, str); } // speed else if (!mir_tstrcmp(UpdateData->Name, _T("Wind Speed")) || !mir_tstrcmpi(UpdateData->Unit, _T("KM/H")) || !mir_tstrcmpi(UpdateData->Unit, _T("M/S")) || !mir_tstrcmpi(UpdateData->Unit, _T("MPH")) || !mir_tstrcmpi(UpdateData->Unit, _T("KNOTS"))) { GetSpeed(Data, UpdateData->Unit, str); mir_tstrcpy(Data, str); } // visibility else if (!mir_tstrcmp(UpdateData->Name, _T("Visibility")) || !mir_tstrcmpi(UpdateData->Unit, _T("KM")) || !mir_tstrcmpi(UpdateData->Unit, _T("MILES"))) { GetDist(Data, UpdateData->Unit, str); mir_tstrcpy(Data, str); } // elevation else if (!mir_tstrcmp(UpdateData->Name, _T("Elevation")) || !mir_tstrcmpi(UpdateData->Unit, _T("FT")) || !mir_tstrcmpi(UpdateData->Unit, _T("M"))) { GetElev(Data, UpdateData->Unit, str); mir_tstrcpy(Data, str); } // converting case for condition to the upper+lower format else if (!mir_tstrcmpi(UpdateData->Unit, _T("COND"))) CaseConv(Data); // degree sign else if (!mir_tstrcmpi(UpdateData->Unit, _T("DEG"))) { if (!opt.DoNotAppendUnit) mir_tstrcat(Data, opt.DegreeSign); } // percent sign else if (!mir_tstrcmpi(UpdateData->Unit, _T("%"))) { if (!opt.DoNotAppendUnit) mir_tstrcat(Data, _T("%")); } // truncating strings for day/month to 2 or 3 characters else if (!mir_tstrcmpi(UpdateData->Unit, _T("DAY")) || !mir_tstrcmpi(UpdateData->Unit, _T("MONTH"))) if (opt.dUnit > 1 && mir_tstrlen(Data) > opt.dUnit) Data[opt.dUnit] = '\0'; } }