/*
//
//
//
// 連接Wikipedia示範
//
// 由cheng_chai_fung制作
// 開發環境為Microsoft Visual C++ 2010 Express、.NETFramework 4.0及DotNetWikiBot 2.94
// 本程式是以制作狀態機器人為例(配合Template:UserStatus使用)
// 本程式用到DotNetWikiBot.dll,可在http://dotnetwikibot.sourceforge.net/找到
//
//
//
//
*/
#include <stdio.h>
//#using "DotNetWikiBot.dll" //本人現時只做到利用增加參考方法來進行連接,原因為本人的.NETFramework過新
using namespace System;
using namespace DotNetWikiBot;
ref class BotScript : Bot
{
public:
Site ^WikiSite;
void active()
{
/*
//
//WikiBot主程式
//
//在此自行增加及修改程式
//
*/
Page ^p = gcnew Page(WikiSite, "Special:Mypage/Status");
p->Save("online");
}
};
void main()
{
BotScript bot;
char *URL = "http://zh.wikipedia.org/", *Botname = new char[256], *Password = new char[256];
//如果不希望每次都要輸入登入資料,
//請直接修改 *Botname = new char[256] 作 *Botname = "登入名稱"
//及修改 *Password = new char[256] 作 *Password = "密碼"
//然後把下面的四行和之後的"delete [] Botname;"、"delete [] Password;"刪除
printf("Botname: ");
scanf_s("%s", Botname, 256);
printf("Password: ");
scanf_s("%s", Password, 256);
bot.WikiSite = gcnew Site(%String(URL), %String(Botname), %String(Password));
bot.active(); //可以自行把此行增加迴圈,但最好同時增加Wait Method(自行參考說明檔)來限制機器人過密的編輯
delete bot.WikiSite;
delete [] Botname;
delete [] Password;
}
Wikiwand in your browser!
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.