20130529-第一個(gè)任務(wù)

2013-5-29 10:28 原創(chuàng)

1.理解任務(wù) 

第一步:創(chuàng)建一個(gè)類,用于保存文件的屬性,包括: 
filepath,filename,fileversion 

問(wèn)題:文件有哪些屬性,各種屬性應(yīng)該定義成哪種數(shù)據(jù)類型 

第二步:操作注冊(cè)表,找到路徑 
問(wèn)題:數(shù)據(jù)表如何操作,找哪個(gè)鍵值可以獲取到路徑 

第三步:從路徑中找文件 
路徑/文件/IO操作參考:http://blog.sina.com.cn/s/blog_6ddaacb30100rcq8.html ;

第四步:逐個(gè)獲取文件的屬性 

最最最最最最最最最最最最最任務(wù)最最最最最最最最最最最最最最 
There are a few steps: 

1. create an Installedfile class - just hold some file properties 

2. find the SQL Install path from the registry 

3. Use System.IO to get the list of keyfiles in the directories 

4. get the file properties and add to the Installedfile object 

5. add each Installedfile to the List 

最最最最最最最最最最最最最最基本概念--方法-屬性,委托,事件等最最最最最最最最最最 
http://zhidao.baidu.com/question/50181971.html


回應(yīng)4 舉報(bào)
收藏
12年前
耐心,堅(jiān)持,我能行,逐個(gè)擊破
12年前
2. install path:
using(RegistryKey sqlServerKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server"))
{
foreach (string subKeyName in sqlServerKey.GetSubKeyNames())
{
if(subKeyName.StartsWith("MSSQL."))
{
using(RegistryKey instanceKey = sqlServerKey.OpenSubKey(subKeyName))
{
string instanceName = instanceKey.GetValue("").ToString();

if (instanceName == "MSSQLSERVER")//say
{
string path = instanceKey.OpenSubKey(@"Setup").GetValue("SQLBinRoot").ToString();
path = Path.Combine(path, "sqlserver.exe");
return path;
}
}
}
}
}

from:
http://stackoverflow.com/questions/1165576/c-sharp-how-to-get-sql-server-installation-path-programatically
12年前
3.get key file
http://msdn.microsoft.com/en-us/library/6yk7a1b0.aspx


!!!http://msdn.microsoft.com/zh-cn/library/vstudio/4cyf24ss(v=vs.100).aspx

/////////下面的示例從指定的目錄檢索文件///////
using System;
using System.IO;

public class GetFilesTest
{
public static void Main()
{
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo("c:\\");

// Get a reference to each file in that directory.
FileInfo[] fiArr = di.GetFiles();

// Display the names of the files.
foreach (FileInfo fri in fiArr)
Console.WriteLine(fri.Name);
}
}

--------------------
http://stackoverflow.com/questions/1755504/programatically-get-the-version-number-of-a-dll
發(fā)布

推薦閱讀

鉆鉆娘
鉆鉆娘