Skip to content

Commit

Permalink
Making some refactorings to classes protection level and renaming som…
Browse files Browse the repository at this point in the history
…ethings in OperatingSystem class
  • Loading branch information
herberthamaral committed Feb 22, 2011
1 parent 27406fd commit 35c6d7b
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 69 deletions.
3 changes: 3 additions & 0 deletions DeskMetricsNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="watcher\EventType.cs" />
<Compile Include="watcher\JSON.cs" />
<Compile Include="watcher\Services.cs" />
<Compile Include="watcher\Storage.cs" />
<Compile Include="watcher\Util.cs" />
<Compile Include="watcher\DeskMetricsHardware.cs" />
<Compile Include="watcher\DeskMetricsJSON.cs" />
Expand Down
14 changes: 7 additions & 7 deletions Watcher/DeskMetricsMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,9 @@ protected void SetJSON()

#region "Start"
GetOsInfo.GetFrameworkVersion();
GetOsInfo.GetOSArchicteture();
GetOsInfo.GetOSLanguage();
GetOsInfo.GetOSVersion();
GetOsInfo.GetArchicteture();
GetOsInfo.GetLanguage();
GetOsInfo.GetVersion();
GetOsInfo.GetJavaVersion();
GetHardwareInfo.GetProcessorData();
GetHardwareInfo.GetMemoryData();
Expand All @@ -769,13 +769,13 @@ protected void SetJSON()
o["userID"] = _userGUID;
o["session"] = _sessionGUID;
o["timestamp"] = _timestamp;
o["os_name"] = GetOsInfo.OSVersion;
o["os_servicepack"] = GetOsInfo.OSServicePack;
o["os_arch"] = GetOsInfo.OSArchicteture;
o["os_name"] = GetOsInfo.Version;
o["os_servicepack"] = GetOsInfo.ServicePack;
o["os_arch"] = GetOsInfo.Archicteture;
o["os_java"] = GetOsInfo.JavaVersion;
o["os_dotnet"] = GetOsInfo.FrameworkVersion;
o["os_dotnetsp"] = GetOsInfo.FrameworkServicePack;
o["os_lang"] = GetOsInfo.OSLcid;
o["os_lang"] = GetOsInfo.Lcid;
o["os_screen"] = GetHardwareInfo.ScreenResolution;
o["cpu_name"] = GetHardwareInfo.ProcessorName;
o["cpu_brand"] = GetHardwareInfo.ProcessorBrand;
Expand Down
88 changes: 44 additions & 44 deletions Watcher/DeskMetricsOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ internal class OperatingSystem
/// <summary>
/// Field OS Archicteture - 32 or 64 bits
/// </summary>
private int _osArchicteture;
private int _Archicteture;
/// <summary>
/// Field OS ApplicationVersion
/// </summary>
private string _osName;
private string _Name;
/// <summary>
/// Field Framework Service Pack
/// </summary>
private string _frameworkServicePack;
/// <summary>
/// Field OS LCID - Language Culture Id
/// </summary>
private int _osLCID;
private int _LCID;
/// <summary>
/// Field OS Language
/// </summary>
private string _osLanguage;
private string _language;
/// <summary>
/// Field JavaVersion
/// </summary>
private string _javaVersion;
/// <summary>
/// Field OS Service Pack
/// </summary>
private string _osServicePack;
private string _servicePack;

/// <summary>
/// GetProcessorFrequency and Set Framework ApplicationVersion
Expand All @@ -80,45 +80,45 @@ public string FrameworkVersion
/// <summary>
/// GetProcessorFrequency and Set OS Archicteture
/// </summary>
public int OSArchicteture
public int Archicteture
{
get
{
return _osArchicteture;
return _Archicteture;
}
set
{
_osArchicteture = value;
_Archicteture = value;
}
}

/// <summary>
/// GetProcessorFrequency and Set OS Language
/// </summary>
public string OSLanguage
public string Language
{
get
{
return _osLanguage;
return _language;
}
set
{
_osLanguage = value;
_language = value;
}
}

/// <summary>
/// GetProcessorFrequency and Set OS ApplicationVersion
/// </summary>
public string OSVersion
public string Version
{
get
{
return _osName;
return _Name;
}
set
{
_osName = value;
_Name = value;
}
}

Expand All @@ -140,15 +140,15 @@ public string FrameworkServicePack
/// <summary>
/// GetProcessorFrequency and Set OS LCID - Language Culture Id
/// </summary>
public int OSLcid
public int Lcid
{
get
{
return _osLCID;
return _LCID;
}
set
{
_osLCID = value;
_LCID = value;
}
}

Expand All @@ -170,15 +170,15 @@ public string JavaVersion
/// <summary>
/// GetProcessorFrequency and Set OS Service Pack
/// </summary>
public string OSServicePack
public string ServicePack
{
get
{
return _osServicePack;
return _servicePack;
}
set
{
_osServicePack = value;
_servicePack = value;
}
}

