Package: sysinfo / 0.7-8

09-ubuntu_lsb_release.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Index: sysinfo-0.7/Sysinfo/SystemInfo.cs
===================================================================
--- sysinfo-0.7.orig/Sysinfo/SystemInfo.cs	2008-12-29 18:26:47.000000000 +0000
+++ sysinfo-0.7/Sysinfo/SystemInfo.cs	2008-12-29 18:29:58.000000000 +0000
@@ -30,6 +30,8 @@
 		
 		//read release info
 		public void Release() {
+
+		    String temp;
 			
 			try {
 				
@@ -125,6 +127,31 @@
 					}
 				}
 				
+				if (File.Exists("/etc/lsb-release")) {
+					using (TextReader textread = File.OpenText("/etc/lsb-release")) {
+
+					    while ( (temp = textread.ReadLine()) != null ) {
+
+					    	// get distro
+					    	if ( temp.StartsWith("DISTRIB_ID=") ) {
+					    		distro = temp.Substring(11);
+					    	}
+
+					    	// get release
+					    	if ( temp.StartsWith("DISTRIB_RELEASE=") ) {
+					    		system_release = temp.Substring(16);
+					    	}
+
+					    	// get codename
+ 					    	if ( temp.StartsWith("DISTRIB_CODENAME=") ) {
+					    		system_release = String.Concat(system_release, " (", temp.Substring(17), ")");
+					    	}
+
+                        }
+                        system_release = String.Concat(distro, " ", system_release);
+					}
+				}
+
 			} catch (FileNotFoundException ex) {  Console.WriteLine( ex );  }
 		}