Menu

[r888]: / branches / drivesync / GoogleContactsSync / VersionInformation.cs  Maximize  Restore  History

Download this file

76 lines (70 with data), 2.6 kB

 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Management;
using System.Management.Instrumentation;
namespace GoContactSyncMod
{
static class VersionInformation
{
public enum OutlookMainVersion
{
Outlook2002,
Outlook2003,
Outlook2007,
Outlook2010,
Outlook2013,
OutlookUnknownVersion,
OutlookNoInstance
}
public static OutlookMainVersion GetOutlookVersion(Microsoft.Office.Interop.Outlook.Application appVersion)
{
if (appVersion == null)
appVersion = new Microsoft.Office.Interop.Outlook.Application();
switch (appVersion.Version.ToString().Substring(0,2))
{
case "10":
return OutlookMainVersion.Outlook2002;
case "11":
return OutlookMainVersion.Outlook2003;
case "12":
return OutlookMainVersion.Outlook2007;
case "14":
return OutlookMainVersion.Outlook2010;
case "15":
return OutlookMainVersion.Outlook2013;
default:
{
if (appVersion != null)
{
Marshal.ReleaseComObject(appVersion);
GC.Collect();
GC.WaitForPendingFinalizers();
}
return OutlookMainVersion.OutlookUnknownVersion;
}
}
}
/// <summary>
/// detect windows main version
/// </summary>
public static string GetWindowsVersionName()
{
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
{
foreach (ManagementObject managementObject in searcher.Get())
{
/*//iterate trough all properties
foreach (PropertyData prop in managementObject.Properties)
{
Console.WriteLine("{0}: {1}", prop.Name, prop.Value);
}
*/
return (string)managementObject["Caption"];
}
}
return "Unknown Windows Version";
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.