示例#1
0
        private static void Main(string[] args)
        {
            Wsl.InitializeSecurityModel();

            var hasPretty   = string.Equals("--pretty", args?.FirstOrDefault(), StringComparison.OrdinalIgnoreCase);
            var queryResult = Wsl.GetDistroQueryResult();

            Console.Out.WriteLine(JsonConvert.SerializeObject(queryResult, new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver(),
                Formatting       = hasPretty ? Formatting.Indented : Formatting.None,
            }));
        }
示例#2
0
        static void Test_QueryDistroInfo()
        {
            var distros = Wsl.GetDistroQueryResult();

            if (distros == null)
            {
                throw new ArgumentNullException(nameof(distros));
            }

            if (distros.Count(x => x.IsRegistered == false) > 0)
            {
                throw new Exception("Cannot query distro properties.");
            }
        }