我试图从#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void validate(char *pass) {
if (strcmp(pass, "[REDACTED]") == 0) {
printf("ACCESS GRANTED!");
printf("Oh that's just idio... Oh my god!\n");
} else {
printf("Damn it, I had something for this...\n");
}
}
int main(int argc, char **argv) {
char password[200];
printf("C:/ENTER PASSWORD: ");
scanf("%s", password);
validate(password);
return 0;
}
而不是html文档中获取纯文本。
我发现这些事件是否是由Microsoft日历供应商创建的,例如hotmail,它们的详细信息将在html文档而不是纯文本中显示(顺便说一下,如果事件是由Gmail创建的,它们的详细信息是plaint文本)。我尝试以下面的方式获得纯文本,但它不起作用。
Appointment.Details
实际上,我在C ++环境中工作,也可以使用UWP API。我以前经常测试 并首先在C#中验证API。
此外,UWP api,var appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadWrite);
FindAppointmentsOptions options = new FindAppointmentsOptions { MaxCount = 100 };
options.FetchProperties.Add(AppointmentProperties.Subject);
options.FetchProperties.Add(AppointmentProperties.Details);
options.FetchProperties.Add(AppointmentProperties.DetailsKind);
DateTimeOffset startTime = new DateTimeOffset(new DateTime(2018, 2, 1));
// The UWP api gets the events from the Calendar app of Windows 10 OS.
List<Appointment> evtList =
(await appointmentStore.FindAppointmentsAsync(startTime, new TimeSpan(30, 0, 0, 0), options)).ToList();
foreach (var evt in evtList) {
Debug.WriteLine(evt.Subject);
// I've found if the events were created in Microsoft calendar supplier, e.g. hotmail,
// the details of them would be the html document instead of the plain text.
// I've tried to make the evt.Details presented in the plain text
// instead of the html document, but this way doesn't work.
evt.DetailsKind = AppointmentDetailsKind.PlainText;
Debug.WriteLine(evt.Details);
}
不能满足我的需要。在我的C ++项目中,调用HtmlUtilities.ConvertToText()
会导致Static Buffer Overruns。
答案 0 :(得分:1)
我发现这些事件是否是由Microsoft日历供应商创建的,例如hotmail,它们的详细信息将在html文档而不是纯文本中显示(顺便说一下,如果事件是由Gmail创建的,它们的详细信息是plaint文本)。
是的,这是日历商店应用程序中“Microsoft日历供应商”的特殊功能。您可以使用它来编辑格式的详细预约。
如果要将详细信息转换为纯文本,可以使用HtmlAgilityPack.NetCore
来解析html,如下所示。
if (evt.DetailsKind == AppointmentDetailsKind.Html)
{
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(evt.Details);
var nodes = doc.DocumentNode.SelectNodes("//p[@class='MsoNormal']");
foreach (var node in nodes)
{
var text = node.InnerText;
}
}