Coder Social home page Coder Social logo

Comments (9)

NimaAra avatar NimaAra commented on September 28, 2024 1

Okay, cool. Leave it with me and I will add it in the next release hopefully by next Monday week.

from easy.common.

NimaAra avatar NimaAra commented on September 28, 2024

I am not too keen on returning JSON what I can do for you however, is return a rich object instead of string whose ToString() returns the current prettified report; You can then choose to serialize the object however you see fit.

How does that sound?

from easy.common.

elliottmatt avatar elliottmatt commented on September 28, 2024

I have a function somewhat similar to this and I return a string that is json inside it. See below. (I've censored/removed anything sensitive.) (I also return with the json inside not prettified, i just prettified it below so you can easily see how the sections/data can be nested).

{
	"CommandLine": "c:\\windows\\system32\\inetsrv\\w3wp.exe -morestuff",
	"CurrentDirectory": "c:\\windows\\system32\\inetsrv",
	"CurrentManagedThreadId": "63",
	"Is64BitOperatingSystem": "True",
	"Is64BitProcess": "True",
	"MachineName": "serverNameHere",
	"OSVersion": "Microsoft Windows",
	"ProcessorCount": "2",
	"UserDomainName": "DOMAINNAME",
	"UserName": "server_name",
	"Version": "4.0.30319.42000",
	"ServerCurrentTime": "1/1/2011 1:11:11 PM",
	"SystemUptime": "1.11:11:11.11111111",
	"ScriptTimeout": "00:11:11",
	"Trust Level": "Unrestricted",
	"EnvironmentVariables": {
		"ALLUSERSPROFILE": "C:\\ProgramData",
		"APP_POOL_ID": "app",
		"APPDATA": "C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming",
		"CommonProgramFiles": "C:\\Program Files\\Common Files",
		"COMPUTERNAME": "serverNameHere",
		"ComSpec": "C:\\Windows\\system32\\cmd.exe",
		"FP_NO_HOST_CHECK": "NO",
		"NUMBER_OF_PROCESSORS": "8",
		"OS": "Windows_NT",
		"Path": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem",
		"PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC",
		"PROCESSOR_ARCHITECTURE": "AMD64",
		"PROCESSOR_IDENTIFIER": "Intel64 Family 6 Model 45 Stepping 2, GenuineIntel",
		"PROCESSOR_LEVEL": "6",
		"PROCESSOR_REVISION": "2d02",
		"ProgramData": "C:\\ProgramData",
		"ProgramFiles": "C:\\Program Files",
		"ProgramFiles(x86)": "C:\\Program Files (x86)",
		"ProgramW6432": "C:\\Program Files",
		"PSModulePath": "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\",
		"PUBLIC": "C:\\Users\\Public",
		"SystemDrive": "C:",
		"SystemRoot": "C:\\Windows",
		"TEMP": "C:\\Windows\\TEMP",
		"TMP": "C:\\Windows\\TEMP",
		"USERDOMAIN": "DOMAINNAME",
		"USERNAME": "username$",
		"USERPROFILE": "C:\\Windows\\system32\\config\\systemprofile",
		"windir": "C:\\Windows"
	},
	"ServerProcessor": {
		"Number of Processors": "8",
		"Processor Id": "Intel64 Family 6 Model 45 Stepping 2, GenuineIntel",
		"Processor Type": "255",
		"Processor Level": "8",
		"Processor OEM Id": "9",
		"Page Size": "4096"
	},
	"MemoryInfo": {
		"CurrentWorkingSet": "1,206.05 MB",
		"Physical Memory Size": "4,095.55 MB",
		"Physical Free Memory Size": "23 bytes",
		"PageFile Size": "3,480.06 MB",
		"Available PageFile Size": "2 bytes",
		"Virtual Memory Size": "4,095.55 MB",
		"Available Memory Size": "27 bytes",
		"Memory Load": "88.00 %"
	},
	"Session": {
		"SessionToken1": "SomeData"
	}
}

from easy.common.

NimaAra avatar NimaAra commented on September 28, 2024

I understand but I do not want the library to concern itself with any serialization logic hence my suggestion for a rich object which you can serialize and get the similar format you have pasted.

from easy.common.

elliottmatt avatar elliottmatt commented on September 28, 2024

Perhaps that would work then? So your rich object would contain the different sections in them and I could enumerate through to format appropriately?

from easy.common.

NimaAra avatar NimaAra commented on September 28, 2024

It will be something like:

public sealed class Report
{
	public KeyValuePair<string, string>[] System { get; set; }
	public KeyValuePair<string, string>[] Process { get; set; }
	public AssemblyDetail[] Assemblies {get; set;}
	...
}

public sealed class AssemblyDetail
{
	public string Name { get; set; }
	public bool IsGAC { get; set; }
	...	
}

from easy.common.

elliottmatt avatar elliottmatt commented on September 28, 2024

That would be perfect! For the more complex ones, feel free to use string[] or nested Dictionary<string, string> for multiple values coming back.

from easy.common.

pldmgg avatar pldmgg commented on September 28, 2024

Awesome! This is exactly what I came to the Issues section to see (I'm /u/fourierswager on reddit). Thanks again for creating this!

from easy.common.

NimaAra avatar NimaAra commented on September 28, 2024

This is now available in: v2.6.7

from easy.common.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.