Comments (9)
Okay, cool. Leave it with me and I will add it in the next release hopefully by next Monday week.
from easy.common.
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.
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.
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.
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.
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.
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.
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.
This is now available in: v2.6.7
from easy.common.
Related Issues (20)
- Extend IRestClient to enable per request timeouts.
- RestClient's AddConnectionLeaseTimeout method - redux HOT 3
- Memory leak in RestClient HOT 3
- Add support for SocketsHttpHandler in RestClient
- LineCounter doesn't work correctly for eveonline log files HOT 5
- ReadLineCounter HOT 1
- IDGenerator for long values HOT 4
- Question: How to support headers and cookies with IoC container set to per request? HOT 1
- .NET Core returns "<INVALID>" Processor Name HOT 1
- CountLines does not reliably support encodings other than UTF-8 / ASCII HOT 1
- Did not consider the ServicePoint be removed from the servicepointmanager and it's resource get released after a timeout period HOT 2
- Decode should use toUpper. HOT 4
- Uniqueness of IDGenerator HOT 1
- EasyDictionary could just be implemented using KeyedCollection<TKey, TItem> HOT 1
- Possible UnauthorizedAccessException in Easy.Common.DiagnosticReport.GetDriveDetails HOT 1
- Add possibility to display only application level env variables(not all OS env varibales) HOT 2
- compare property when rightvalue is null HOT 2
- support net5 ? HOT 1
- How to set headers per call HOT 1
- Adding NotNullWhenAttribute HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easy.common.