Aggiunta classe x recuperare info HwSw
This commit is contained in:
Vendored
+4
-4
@@ -11,10 +11,10 @@ pipeline {
|
||||
steps {
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=693']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.versionNumberBeta = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
withEnv(['NEXT_BUILD_NUMBER=695']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.versionNumberBeta = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SteamWareLib'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace SteamWare
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper x estrarre dati sintetici su HW, Software, librerie installate...
|
||||
/// </summary>
|
||||
public class HwSwInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Assembly di base
|
||||
/// </summary>
|
||||
protected static Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice l'elenco pareto (decrescente) delle dimensioni browser registrate
|
||||
/// </summary>
|
||||
public static string paretoBrowserSize
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
string redHash = memLayer.ML.redHash("COUNT:wh:*");
|
||||
int numRec = memLayer.ML.redCountKey(redHash);
|
||||
List<KeyValuePair<string, int>> kvp = memLayer.ML.redGetCounterByKey(redHash, memLayer.kvpOrderBy.ValDesc);
|
||||
|
||||
// riordino elenco
|
||||
sb.AppendLine(string.Format("Trovate {0} combinazioni", numRec));
|
||||
foreach (var item in kvp)
|
||||
{
|
||||
sb.AppendLine(string.Format("{0}: {1}", item.Key.Replace(memLayer.ML.redHash("COUNT:wh:"), ""), item.Value));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Formatta un numero da int a size in Kb/Mb/Gb/Tb
|
||||
/// </summary>
|
||||
/// <param name="rawSize"></param>
|
||||
/// <returns></returns>
|
||||
public static string memFormat(double rawSize)
|
||||
{
|
||||
string[] sizes = { "B", "KB", "MB", "GB", "TB" };
|
||||
int order = 0;
|
||||
while (rawSize >= 1024 && order < sizes.Length - 1)
|
||||
{
|
||||
order++;
|
||||
rawSize = rawSize / 1024;
|
||||
}
|
||||
|
||||
// Adjust the format string to your preferences. For example "{0:0.#}{1}" would
|
||||
// show a single decimal place, and no space.
|
||||
return String.Format("{0:0.##} {1}", rawSize, sizes[order]);
|
||||
}
|
||||
/// <summary>
|
||||
/// Dati sui server redis...
|
||||
/// </summary>
|
||||
public static string redisServersData
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
{
|
||||
var servData = memLayer.ML.redServInfo();
|
||||
foreach (var item in servData)
|
||||
{
|
||||
sb.AppendLine(string.Format("Server: {0} | {1} | {2}", item, item.Version, item.ServerType));
|
||||
// da completare con altre info?!?
|
||||
var srvInfo = item.Info();
|
||||
// esporto un pò di info x gruppo...
|
||||
foreach (IGrouping<string, System.Collections.Generic.KeyValuePair<string, string>> capitolo in srvInfo)
|
||||
{
|
||||
sb.AppendLine("----------------------------------------------");
|
||||
sb.AppendLine(string.Format("Capitolo: {0}", capitolo.Key));
|
||||
sb.AppendLine("----------------------------------------------");
|
||||
foreach (var kvp in capitolo)
|
||||
{
|
||||
sb.AppendLine(string.Format("{0}:{1}", kvp.Key, kvp.Value));
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in redisServersData{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Stringa timing in gg, ore, ... da timespan
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToDateString(TimeSpan time)
|
||||
{
|
||||
return string.Format("{0}gg, {1:00}:{2:00}:{3:00} (h:m:s)", time.Days, time.Hours, time.Minutes, time.Seconds);
|
||||
}
|
||||
/// <summary>
|
||||
/// Statistiche server
|
||||
/// </summary>
|
||||
public static string ServerStats
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
{
|
||||
// calcoli preliminari
|
||||
TimeSpan uptime;
|
||||
using (var uptimeCounter = new PerformanceCounter("System", "System Up Time"))
|
||||
{
|
||||
uptimeCounter.NextValue();
|
||||
uptime = TimeSpan.FromSeconds(uptimeCounter.NextValue());
|
||||
}
|
||||
var computer = new ComputerInfo();
|
||||
|
||||
// compongo output
|
||||
sb.AppendLine(string.Format("NAME: {0}", Environment.MachineName));
|
||||
sb.AppendLine(Environment.OSVersion.VersionString);
|
||||
sb.AppendLine(string.Format("OS 64bit: {0} | PROC 64bit: {1}", Environment.Is64BitOperatingSystem, Environment.Is64BitProcess));
|
||||
sb.AppendLine(string.Format("SYS UPTIME: {0}", ToDateString(uptime)));
|
||||
sb.AppendLine(string.Format("CPU: {0}", Environment.ProcessorCount));
|
||||
sb.AppendLine(string.Format("RAM: {0}", memFormat(computer.TotalPhysicalMemory)));
|
||||
sb.AppendLine(string.Format("Virtual Memory: {0}", memFormat(computer.TotalVirtualMemory)));
|
||||
sb.AppendLine(string.Format("Available RAM: {0}", memFormat(computer.AvailablePhysicalMemory)));
|
||||
sb.AppendLine(string.Format("Available Virtual Memory: {0}", memFormat(computer.AvailableVirtualMemory)));
|
||||
sb.AppendLine(string.Format("DIR: {0}", Environment.CurrentDirectory));
|
||||
sb.AppendLine(string.Format("USER: {0} | USER: {1}", Environment.UserDomainName, Environment.UserName));
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in ServerStats{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Statistiche IIS
|
||||
/// </summary>
|
||||
public static string IISStats
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
using (var iis = Process.GetCurrentProcess())
|
||||
{
|
||||
//Process iis = Process.GetCurrentProcess();
|
||||
sb.AppendLine(string.Format("UPTIME: {0}", ToDateString(DateTime.Now - iis.StartTime)));
|
||||
sb.AppendLine(string.Format("Priority: {0}", iis.PriorityClass));
|
||||
sb.AppendLine(string.Format("Physical Memory Used: {0}", memFormat(iis.WorkingSet64)));
|
||||
sb.AppendLine(string.Format("Virtual Memory Used: {0}", memFormat(iis.VirtualMemorySize64)));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Nome MainAssembly
|
||||
/// </summary>
|
||||
public static string mainAssembly
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = assembly.FullName;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Runtime assembly
|
||||
/// </summary>
|
||||
public static string runtimeImg
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = assembly.ImageRuntimeVersion;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Versioni di ogni libreria compresa
|
||||
/// </summary>
|
||||
public static string librariesVers
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
AssemblyName[] referencedAssemblyNames = assembly.GetReferencedAssemblies();
|
||||
foreach (AssemblyName referencedAssemblyName in referencedAssemblyNames.OrderBy(n => n.Name))
|
||||
{
|
||||
answ += referencedAssemblyName.FullName + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Num di librerie inserite
|
||||
/// </summary>
|
||||
public static int numLibraries
|
||||
{
|
||||
get
|
||||
{
|
||||
int numLib = 0; ;
|
||||
try
|
||||
{
|
||||
AssemblyName[] referencedAssemblyNames = assembly.GetReferencedAssemblies();
|
||||
foreach (AssemblyName referencedAssemblyName in referencedAssemblyNames.OrderBy(n => n.Name))
|
||||
{
|
||||
numLib++;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return numLib;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,7 @@
|
||||
<HintPath>..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="MongoDB.Bson, Version=2.9.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Bson.2.9.3\lib\net452\MongoDB.Bson.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -227,6 +228,7 @@
|
||||
<Compile Include="fileMover.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HwSwInfo.cs" />
|
||||
<Compile Include="inputComando.cs" />
|
||||
<Compile Include="licenseMan.cs" />
|
||||
<Compile Include="log2note.cs" />
|
||||
|
||||
Reference in New Issue
Block a user