I'm migrating from tslint to eslint. However I'm unable to apply the rules in a similar way. A .eslintrc.json in a subdirectory is just ignored. But I need to override some rules for some subdirectories. In this case, the selector prefix should be ui instead app for all files in this subdirectory.
Root .eslintrc.json
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": ["plugin:#angular-eslint/recommended", "plugin:#angular-eslint/template/process-inline-templates"],
"rules": {
"#angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"#angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:#angular-eslint/template/recommended"],
"rules": {}
}
]
}
src/elements/.eslintrc.json
{
"overrides": [
{
"files": ["*.ts"],
"rules": {
"#angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "ui",
"style": "camelCase"
}
],
"#angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "ui",
"style": "kebab-case"
}
]
}
}
]
}
Turned out I had to add the tsconfig.json path in parserOptions. So the overriding file looks like this:
{
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["../../../tsconfig.json"],
"createDefaultProgram": true
},
"rules": {
"#angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "ui",
"style": "camelCase"
}
],
"#angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "ui",
"style": "kebab-case"
}
]
}
}
]
}
Related
I have a problem with Visual Studio Code custom syntax highlighting.
I have made a extension using yo code, put it in %userprofile%/.vscode/extensions, restarted Visual Studio Code, but it's not highlighting any words, but at the bottom it says it's using my syntax highlighter.
This is my tmLanguage.json:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Instructions ASM",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#typewords"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#variables"
},
{
"include": "#comments"
},
{
"include": "#sections"
}
],
"repository": {
"keywords":{
"patterns": [
{
"name": "keyword",
"match": "(mov|xor|and|or|int|jmp|con)"
}
]
},
"typewords": {
"patterns": [
{
"name": "keyword.control",
"match": "(db|dw|dd|resb|resw|resd|eq|byte|word|doubleword)"
}
]
},
"strings": {
"patterns": [
{
"name": "string",
"match": "(\".*\")|('.')"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric",
"match": "(0[xX][a-fA-F0-9]{1,8})|(\\d+)|(0[bB][0-1]{1,64})"
}
]
},
"variables": {
"patterns": [
{
"name": "variable",
"match": "$[a-zA-Z0-9_-.]{1,255}"
}
]
},
"comments": {
"patterns": [
{
"name": "comment",
"match": ";.*"
}
]
},
"sections": {
"patterns": [
{
"name": "entity.name.class",
"match": "(\\.DATA|\\.TEXT|\\.BSS)"
}
]
}
},
"scopeName": "source.1"
}
This is my package.json:
{
"name": "instruction-assembly",
"displayName": "Instruction assembly",
"description": "Code only in instructions - Assembly readable version",
"version": "0.0.1",
"engines": {
"vscode": "^1.54.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "instructions-asm",
"aliases": ["Instructions ASM", "instructions-asm"],
"extensions": [".1"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "instructions-asm",
"scopeName": "source.1",
"path": "./syntaxes/instructions-asm.tmLanguage.json"
}]
}
}
Thanks!
I'm new in visual studio code language creation, and I tried to make my own syntax highlighting for my custom language using yo code. In my tmLanguge.json file, I got this code, but I don't work and it doesn't highlight anything at all. Can someone please tell me what the problem is?
When I tried it only with the "comments" object, it worked well...
Thanks
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "OP-RANDS++",
"patterns": [
{
"include": "#comments"
},
{
"include": "#numbers"
},
{
"include": "#blocks"
},
{
"include": "#basecalls"
},
{
"include": "#outin"
},
{
"include": "#defines"
},
{
"include": "#maths"
},
{
"include": "#others"
}
],
"repository": {
"comments": {
"patterns": [
{
"name":"comment",
"match": "^\u005c?.*"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric",
"match": "\u005cd|\u005c\u005c\u005cd"
}
]
},
"blocks": {
"patterns": [
{
"name": "emphasis",
"match": "{|}|[|]|(|)"
}
]
},
"basecalls": {
"patterns": [
{
"name": "keyword.control",
"match": "\u005c.|\u005c|"
}
]
},
"outin": {
"patterns": [
{
"name": "entity.name.function",
"match": ";|,"
}
]
},
"defines": {
"patterns": [
{
"name": "variable.name",
"match": "~|`|^"
}
]
},
"maths": {
"patterns": [
{
"name": "keyword.operator",
"match": "+|-|*|/|%"
}
]
},
"others": {
"patterns": [
{
"name": "keyword.other",
"match": "'|$"
}
]
}
},
"scopeName": "source.opp"
}
I am trying to create EMR-5.30.1 clusters with applications such as Hadoop, livy, Spark, ZooKeeper, and Hive with the help of the CloudFormation template. But the issue is with this template is I am able the cluster with only one application from the above list of applications.
below is the CloudFormation Template
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Best Practice EMR Cluster for Spark or S3 backed Hbase",
"Parameters": {
"EMRClusterName": {
"Description": "Name of the cluster",
"Type": "String",
"Default": "emrcluster"
},
"KeyName": {
"Description": "Must be an existing Keyname",
"Type": "String",
"Default": "keyfilename"
},
"MasterInstanceType": {
"Description": "Instance type to be used for the master instance.",
"Type": "String",
"Default": "m5.xlarge"
},
"CoreInstanceType": {
"Description": "Instance type to be used for core instances.",
"Type": "String",
"Default": "m5.xlarge"
},
"NumberOfCoreInstances": {
"Description": "Must be a valid number",
"Type": "Number",
"Default": 1
},
"SubnetID": {
"Description": "Must be Valid public subnet ID",
"Default": "subnet-ee15b3e0",
"Type": "String"
},
"LogUri": {
"Description": "Must be a valid S3 URL",
"Default": "s3://aws/elasticmapreduce/",
"Type": "String"
},
"S3DataUri": {
"Description": "Must be a valid S3 bucket URL ",
"Default": "s3://aws/elasticmapreduce/",
"Type": "String"
},
"ReleaseLabel": {
"Description": "Must be a valid EMR release version",
"Default": "emr-5.30.1",
"Type": "String"
},
"Applications": {
"Description": "Please select which application will be installed on the cluster this would be either Ganglia and spark, or Ganglia and s3 backed Hbase",
"Type": "String",
"AllowedValues": [
"Spark",
"Hbase",
"Hive",
"Livy",
"ZooKeeper"
]
}
},
"Mappings": {},
"Conditions": {
"Spark": {
"Fn::Equals": [
{
"Ref": "Applications"
},
"Spark"
]
},
"Hbase": {
"Fn::Equals": [
{
"Ref": "Applications"
},
"Hbase"
]
},
"Hive": {
"Fn::Equals": [
{
"Ref": "Applications"
},
"Hive"
]
},
"Livy": {
"Fn::Equals": [
{
"Ref": "Applications"
},
"Livy"
]
},
"ZooKeeper": {
"Fn::Equals": [
{
"Ref": "Applications"
},
"ZooKeeper"
]
}
},
"Resources": {
"EMRCluster": {
"DependsOn": [
"EMRClusterServiceRole",
"EMRClusterinstanceProfileRole",
"EMRClusterinstanceProfile"
],
"Type": "AWS::EMR::Cluster",
"Properties": {
"Applications": [
{
"Name": "Ganglia"
},
{
"Fn::If": [
"Spark",
{
"Name": "Spark"
},
{
"Ref": "AWS::NoValue"
}
]
},
{
"Fn::If": [
"Hbase",
{
"Name": "Hbase"
},
{
"Ref": "AWS::NoValue"
}
]
},
{
"Fn::If": [
"Hive",
{
"Name": "Hive"
},
{
"Ref": "AWS::NoValue"
}
]
},
{
"Fn::If": [
"Livy",
{
"Name": "Livy"
},
{
"Ref": "AWS::NoValue"
}
]
},
{
"Fn::If": [
"ZooKeeper",
{
"Name": "ZooKeeper"
},
{
"Ref": "AWS::NoValue"
}
]
}
],
"Configurations": [
{
"Classification": "hbase-site",
"ConfigurationProperties": {
"hbase.rootdir":{"Ref":"S3DataUri"}
}
},
{
"Classification": "hbase",
"ConfigurationProperties": {
"hbase.emr.storageMode": "s3"
}
}
],
"Instances": {
"Ec2KeyName": {
"Ref": "KeyName"
},
"Ec2SubnetId": {
"Ref": "SubnetID"
},
"MasterInstanceGroup": {
"InstanceCount": 1,
"InstanceType": {
"Ref": "MasterInstanceType"
},
"Market": "ON_DEMAND",
"Name": "Master"
},
"CoreInstanceGroup": {
"InstanceCount": {
"Ref": "NumberOfCoreInstances"
},
"InstanceType": {
"Ref": "CoreInstanceType"
},
"Market": "ON_DEMAND",
"Name": "Core"
},
"TerminationProtected": false
},
"VisibleToAllUsers": true,
"JobFlowRole": {
"Ref": "EMRClusterinstanceProfile"
},
"ReleaseLabel": {
"Ref": "ReleaseLabel"
},
"LogUri": {
"Ref": "LogUri"
},
"Name": {
"Ref": "EMRClusterName"
},
"AutoScalingRole": "EMR_AutoScaling_DefaultRole",
"ServiceRole": {
"Ref": "EMRClusterServiceRole"
}
}
},
"EMRClusterServiceRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"elasticmapreduce.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceRole"
],
"Path": "/"
}
},
"EMRClusterinstanceProfileRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role"
],
"Path": "/"
}
},
"EMRClusterinstanceProfile": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Path": "/",
"Roles": [
{
"Ref": "EMRClusterinstanceProfileRole"
}
]
}
}
},
"Outputs": {}
}
Also, I want to add a bootstrap script in this template as well, Can anyone please help me with the issue.
As per my knoweldge and understanding, Applications in your case should be an array like below, as mentioned in documentation
"Applications" : [ Application, ... ],
In you case, you can list applications like
"Applications" : [
{"Name" : "Spark"},
{"Name" : "Hbase"},
{"Name" : "Hive"},
{"Name" : "Livy"},
{"Name" : "Zookeeper"},
]
For more arguments other than Name to individual application dictionary , see detail here, you can pass Args, Additional_info etc
You can use following way:-
If you set "ReleaseLabel" then there is no need to mention versions of applications
"Applications": [{
"Name": "Hive"
},
{
"Name": "Presto"
},
{
"Name": "Spark"
}
]
For bootstrap:-
"BootstrapActions": [{
"Name": "setup",
"ScriptBootstrapAction": {
"Path": "s3://bucket/key/Bootstrap.sh"
}
}]
Define like this to create all applications at once.
{
"Type": "AWS::EMR::Cluster",
"Properties": {
"Applications": [
{
"Name": "Ganglia"
},
{
"Name": "Spark"
},
{
"Name": "Livy"
},
{
"Name": "ZooKeeper"
},
{
"Name": "JupyterHub"
}
]
}
}
Using Serilog.Settings.Configuration, is it possible to specify multiple synks of the same type? For example, logging as plain text to a file and logging as JSON to another file.
Can it be done in the Async synk too?
{
"Serilog": {
"Using": ["Serilog.Sinks.File"],
"MinimumLevel": "Debug",
"WriteTo": [
{ "Name": "File", "Args": { "path": "%TEMP%\\Logs\\serilog-configuration-sample1.txt" } },
{ "Name": "File", "Args": { "path": "%TEMP%\\Logs\\serilog-configuration-sample2.txt" } }
],
"Enrich": ["FromLogContext", "WithMachineName", "WithThreadId"],
"Properties": {
"Application": "Sample"
}
}
}
Or:
{
"Serilog": {
"Using": ["Serilog.Sinks.File"],
"MinimumLevel": "Debug",
"WriteTo": {
"1": { "Name": "File", "Args": { "path": "%TEMP%\\Logs\\serilog-configuration-sample1.txt" } },
"2": { "Name": "File", "Args": { "path": "%TEMP%\\Logs\\serilog-configuration-sample2.txt" } }
},
"Enrich": ["FromLogContext", "WithMachineName", "WithThreadId"],
"Properties": {
"Application": "Sample"
}
}
}
I'm working on a Minecraft launcher, I have a problem, because my launcher uses the original way, and for example, here is the JSON:
{
"id": "1.8.1",
"time": "2014-11-24T14:13:31+00:00",
"releaseTime": "2014-11-24T14:13:31+00:00",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}",
"minimumLauncherVersion": 14,
"assets": "1.8",
"libraries": [
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.6"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.23.Final"
},
{
"name": "com.google.guava:guava:17.0"
},
{
"name": "org.apache.commons:commons-lang3:3.3.2"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.17"
},
{
"name": "com.mojang:realms:1.7.5"
},
{
"name": "org.apache.commons:commons-compress:1.8.1"
},
{
"name": "org.apache.httpcomponents:httpclient:4.3.3"
},
{
"name": "commons-logging:commons-logging:1.1.3"
},
{
"name": "org.apache.httpcomponents:httpcore:4.3.2"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
},
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:6.5"
},
{
"name": "tv.twitch:twitch-platform:6.5",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.client.main.Main"
}
So, in the "libraries" [, the game libraries listed with "name":, and below, the libraries contains the rules that apply to them, I want to know this rules with the library file name, and apply the actions with it, but I don't have any idea, I using this code, but this only redirect the libraries.
Here is my code:
Dim item As String = Version
Dim client As New WebClient()
Await client.DownloadFileTaskAsync(New Uri("https://s3.amazonaws.com/Minecraft.Download/versions/" + item + "/" + item + ".json"), Root + "\versions\" + item + "\" + item + ".json")
Dim JSONREADER As New StreamReader(Root + "\versions\" + item + "\" + item + ".json")
json = JSONREADER.ReadToEnd()
JSONREADER.Close()
Dim JSONResult As Object = JsonConvert.DeserializeObject(Of Object)(json)
MinecraftArgs = JSONResult("minecraftArguments")
AssetIndex = JSONResult("assets")
MainClass = JSONResult("mainClass")
For Each i In JSONResult("libraries").Children()
LibrariesList.Add(i.ToObject(Of MClibraries).name)
Next
For example:
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
The "name" as the name of the file, the "rules" there is two action: allow, disallow, under the disallow, there is the "os":, this sets the action, because
"os": {
"name": "osx"
}
this only allows the file in Windows and Linux, but disallows the file in mac OS X, so I want to get and apply this actions.
I want to add these libraries:
"libraries": [
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.6"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.23.Final"
},
{
"name": "com.google.guava:guava:17.0"
},
{
"name": "org.apache.commons:commons-lang3:3.3.2"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.17"
},
{
"name": "com.mojang:realms:1.7.5"
},
{
"name": "org.apache.commons:commons-compress:1.8.1"
},
{
"name": "org.apache.httpcomponents:httpclient:4.3.3"
},
{
"name": "commons-logging:commons-logging:1.1.3"
},
{
"name": "org.apache.httpcomponents:httpcore:4.3.2"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
And add these libraries if the rules allow Windows operating system:
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
},
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:6.5"
},
{
"name": "tv.twitch:twitch-platform:6.5",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
If in the rules only disallow, and in the disallow only for example OS X, this means the Windows, and the Linux allowed.
First edit your MClibraries class so that it looks like this:
Public Class MClibraries
Public name As String
Public rules As JArray
End Class
So to do what you're asking I start off with a list and a dictionary:
Private ReadOnly _librariesList As New List(Of String)
Private ReadOnly _disallowed As New Dictionary(Of String, String)
NOTE: You already have _librariesList, but yours is named LibrariesList.
Next, to get the libraries, I did this:
Dim item As String = Version
Dim client = New WebClient() With {.Proxy = Nothing}
Dim json = Await client.DownloadStringTaskAsync(New Uri(String.Format("http://s3.amazonaws.com/Minecraft.Download/versions/{0}/{0}.json", item)))
Dim jsonResult As Object = JsonConvert.DeserializeObject(Of Object)(json)
For Each i In jsonResult("libraries")
Dim entry As MClibraries = i.ToObject(Of MClibraries)() ' Converts object to MClibrary
_librariesList.Add(entry.name) ' Add the name of each entry to the listbox
If Not IsNothing(entry.rules) AndAlso entry.rules.Count = 2 Then ' Check to make sure it isn't empty
_disallowed.Add(entry.rules(1)("os")("name")) ' Gets the os that is disallowed
End If
Next
NOTE: Just add what you already have to this
Now you can access all the disallowed os's with the new dictionary "_disallowed". The key is the os that is disallowed and the value is the package.
If you want to see if the os matches the user os you can write the following. Also you will need to add the reference to System.Management and import it as well
Private _currentOs as String
'The following should go under the loading of a form
Dim osname As String = (From x In New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType(Of ManagementObject)()
Select x.GetPropertyValue("Caption")).FirstOrDefault()
'The following should go where you retrieve the libraries
For Each i In jsonResult("libraries")
Dim entry As MClibraries = i.ToObject(Of MClibraries)() ' Converts object to MClibrary
If Not IsNothing(entry.rules) AndAlso entry.rules.Count = 2 Then ' Check to make sure it isn't empty
If Not _currentOs.ToLower.Contains(entry.rules(1)("os")("name")) Then
_librariesList.Add(entry.name)
End If
End If
Next