我在Form1中有这个代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenHardwareMonitor.Hardware.HDD;
using OpenHardwareMonitor;
namespace OpenHardwareMonitor
{
public partial class Form1 : Form
{
OpenHardwareMonitor.Hardware.SensorValue sv;
OpenHardwareMonitor.Hardware.ISensor ii;
public Form1()
{
InitializeComponent();
string y = ii.Name;
sv = new Hardware.SensorValue();
DateTime dt = sv.Time;
float t = sv.Value;
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
ii 变量为null我不知道如何为它创建一个实例.
构造函数中的其他两个变量不返回0.如果我没有使用ii变量,则其他两个不会抛出错误但不返回任何值.
我正在使用http://code.google.com/p/open-hardware-monitor/downloads/detail?name=openhardwaremonitor-v0.4.0-beta.zip&can=2&q=中的openhardwaremonitor dll
c#dll自带程序.
所以我添加了dll作为参考,但我不知道如何制作代码.
根据我的代码,有人可以为我构建一个代码示例吗?我试着查看openhwardwaremonitor网站和源代码,但不明白如何使用它.
我还可以做些什么 ? …
我需要将一个字符串发送到一个网站并获得结果.
但是,例如,如果我发送"hello world"它应该是"hello%world"而不是space应该有%
应该有一种方法我认为它是自动的,因此当字符串在此位置有空格时,它将知道如何以及何时放置此%.
例如,我有这个字符串,这是一个网站网址:
https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&q=hello%20world&source=en&target=de
Run Code Online (Sandbox Code Playgroud)
你好和世界之间有20%的关系.我该怎么做 ?
我有这两个功能.现在,他们将在url变量中从网站下载并保存特定图像.
但现在我想更改GetAllImages()函数内容并使用csFiles字符串网站从站点获取所有.cs文件并将其保存到硬盘.所以我需要更改GetAllImages函数,并修改DownloadImage函数以下载*.cs文件而不是图像.
我该怎么做 ?
public void GetAllImages()
{
// Bing Image Result for Cat, First Page
string url = "http://www.bing.com/images/search?q=cat&go=&form=QB&qs=n";
string csFiles = "http://open-hardware-monitor.googlecode.com/svn/trunk/Hardware/";
// For speed of dev, I use a WebClient
WebClient client = new WebClient();
string html = client.DownloadString(url);
// Load the Html into the agility pack
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
// Now, using LINQ to get all Images
/*List<HtmlNode> imageNodes = null;
imageNodes = (from HtmlNode node in doc.DocumentNode.SelectNodes("//img")
where node.Name == "img"
&& …Run Code Online (Sandbox Code Playgroud) 可能重复:
检查列表是否已包含项目?
for (int i = 0; i < webSites.Count(); i++)
{
string t = webSites[i];
webCrawler(t, levels - 1);
// csFiles.add
}
MessageBox.Show(webSites.Count().ToString());
return csFiles;
Run Code Online (Sandbox Code Playgroud)
让我们在网站上说:
www.google.com
www.microsoft.com
现在在第二级让我们再说www.google.com再次存在,所以这次我不想处理它来做recrusive如果它会再做同样的事情.我需要以某种方式制作或检查它是否会执行每个链接一次.我怎么检查它?
我不需要检查列表中是否已经存在该项目我需要检查它是否已经存在所以不要再这样做,因为它将再次挖掘相同的链接并重复它自己.