è¿é ãVisual Studio 2008 ãçºå£²ãããããæ°ããæè¡ã«ãææ¦ãã¦ã¿ããã£ãã®ã§ãC#ã§ããã°ã©ã ãæ¸ãã¦ã¿ãããã¼ãã¯ãæè¿èªåé
å¸ãéå§ããã Internet Explorer 7 ï¼IE7ï¼ãå©ç¨ãããã®ãIE7 ã«ã¯ãRSSãªã¼ãã¼ã®æ©è½ãããã¾ãããã©ã®RSSãè³¼èªãã¦ãããã®æ
å ±ããæ¢èªã»æªèªã®æ
å ±ã¯ IE7 ãç¬èªã«æã£ã¦ããã®ã§ã¯ãªããOS ãè¤æ°ã®ã¢ããªã±ã¼ã·ã§ã³ããæ±ãäºãã§ããå
±éã®åºç¤ã¨ãã¦æã£ã¦ããã®ã§ãããIE7 ãã¤ã³ã¹ãã¼ã«ããã¨ãOS ã«ãã®ãããªæ©è½ã追å ãããããã§ãã
ããã¯ãªããªãããããä»çµã¿ã ã¨æããã§ãããè¤æ°ã®RSSãªã¼ãã¼æ©è½ãæã£ãã¢ããªã±ã¼ã·ã§ã³ã
ãã®æè¡ã®å称ã¯ã
C# ã«ã¯åææ¦ãããã©ãããããªãã¸ã§ã¯ãæåè¨èªã§ã¾ã¨ãã«ããã°ã©ã ãæ¸ãããã¨ãããã¾ããããããªæãã§ããã®ã§ãããããæãã¦ãã ããã詳ãã人ã
ã©ããªããã°ã©ã ã説æãã¾ããã³ãã³ãããã³ãããã使ç¨ããããã°ã©ã ã§ããIE7ã§ç»é²ãããã£ã¼ãã®ãã©ã«ãåã¨ããã®ãã©ã«ãå
ã®æªèªãã£ã¼ã件æ°ã表示ãã¾ãã
IE ãéãã¦ãããããã³ãã³ãããã³ãããéãã¦ããæ¹ãè²ã
é½åããã人åãã§ããã³ãã³ãããã³ããã«ãã¾ãããããã®æ
å ±ã表示ãã¦ãä¸ä¾¿ãã¨æããå
¨ã¦ã®ãã£ã¼ãã¯è¡¨ç¤ºããããã©ã«ãåä½ã§æªèªä»¶æ°ã表示ããããã«ãã¾ããã
// CheckFeeds.cs // // http://msdn2.microsoft.com/en-us/library/ms684736.aspx ãåèã«ä½æ using System; using System.Collections.Generic; using Microsoft.Feeds.Interop; public class CheckFeeds { public static int Main (string[] args) { try { if (args.Length != 0) { DisplayHelp(); return -1; } CheckRss rss = new CheckRss(); rss.Check(); List<News> rssData = rss.getNewsData(); foreach (News n in rssData) { Console.WriteLine("{0}\t({1})", n.Name, n.Num); } return 0; } catch { Console.Error.WriteLine("CheckFeeds.exe: Error."); return -1; } } private void DisplayHelp() { Console.Error.WriteLine("Usage: checkfeeds"); } } public class News { private string m_name; private int m_num; private string m_time; public News(string name, int num, string time) { m_name = name; m_num = num; m_time = time; } public string Name { get { return m_name; } } public int Num { get { return m_num; } } public string Time { get { return m_time; } } } public class CheckRss { private List<News> rssList; public CheckRss() { rssList = new List<News>(); } public void Check () { AggregateFeedCount(); } private int AggregateFeedCount() { IFeedsManager feedmgr = new FeedsManagerClass(); return AggregateFeedCount((IFeedFolder)feedmgr.RootFolder); } private int AggregateFeedCount(IFeedFolder folder) { i = folder.TotalUnreadItemCount; if ( i > 0) { //Console.WriteLine("{0}\t({1})", folder.Name, i); rssList.Add(new News(folder.Name, i, "")); } foreach (IFeedFolder subfolder in (IFeedsEnum)folder.Subfolders) { AggregateFeedCount(subfolder); } return i; } public List<News> getNewsData() { return rssList; //ãã¼ã«ã«ãªãã¸ã§ã¯ãã¸ã®åç §ãè¿ãã¦å¤§ä¸å¤«ãï¼ } }
ãããã.Net Framework 2.0 ä»å±ã®C#ã³ã³ãã¤ã©ï¼csc.exeï¼ã§ã³ã³ãã¤ã«ãããã¨ããã®ã§ãããã¨ã©ã¼ã«ãªã£ã¦ãã¾ãã¾ãããï¼.Net Framework 2.0 㯠Window Update ããã³ Microsoft Update ã§ãã¦ã³ãã¼ãã§ãã¾ãï¼
c:\windows\Microsoft.NET\Framework\v2.0.50727\csc /r:msfeeds.dll /o CheckFeeds.cs
Microsoft(R) Visual C# 2005 Compiler version 8.00.50727.42 for Microsoft(R) Windows(R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2001-2005. All rights reserved. error CS0006: 'msfeeds.dll' ã¡ã¿ãã¼ã¿ãè¦ã¤ããã¾ããã§ããã
ãã¼ãã/r ãªãã·ã§ã³ã®æå®ãã¾ããã®ããªã"/r:c:\windows\system32\msfeeds.dll" ã¨ãã¦ã¿ã¾ãããã次ã®ãããªã¨ã©ã¼ã¨ãªã£ã¦ãã¾ãã¾ããã
Microsoft(R) Visual C# 2005 Compiler version 8.00.50727.42 for Microsoft(R) Windows(R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2001-2005. All rights reserved. fatal error CS0009: 'c:\WINDOWS\system32\msfeeds.dll' ã¡ã¿ãã¼ã¿ ãã¡ã¤ã«ãéãã¾ããã§ãã -- 'ééã£ããã©ã¼ãããã®ããã°ã©ã ãèªã¿è¾¼ããã¨ãã¾ããã '
ãã¶ããVisual Studio ã§è¨ãã¨ããã®ããåç §ãã®è¨å®ã«å½ãé¨åããªãã·ã§ã³ã§æå®ããå¿ è¦ãããã¨æãã®ã§ãããã©ããããããã®ããããã¾ãããè¡ãè©°ã¾ãã¾ããã