mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added statistics to underlying operating system version.
This commit is contained in:
@@ -55,9 +55,9 @@ namespace DiscImageChef.Core
|
|||||||
AllStats = new Stats();
|
AllStats = new Stats();
|
||||||
CurrentStats = new Stats()
|
CurrentStats = new Stats()
|
||||||
{
|
{
|
||||||
OperatingSystems = new List<NameValueStats>
|
OperatingSystems = new List<OsStats>
|
||||||
{
|
{
|
||||||
new NameValueStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = 1 }
|
new OsStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = 1, version = Environment.OSVersion.Version.ToString() }
|
||||||
},
|
},
|
||||||
Versions = new List<NameValueStats>
|
Versions = new List<NameValueStats>
|
||||||
{
|
{
|
||||||
@@ -74,9 +74,9 @@ namespace DiscImageChef.Core
|
|||||||
AllStats = new Stats();
|
AllStats = new Stats();
|
||||||
CurrentStats = new Stats()
|
CurrentStats = new Stats()
|
||||||
{
|
{
|
||||||
OperatingSystems = new List<NameValueStats>
|
OperatingSystems = new List<OsStats>
|
||||||
{
|
{
|
||||||
new NameValueStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = 1 }
|
new OsStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = 1, version = Environment.OSVersion.Version.ToString() }
|
||||||
},
|
},
|
||||||
Versions = new List<NameValueStats>
|
Versions = new List<NameValueStats>
|
||||||
{
|
{
|
||||||
@@ -99,10 +99,10 @@ namespace DiscImageChef.Core
|
|||||||
{
|
{
|
||||||
long count = 0;
|
long count = 0;
|
||||||
|
|
||||||
NameValueStats old = null;
|
OsStats old = null;
|
||||||
foreach(NameValueStats nvs in AllStats.OperatingSystems)
|
foreach(OsStats nvs in AllStats.OperatingSystems)
|
||||||
{
|
{
|
||||||
if(nvs.name == Interop.DetectOS.GetRealPlatformID().ToString())
|
if(nvs.name == Interop.DetectOS.GetRealPlatformID().ToString() && nvs.version == Environment.OSVersion.Version.ToString())
|
||||||
{
|
{
|
||||||
count = nvs.Value + 1;
|
count = nvs.Value + 1;
|
||||||
old = nvs;
|
old = nvs;
|
||||||
@@ -114,7 +114,7 @@ namespace DiscImageChef.Core
|
|||||||
AllStats.OperatingSystems.Remove(old);
|
AllStats.OperatingSystems.Remove(old);
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
AllStats.OperatingSystems.Add(new NameValueStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = count });
|
AllStats.OperatingSystems.Add(new OsStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = count, version = Environment.OSVersion.Version.ToString() });
|
||||||
}
|
}
|
||||||
else if(CurrentStats != null)
|
else if(CurrentStats != null)
|
||||||
AllStats.OperatingSystems = CurrentStats.OperatingSystems;
|
AllStats.OperatingSystems = CurrentStats.OperatingSystems;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace DiscImageChef.Metadata
|
|||||||
public class Stats
|
public class Stats
|
||||||
{
|
{
|
||||||
[XmlArrayItem("OperatingSystem")]
|
[XmlArrayItem("OperatingSystem")]
|
||||||
public List<NameValueStats> OperatingSystems { get; set; }
|
public List<OsStats> OperatingSystems { get; set; }
|
||||||
[XmlArrayItem("Version")]
|
[XmlArrayItem("Version")]
|
||||||
public List<NameValueStats> Versions { get; set; }
|
public List<NameValueStats> Versions { get; set; }
|
||||||
public CommandsStats Commands;
|
public CommandsStats Commands;
|
||||||
@@ -165,4 +165,14 @@ namespace DiscImageChef.Metadata
|
|||||||
[XmlText]
|
[XmlText]
|
||||||
public long Value { get; set; }
|
public long Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class OsStats
|
||||||
|
{
|
||||||
|
[XmlAttribute]
|
||||||
|
public string name { get; set; }
|
||||||
|
[XmlAttribute]
|
||||||
|
public string version { get; set; }
|
||||||
|
[XmlText]
|
||||||
|
public long Value { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,16 +120,16 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.OperatingSystems = newStats.OperatingSystems;
|
oldStats.OperatingSystems = newStats.OperatingSystems;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach(NameValueStats newNvs in newStats.OperatingSystems)
|
foreach(OsStats newNvs in newStats.OperatingSystems)
|
||||||
{
|
{
|
||||||
NameValueStats removeNvs = null;
|
OsStats removeNvs = null;
|
||||||
NameValueStats addNvs = null;
|
OsStats addNvs = null;
|
||||||
|
|
||||||
foreach(NameValueStats oldNvs in oldStats.OperatingSystems)
|
foreach(OsStats oldNvs in oldStats.OperatingSystems)
|
||||||
{
|
{
|
||||||
if(oldNvs.name == newNvs.name)
|
if(oldNvs.name == newNvs.name && oldNvs.version == newNvs.version)
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value };
|
addNvs = new OsStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value, version = oldNvs.version };
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -148,20 +148,20 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(oldStats.OperatingSystems == null)
|
if(oldStats.OperatingSystems == null)
|
||||||
oldStats.OperatingSystems = new System.Collections.Generic.List<NameValueStats>
|
oldStats.OperatingSystems = new System.Collections.Generic.List<OsStats>
|
||||||
{
|
{
|
||||||
new NameValueStats { name = "Linux", Value = 1 }
|
new OsStats { name = "Linux", Value = 1 }
|
||||||
};
|
};
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NameValueStats removeNvs = null;
|
OsStats removeNvs = null;
|
||||||
NameValueStats addNvs = null;
|
OsStats addNvs = null;
|
||||||
|
|
||||||
foreach(NameValueStats oldNvs in oldStats.OperatingSystems)
|
foreach(OsStats oldNvs in oldStats.OperatingSystems)
|
||||||
{
|
{
|
||||||
if(oldNvs.name == "Linux")
|
if(oldNvs.name == "Linux")
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + 1 };
|
addNvs = new OsStats { name = oldNvs.name, Value = oldNvs.Value + 1, version = oldNvs.version };
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.OperatingSystems.Add(addNvs);
|
oldStats.OperatingSystems.Add(addNvs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
oldStats.OperatingSystems.Add(new NameValueStats { name = "Linux", Value = 1 });
|
oldStats.OperatingSystems.Add(new OsStats { name = "Linux", Value = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,10 @@ namespace DiscImageChef.Server
|
|||||||
if(statistics.OperatingSystems != null)
|
if(statistics.OperatingSystems != null)
|
||||||
{
|
{
|
||||||
operatingSystems = new List<NameValueStats>();
|
operatingSystems = new List<NameValueStats>();
|
||||||
foreach(NameValueStats nvs in statistics.OperatingSystems)
|
foreach(OsStats nvs in statistics.OperatingSystems)
|
||||||
operatingSystems.Add(new NameValueStats { name = Interop.DetectOS.GetPlatformName((Interop.PlatformID)Enum.Parse(typeof(Interop.PlatformID), nvs.name)), Value = nvs.Value });
|
operatingSystems.Add(new NameValueStats { name = string.Format("{0}{1}{2}", Interop.DetectOS.GetPlatformName((Interop.PlatformID)Enum.Parse(typeof(Interop.PlatformID), nvs.name), nvs.version),
|
||||||
|
string.IsNullOrEmpty(nvs.version) ? "" : " ", nvs.version), Value = nvs.Value });
|
||||||
|
//operatingSystems.Add(new OsStats { name = Interop.DetectOS.GetPlatformName((Interop.PlatformID)Enum.Parse(typeof(Interop.PlatformID), nvs.name), nvs.version), Value = nvs.Value, version = nvs.version });
|
||||||
repOperatingSystems.DataSource = operatingSystems.OrderBy(os => os.name).ToList();
|
repOperatingSystems.DataSource = operatingSystems.OrderBy(os => os.name).ToList();
|
||||||
repOperatingSystems.DataBind();
|
repOperatingSystems.DataBind();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user