Expand Down Expand Up @@ -249,7 +249,7 @@ public void GetFrameworkVersion()
/// <summary>
/// GetProcessorFrequency OS Archicteture GetComponentName
/// </summary>
public void GetOSArchicteture()
public void GetArchicteture()
{
try
{
Expand All @@ -269,59 +269,59 @@ public void GetOSArchicteture()
if (PC.Value !=null)
{
string value = PC.Value.ToString().Remove(2);
OSArchicteture = int.Parse(value);
Archicteture = int.Parse(value);
}
}
}
}

if (OSArchicteture <= 0)
if (Archicteture <= 0)
{
if (IntPtr.Size == 8)
{
OSArchicteture = 64;
Archicteture = 64;
}
else
{
if (IntPtr.Size == 4)
{
OSArchicteture = 32;
Archicteture = 32;
}
}
}
}
catch
{
OSArchicteture = -1;
Archicteture = -1;
}
}

/// <summary>
/// GetProcessorFrequency OS Language GetComponentName
/// </summary>
public void GetOSLanguage()
public void GetLanguage()
{
try
{
OSLanguage = Thread.CurrentThread.CurrentCulture.DisplayName;
OSLcid = Thread.CurrentThread.CurrentCulture.LCID;
Language = Thread.CurrentThread.CurrentCulture.DisplayName;
Lcid = Thread.CurrentThread.CurrentCulture.LCID;
}
catch
{
OSLanguage = "null";
OSLcid = -1;
Language = "null";
Lcid = -1;
}
}

/// <summary>
/// GetProcessorFrequency OS ApplicationVersion GetComponentName
/// </summary>
public void GetOSVersion()
public void GetVersion()
{
try
{
OperatingSystem _osInfo = Environment.OSVersion;
_osServicePack = _osInfo.ServicePack;
{
System.OperatingSystem _osInfo = Environment.OSVersion;
_servicePack = _osInfo.ServicePack;

switch (_osInfo.Platform)
{
Expand All @@ -333,47 +333,47 @@ public void GetOSVersion()
switch (_osInfo.Version.Major)
{
case 3:
OSVersion = "Windows NT 3.51";
Version = "Windows NT 3.51";
break;
case 4:
OSVersion = "Windows NT 4.0";
Version = "Windows NT 4.0";
break;
case 5:
if (_osInfo.Version.Minor == 0)
{
OSVersion = "Windows 2000";
Version = "Windows 2000";
}
else
{
if (_osInfo.Version.Minor == 1)
{
OSVersion = "Windows XP";
Version = "Windows XP";
}
else
{
if (_osInfo.Version.Minor == 2)
{
OSVersion = "Windows Server 2003";
Version = "Windows Server 2003";
}
}
}
break;
case 6:
if (_osInfo.Version.Minor == 0)
{
OSVersion = "Windows Vista";
Version = "Windows Vista";
}
else
{
if (_osInfo.Version.Minor == 1)
{
OSVersion = "Windows 7";
Version = "Windows 7";
}
else
{
if (_osInfo.Version.Minor == 3)
{
OSVersion = "Windows Server 2008";
Version = "Windows Server 2008";
}
}
}
Expand Down Expand Up @@ -402,7 +402,7 @@ public void GetOSVersion()
}
catch
{
OSVersion = "null";
Version = "null";
}

}
Expand Down
2 changes: 1 addition & 1 deletion Watcher/DeskMetricsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace DeskMetrics
{
static class Settings
internal static class Settings
{
public const string UserAgent = "DeskMetricsNET";
public const string DefaultServer = "api.deskmetrics.com";
Expand Down
28 changes: 14 additions & 14 deletions Watcher/EventType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ namespace DeskMetrics
{
public class EventType
{
public static const string StartApplication = "strApp";
public static const string StopApplication = "stApp";
public static const string Event = "ev";
public static const string CustomData = "ctD";
public static const string CustomDataRealTime = "ctDR";
public static const string Log = "lg";
public static const string Exception = "exC";
public static const string EventStart = "evS";
public static const string EventStop = "evST";
public static const string EventCancel = "evC";
public static const string EventValue = "evV";
public static const string EventPeriod = "evP";
public static const string Install = "ist";
public static const string Uninstall = "ust";
public const string StartApplication = "strApp";
public const string StopApplication = "stApp";
public const string Event = "ev";
public const string CustomData = "ctD";
public const string CustomDataRealTime = "ctDR";
public const string Log = "lg";
public const string Exception = "exC";
public const string EventStart = "evS";
public const string EventStop = "evST";
public const string EventCancel = "evC";
public const string EventValue = "evV";
public const string EventPeriod = "evP";
public const string Install = "ist";
public const string Uninstall = "ust";
}
}
2 changes: 1 addition & 1 deletion Watcher/JSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace DeskMetrics
{
protected class JSON
internal class JSON
{

}
Expand Down
2 changes: 1 addition & 1 deletion Watcher/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace DeskMetrics
{
protected class Services
internal class Services
{
private Watcher watcher;
public Services(Watcher watcher)
Expand Down
11 changes: 11 additions & 0 deletions Watcher/Storage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeskMetricsNET.watcher
{
internal class Storage
{
}
}
Loading

0 comments on commit 35c6d7b

Please sign in to comment.