Typos, format and async consistency
This commit is contained in:
296
GoveeCsharpConnector.Example/.editorconfig
Normal file
296
GoveeCsharpConnector.Example/.editorconfig
Normal file
@ -0,0 +1,296 @@
|
||||
[*.md]
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 2
|
||||
[*.csproj]
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 2
|
||||
[*.cs]
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_finally = false
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
csharp_prefer_braces = false
|
||||
csharp_prefer_qualified_reference = true:error
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_prefer_simple_using_statement = true:warning
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = false
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||
csharp_style_conditional_delegate_call = true
|
||||
csharp_style_deconstructed_variable_declaration = false
|
||||
csharp_style_expression_bodied_accessors = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_constructors = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_indexers = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_methods = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_operators = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_properties = when_on_single_line:warning
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
|
||||
csharp_style_inlined_variable_declaration = false
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
csharp_style_pattern_local_over_anonymous_function = true:warning
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||
csharp_style_prefer_index_operator = true:warning
|
||||
csharp_style_prefer_not_pattern = true:warning
|
||||
csharp_style_prefer_null_check_over_type_check = true
|
||||
csharp_style_prefer_pattern_matching = true:warning
|
||||
csharp_style_prefer_range_operator = true:warning
|
||||
csharp_style_prefer_switch_expression = true:warning
|
||||
csharp_style_throw_expression = true
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:warning
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
|
||||
csharp_style_var_elsewhere = false:warning
|
||||
csharp_style_var_for_built_in_types = false:warning
|
||||
csharp_style_var_when_type_is_apparent = false:warning
|
||||
csharp_using_directive_placement = outside_namespace
|
||||
dotnet_analyzer_diagnostic.category-Design.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Documentation.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Globalization.severity = none
|
||||
dotnet_analyzer_diagnostic.category-Interoperability.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Naming.severity = none
|
||||
dotnet_analyzer_diagnostic.category-Performance.severity = none
|
||||
dotnet_analyzer_diagnostic.category-Reliability.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Security.severity = error
|
||||
dotnet_analyzer_diagnostic.category-SingleFile.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Style.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Usage.severity = error
|
||||
dotnet_code_quality_unused_parameters = all
|
||||
dotnet_code_quality_unused_parameters = non_public
|
||||
dotnet_code_quality.CAXXXX.api_surface = private, internal
|
||||
dotnet_diagnostic.CA1001.severity = error # CA1001: Types that own disposable fields should be disposable
|
||||
dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible instance fields
|
||||
dotnet_diagnostic.CA1511.severity = warning # CA1511: Use 'ArgumentException.ThrowIfNullOrEmpty' instead of explicitly throwing a new exception instance
|
||||
dotnet_diagnostic.CA1513.severity = warning # Use 'ObjectDisposedException.ThrowIf' instead of explicitly throwing a new exception instance
|
||||
dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
|
||||
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
||||
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
||||
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
|
||||
dotnet_diagnostic.CA1862.severity = warning # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
|
||||
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
|
||||
dotnet_diagnostic.CA2201.severity = none # CA2201: Exception type System.NullReferenceException is reserved by the runtime
|
||||
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
|
||||
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||
dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010)
|
||||
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||
dotnet_diagnostic.IDE0048.severity = none # Parentheses preferences (IDE0047 and IDE0048)
|
||||
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
||||
dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ]
|
||||
dotnet_diagnostic.IDE0058.severity = warning # IDE0058: Expression value is never used
|
||||
dotnet_diagnostic.IDE0060.severity = error # IDE0060: Remove unused parameter
|
||||
dotnet_diagnostic.IDE0074.severity = warning # IDE0074: Use compound assignment
|
||||
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure (IDE0130)
|
||||
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
|
||||
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
|
||||
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
|
||||
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
|
||||
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
|
||||
dotnet_naming_style.private_of_internal_field.required_prefix = _
|
||||
dotnet_naming_style.private_of_internal_field.required_suffix =
|
||||
dotnet_naming_style.private_of_internal_field.word_separator =
|
||||
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.abstract_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
|
||||
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.class.applicable_kinds = class
|
||||
dotnet_naming_symbols.class.required_modifiers =
|
||||
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.delegate.applicable_kinds = delegate
|
||||
dotnet_naming_symbols.delegate.required_modifiers =
|
||||
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enum.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enum.required_modifiers =
|
||||
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.event.applicable_kinds = event
|
||||
dotnet_naming_symbols.event.required_modifiers =
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
dotnet_naming_symbols.method.applicable_accessibilities = public
|
||||
dotnet_naming_symbols.method.applicable_kinds = method
|
||||
dotnet_naming_symbols.method.required_modifiers =
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
dotnet_naming_symbols.private_method.applicable_accessibilities = private
|
||||
dotnet_naming_symbols.private_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.private_method.required_modifiers =
|
||||
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
|
||||
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
|
||||
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
|
||||
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
|
||||
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.property.applicable_kinds = property
|
||||
dotnet_naming_symbols.property.required_modifiers =
|
||||
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
|
||||
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
|
||||
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.static_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.static_field.required_modifiers = static
|
||||
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.static_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.static_method.required_modifiers = static
|
||||
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.struct.applicable_kinds = struct
|
||||
dotnet_naming_symbols.struct.required_modifiers =
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
dotnet_remove_unnecessary_suppression_exclusions = 0
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||
dotnet_style_coalesce_expression = true
|
||||
dotnet_style_collection_initializer = true:warning
|
||||
dotnet_style_explicit_tuple_names = true:warning
|
||||
dotnet_style_namespace_match_folder = true
|
||||
dotnet_style_null_propagation = true:warning
|
||||
dotnet_style_object_initializer = true:warning
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||
dotnet_style_predefined_type_for_member_access = true:warning
|
||||
dotnet_style_prefer_auto_properties = true:warning
|
||||
dotnet_style_prefer_compound_assignment = true:warning
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = false
|
||||
dotnet_style_prefer_conditional_expression_over_return = false
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:warning
|
||||
dotnet_style_prefer_simplified_interpolation = true
|
||||
dotnet_style_qualification_for_event = false:error
|
||||
dotnet_style_qualification_for_field = false
|
||||
dotnet_style_qualification_for_method = false:error
|
||||
dotnet_style_qualification_for_property = false:error
|
||||
dotnet_style_readonly_field = true:warning
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 4
|
||||
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
|
||||
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
|
||||
# https://github.com/dotnet/project-system/blob/main/.editorconfig
|
||||
470
GoveeCsharpConnector.Example/.vscode/format-report.json
vendored
Normal file
470
GoveeCsharpConnector.Example/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1,470 @@
|
||||
[
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 11,
|
||||
"CharNumber": 41,
|
||||
"DiagnosticId": "IDE1006",
|
||||
"FormatDescription": "error IDE1006: Naming rule violation: These words must begin with upper case characters: apiDevices"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 12,
|
||||
"CharNumber": 41,
|
||||
"DiagnosticId": "IDE1006",
|
||||
"FormatDescription": "error IDE1006: Naming rule violation: These words must begin with upper case characters: udpDevices"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 10,
|
||||
"CharNumber": 45,
|
||||
"DiagnosticId": "IDE1006",
|
||||
"FormatDescription": "error IDE1006: Naming rule violation: Missing prefix: \u0027_\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 209,
|
||||
"CharNumber": 49,
|
||||
"DiagnosticId": "IDE0049",
|
||||
"FormatDescription": "warning IDE0049: Name can be simplified"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 32,
|
||||
"CharNumber": 26,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 201,
|
||||
"CharNumber": 9,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 203,
|
||||
"CharNumber": 18,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 45,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 208,
|
||||
"CharNumber": 9,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 53,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 73,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 221,
|
||||
"CharNumber": 13,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 81,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 100,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 107,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 114,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 133,
|
||||
"CharNumber": 26,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 140,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 209,
|
||||
"CharNumber": 75,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 143,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 158,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 161,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 174,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 176,
|
||||
"CharNumber": 17,
|
||||
"DiagnosticId": "IDE0008",
|
||||
"FormatDescription": "error IDE0008: Use explicit type instead of \u0027var\u0027"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "d562c9a2-c11c-4e41-a604-35e261537b88"
|
||||
},
|
||||
"FileName": "Program.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Program.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 234,
|
||||
"CharNumber": 9,
|
||||
"DiagnosticId": "IDE0058",
|
||||
"FormatDescription": "warning IDE0058: Expression value is never used"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DocumentId": {
|
||||
"ProjectId": {
|
||||
"Id": "75bf9517-12b5-40b2-b970-ba4afd8d059c"
|
||||
},
|
||||
"Id": "ed819aaa-de6e-4cfb-97ac-48d5cb0923fb"
|
||||
},
|
||||
"FileName": "Extensions.cs",
|
||||
"FilePath": "L:\\Git\\GoveeCSharpConnector\\GoveeCsharpConnector.Example\\Extensions.cs",
|
||||
"FileChanges": [
|
||||
{
|
||||
"LineNumber": 1,
|
||||
"CharNumber": 21,
|
||||
"DiagnosticId": "CA1050",
|
||||
"FormatDescription": "error CA1050: Declare types in namespaces"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
24
GoveeCsharpConnector.Example/.vscode/launch.json
vendored
Normal file
24
GoveeCsharpConnector.Example/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/bin/Debug/net8.0/GoveeCsharpConnector.Example.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "externalTerminal",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
5
GoveeCsharpConnector.Example/.vscode/settings.json
vendored
Normal file
5
GoveeCsharpConnector.Example/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Govee"
|
||||
]
|
||||
}
|
||||
66
GoveeCsharpConnector.Example/.vscode/tasks.json
vendored
Normal file
66
GoveeCsharpConnector.Example/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"args": [
|
||||
"format",
|
||||
"--report",
|
||||
".vscode",
|
||||
"--verbosity",
|
||||
"detailed",
|
||||
"--severity",
|
||||
"warn"
|
||||
],
|
||||
"command": "dotnet",
|
||||
"label": "Format",
|
||||
"problemMatcher": "$msCompile",
|
||||
"type": "process"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"format",
|
||||
"whitespace"
|
||||
],
|
||||
"command": "dotnet",
|
||||
"label": "Format Whitespaces",
|
||||
"problemMatcher": "$msCompile",
|
||||
"type": "process"
|
||||
},
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/GoveeCsharpConnector.Example.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/GoveeCsharpConnector.Example.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/GoveeCsharpConnector.Example.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
8
GoveeCsharpConnector.Example/Extensions.cs
Normal file
8
GoveeCsharpConnector.Example/Extensions.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace GoveeCsharpConnector.Example;
|
||||
|
||||
public static class Extensions {
|
||||
|
||||
public static bool EqualWhenIgnoringCase(this string? value, string compare) =>
|
||||
string.IsNullOrWhiteSpace(value) || value.Equals(compare, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
}
|
||||
@ -1,14 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GoveeCSharpConnector\GoveeCSharpConnector.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GoveeCSharpConnector\GoveeCSharpConnector.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,288 +1,299 @@
|
||||
using System.Net.Mime;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using GoveeCSharpConnector.Objects;
|
||||
using GoveeCSharpConnector.Objects;
|
||||
using GoveeCSharpConnector.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace GoveeCsharpConnector.Example;
|
||||
|
||||
public class Program
|
||||
{
|
||||
private static readonly GoveeApiService GoveeApiService = new ();
|
||||
private static readonly GoveeUdpService GoveeUdpService = new ();
|
||||
private static List<GoveeApiDevice> _apiDevices = new ();
|
||||
private static List<GoveeUdpDevice> _udpDevices = new();
|
||||
public class Program {
|
||||
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
private static List<GoveeApiDevice> _APIDevices = [];
|
||||
private static ReadOnlyCollection<GoveeUdpDevice>? _UDPDevices;
|
||||
private static readonly GoveeApiService _GoveeApiService = new();
|
||||
private static readonly GoveeUdpService _GoveeUdpService = new();
|
||||
|
||||
public static void Main(string[] _) {
|
||||
while (true) {
|
||||
PrintWelcomeMessage();
|
||||
var input = Console.ReadLine();
|
||||
HandleKeyInput(input);
|
||||
string? input = Console.ReadLine();
|
||||
if (input == "1") {
|
||||
InputOne();
|
||||
} else if (input == "2") {
|
||||
InputTwo();
|
||||
} else if (input == "3") {
|
||||
InputThree();
|
||||
} else if (input == "4") {
|
||||
InputFour();
|
||||
} else if (input == "5") {
|
||||
InputFive();
|
||||
} else if (input == "6") {
|
||||
InputSix();
|
||||
} else if (input == "7") {
|
||||
InputSeven(input);
|
||||
} else if (input == "8") {
|
||||
InputEight();
|
||||
} else if (input == "9") {
|
||||
InputNine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async void HandleKeyInput(string input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case "1":
|
||||
HandleApiInput();
|
||||
EndSegment();
|
||||
break;
|
||||
case "2":
|
||||
Console.WriteLine("Requesting Devices ...");
|
||||
_apiDevices = await GoveeApiService.GetDevices();
|
||||
Console.WriteLine("Devices:");
|
||||
foreach (var device in _apiDevices)
|
||||
{
|
||||
Console.WriteLine($"Name: {device.DeviceName}, Device Id: {device.DeviceId}, Model: {device.Model}, Controllable {device.Controllable}");
|
||||
}
|
||||
Console.WriteLine($"Total: {_apiDevices.Count} Devices.");
|
||||
EndSegment();
|
||||
break;
|
||||
case "3":
|
||||
if (_apiDevices.Count == 0)
|
||||
{
|
||||
Console.WriteLine("No Devices discovered! Please use Option 2 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Please enter the Name of the Device:");
|
||||
var nameInput = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(nameInput) || _apiDevices.FirstOrDefault(x => x.DeviceName.ToLower() == nameInput) is null)
|
||||
{
|
||||
Console.WriteLine("Device Name Invalid!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Do you want to turn the Device {nameInput} on or off?");
|
||||
var onOffInput = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(onOffInput) || (onOffInput != "on" && onOffInput != "off"))
|
||||
{
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
if (input == "on")
|
||||
{
|
||||
await GoveeApiService.ToggleState(_apiDevices.First(x => x.DeviceName.ToLower() == nameInput).DeviceId, _apiDevices.First(x => x.DeviceName.ToLower() == nameInput).Model, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await GoveeApiService.ToggleState(_apiDevices.First(x => x.DeviceName.ToLower() == nameInput).DeviceId, _apiDevices.First(x => x.DeviceName.ToLower() == nameInput).Model, false);
|
||||
}
|
||||
EndSegment();
|
||||
break;
|
||||
case "4":
|
||||
if (_apiDevices.Count == 0)
|
||||
{
|
||||
Console.WriteLine("No Devices discovered! Please use Option 2 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Please enter the Name of the Device:");
|
||||
var nameInput2 = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(nameInput2) || _apiDevices.FirstOrDefault(x => x.DeviceName.ToLower() == nameInput2) is null)
|
||||
{
|
||||
Console.WriteLine("Device Name Invalid!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Please enter a Brightness Value for Device {nameInput2}. 0-100");
|
||||
var brightnessInput = Console.ReadLine();
|
||||
int value = Convert.ToInt16(brightnessInput);
|
||||
if (string.IsNullOrWhiteSpace(brightnessInput) || value < 0 || value > 100)
|
||||
{
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
await GoveeApiService.SetBrightness(_apiDevices.First(x => x.DeviceName.ToLower() == nameInput2).DeviceId, _apiDevices.First(x => x.DeviceName.ToLower() == nameInput2).Model, value);
|
||||
Console.WriteLine($"Set Brightness of Device {nameInput2} to {value}%!");
|
||||
EndSegment();
|
||||
break;
|
||||
case "5":
|
||||
if (_apiDevices.Count == 0)
|
||||
{
|
||||
Console.WriteLine("No Devices discovered! Please use Option 2 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Please enter the Name of the Device:");
|
||||
var nameInput3 = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(nameInput3) || _apiDevices.FirstOrDefault(x => x.DeviceName.ToLower() == nameInput3) is null)
|
||||
{
|
||||
Console.WriteLine("Device Name Invalid!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Please choose a Color to set {nameInput3} to ... (blue, red, green)");
|
||||
var colorInput = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(colorInput) || (colorInput != "blue" && colorInput != "green" && colorInput != "red"))
|
||||
{
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
var model = _apiDevices.FirstOrDefault(x => x.DeviceName.ToLower()== nameInput3)?.Model;
|
||||
switch (colorInput)
|
||||
{
|
||||
case "blue":
|
||||
await GoveeApiService.SetColor(_apiDevices.First(x => x.DeviceName.ToLower() == nameInput3).DeviceId, model, new RgbColor(0, 0 ,254));
|
||||
break;
|
||||
case "green":
|
||||
await GoveeApiService.SetColor(_apiDevices.First(x => x.DeviceName.ToLower() == nameInput3).DeviceId, model, new RgbColor(0, 254 ,0));
|
||||
break;
|
||||
case "red":
|
||||
await GoveeApiService.SetColor(_apiDevices.First(x => x.DeviceName.ToLower() == nameInput3).DeviceId, model, new RgbColor(254, 0 ,0));
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Set Color of Device {nameInput3} to {colorInput}!");
|
||||
EndSegment();
|
||||
break;
|
||||
case "6":
|
||||
Console.WriteLine("Requesting Devices ...");
|
||||
_udpDevices = await GoveeUdpService.GetDevices();
|
||||
Console.WriteLine("Devices:");
|
||||
foreach (var device in _udpDevices)
|
||||
{
|
||||
Console.WriteLine($"IpAddress: {device.ip}, Device Id: {device.device}, Model: {device.sku}");
|
||||
}
|
||||
Console.WriteLine($"Total: {_udpDevices.Count} Devices.");
|
||||
EndSegment();
|
||||
break;
|
||||
case "7":
|
||||
var selectedDevice = GetUdpDeviceSelection();
|
||||
|
||||
Console.WriteLine($"Do you want to turn the Device {selectedDevice.ip} on or off?");
|
||||
var onOffInput2 = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(onOffInput2) || (onOffInput2 != "on" && onOffInput2 != "off"))
|
||||
{
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
if (input == "on")
|
||||
{
|
||||
await GoveeUdpService.ToggleDevice(selectedDevice.ip, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await GoveeUdpService.ToggleDevice(selectedDevice.ip, false);
|
||||
}
|
||||
EndSegment();
|
||||
break;
|
||||
case "8":
|
||||
var selectedDevice2 = GetUdpDeviceSelection();
|
||||
|
||||
Console.WriteLine($"Please enter a Brightness Value for Device {selectedDevice2.ip}. 0-100");
|
||||
var brightnessInput2 = Console.ReadLine();
|
||||
int value2 = Convert.ToInt16(brightnessInput2);
|
||||
if (string.IsNullOrWhiteSpace(brightnessInput2) || value2 < 0 || value2 > 100)
|
||||
{
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
await GoveeUdpService.SetBrightness(selectedDevice2.ip, value2);
|
||||
Console.WriteLine($"Set Brightness of Device {selectedDevice2.ip} to {value2}%!");
|
||||
EndSegment();
|
||||
break;
|
||||
case "9":
|
||||
var selectedDevice3 = GetUdpDeviceSelection();
|
||||
Console.WriteLine($"Please choose a Color to set {selectedDevice3.ip} to ... (blue, red, green)");
|
||||
var colorInput2 = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(colorInput2) || (colorInput2 != "blue" && colorInput2 != "green" && colorInput2 != "red"))
|
||||
{
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (colorInput2)
|
||||
{
|
||||
case "blue":
|
||||
GoveeUdpService.SetColor(selectedDevice3.ip, new RgbColor(0, 0, 254));
|
||||
break;
|
||||
case "green":
|
||||
GoveeUdpService.SetColor(selectedDevice3.ip, new RgbColor(0, 254, 0));
|
||||
break;
|
||||
case "red":
|
||||
GoveeUdpService.SetColor(selectedDevice3.ip, new RgbColor(254, 0, 0));
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Set Color of Device {selectedDevice3.ip} to {colorInput2}!");
|
||||
EndSegment();
|
||||
break;
|
||||
}
|
||||
private static void InputOne() {
|
||||
HandleApiInput();
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static GoveeUdpDevice GetUdpDeviceSelection()
|
||||
{
|
||||
var count = 1;
|
||||
private static void InputTwo() {
|
||||
Console.WriteLine("Requesting Devices ...");
|
||||
Task<GoveeResponse> goveeResponseTask = _GoveeApiService.GetDevicesResponseAsync();
|
||||
goveeResponseTask.Wait();
|
||||
_APIDevices = goveeResponseTask.Result.Data.Devices;
|
||||
Console.WriteLine("Devices:");
|
||||
foreach (GoveeApiDevice device in _APIDevices) {
|
||||
Console.WriteLine($"Name: {device.DeviceName}, Device Id: {device.DeviceId}, Model: {device.Model}, Controllable {device.Controllable}");
|
||||
}
|
||||
Console.WriteLine($"Total: {_APIDevices.Count} Devices.");
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void InputThree() {
|
||||
if (_APIDevices.Count == 0) {
|
||||
Console.WriteLine("No Devices discovered! Please use Option 2 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Please enter the Name of the Device:");
|
||||
string? nameInput = Console.ReadLine();
|
||||
GoveeApiDevice? goveeApiDevice = string.IsNullOrWhiteSpace(nameInput) ? null : _APIDevices.FirstOrDefault(x => x.DeviceName.EqualWhenIgnoringCase(nameInput));
|
||||
if (goveeApiDevice is null) {
|
||||
Console.WriteLine("Device Name Invalid!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Do you want to turn the Device {nameInput} on or off?");
|
||||
string? onOffInput = Console.ReadLine();
|
||||
if (string.IsNullOrWhiteSpace(onOffInput) || (!onOffInput.EqualWhenIgnoringCase("on") && !onOffInput.EqualWhenIgnoringCase("off"))) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Task<HttpResponseMessage> httpResponseMessageTask;
|
||||
if (onOffInput.EqualWhenIgnoringCase("on")) {
|
||||
httpResponseMessageTask = _GoveeApiService.ToggleStateAsync(goveeApiDevice.DeviceId, goveeApiDevice.Model, true);
|
||||
} else {
|
||||
httpResponseMessageTask = _GoveeApiService.ToggleStateAsync(goveeApiDevice.DeviceId, goveeApiDevice.Model, false);
|
||||
}
|
||||
CheckHttpResponseMessage(httpResponseMessageTask);
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void CheckHttpResponseMessage(Task<HttpResponseMessage> httpResponseMessageTask) {
|
||||
httpResponseMessageTask.Wait();
|
||||
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
|
||||
throw new Exception($"Govee Api Request failed. Status code: {httpResponseMessageTask.Result.StatusCode}, Message: {httpResponseMessageTask.Result.Content}");
|
||||
}
|
||||
|
||||
private static void InputFour() {
|
||||
if (_APIDevices.Count == 0) {
|
||||
Console.WriteLine("No Devices discovered! Please use Option 2 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Please enter the Name of the Device:");
|
||||
string? nameInput2 = Console.ReadLine();
|
||||
GoveeApiDevice? goveeApiDevice = string.IsNullOrWhiteSpace(nameInput2) ? null : _APIDevices.FirstOrDefault(x => x.DeviceName.EqualWhenIgnoringCase(nameInput2));
|
||||
if (goveeApiDevice is null) {
|
||||
Console.WriteLine("Device Name Invalid!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Please enter a Brightness Value for Device {nameInput2}. 0-100");
|
||||
string? brightnessInput = Console.ReadLine();
|
||||
int value = Convert.ToInt16(brightnessInput);
|
||||
if (string.IsNullOrWhiteSpace(brightnessInput) || value < 0 || value > 100) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = _GoveeApiService.SetBrightnessAsync(goveeApiDevice.DeviceId, goveeApiDevice.Model, value);
|
||||
httpResponseMessageTask.Wait();
|
||||
CheckHttpResponseMessage(httpResponseMessageTask);
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void InputFive() {
|
||||
if (_APIDevices.Count == 0) {
|
||||
Console.WriteLine("No Devices discovered! Please use Option 2 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Please enter the Name of the Device:");
|
||||
string? nameInput3 = Console.ReadLine();
|
||||
GoveeApiDevice? goveeApiDevice = string.IsNullOrWhiteSpace(nameInput3) ? null : _APIDevices.FirstOrDefault(x => x.DeviceName.EqualWhenIgnoringCase(nameInput3));
|
||||
if (goveeApiDevice is null) {
|
||||
Console.WriteLine("Device Name Invalid!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Please choose a Color to set {nameInput3} to ... (blue, red, green)");
|
||||
string? colorInput = Console.ReadLine();
|
||||
if (string.IsNullOrWhiteSpace(colorInput) || (!colorInput.EqualWhenIgnoringCase("blue") && !colorInput.EqualWhenIgnoringCase("green") && !colorInput.EqualWhenIgnoringCase("red"))) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
RgbColor? color = null;
|
||||
if (colorInput == "blue") {
|
||||
color = new RgbColor(0, 0, 254);
|
||||
} else if (colorInput == "green") {
|
||||
color = new RgbColor(0, 254, 0);
|
||||
} else if (colorInput == "red") {
|
||||
color = new RgbColor(254, 0, 0);
|
||||
}
|
||||
if (color is null) {
|
||||
Console.WriteLine("Invalid Color Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = _GoveeApiService.SetColorAsync(goveeApiDevice.DeviceId, goveeApiDevice.Model, color);
|
||||
httpResponseMessageTask.Wait();
|
||||
CheckHttpResponseMessage(httpResponseMessageTask);
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void InputSix() {
|
||||
Console.WriteLine("Requesting Devices ...");
|
||||
Task<IList<GoveeUdpDevice>> goveeUdpDevicesTask = _GoveeUdpService.GetDevicesAsync();
|
||||
goveeUdpDevicesTask.Wait();
|
||||
_UDPDevices = goveeUdpDevicesTask.Result.AsReadOnly();
|
||||
Console.WriteLine("Devices:");
|
||||
foreach (GoveeUdpDevice device in _UDPDevices) {
|
||||
Console.WriteLine($"IpAddress: {device.IP}, Device Id: {device.Device}, Model: {device.Sku}");
|
||||
}
|
||||
Console.WriteLine($"Total: {_UDPDevices.Count} Devices.");
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void InputSeven(string? input) {
|
||||
GoveeUdpDevice? goveeUdpDevice = GetUdpDeviceSelection();
|
||||
if (goveeUdpDevice is null) {
|
||||
Console.WriteLine("No Devices discovered! Please use Option 6 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Do you want to turn the Device {goveeUdpDevice.IP} on or off?");
|
||||
string? onOffInput2 = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(onOffInput2) || (onOffInput2 != "on" && onOffInput2 != "off")) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
if (input == "on") {
|
||||
_GoveeUdpService.ToggleDevice(goveeUdpDevice.IP, true);
|
||||
} else {
|
||||
_GoveeUdpService.ToggleDevice(goveeUdpDevice.IP, false);
|
||||
}
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void InputEight() {
|
||||
GoveeUdpDevice? goveeUdpDevice = GetUdpDeviceSelection();
|
||||
if (goveeUdpDevice is null) {
|
||||
Console.WriteLine("No Devices discovered! Please use Option 6 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Please enter a Brightness Value for Device {goveeUdpDevice.IP}. 0-100");
|
||||
string? brightnessInput2 = Console.ReadLine();
|
||||
int value2 = Convert.ToInt16(brightnessInput2);
|
||||
if (string.IsNullOrWhiteSpace(brightnessInput2) || value2 < 0 || value2 > 100) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
_GoveeUdpService.SetBrightness(goveeUdpDevice.IP, value2);
|
||||
Console.WriteLine($"Set Brightness of Device {goveeUdpDevice.IP} to {value2}%!");
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static void InputNine() {
|
||||
RgbColor? color = null;
|
||||
GoveeUdpDevice? goveeUdpDevice = GetUdpDeviceSelection();
|
||||
if (goveeUdpDevice is null) {
|
||||
Console.WriteLine("No Devices discovered! Please use Option 6 first!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"Please choose a Color to set {goveeUdpDevice.IP} to ... (blue, red, green)");
|
||||
string? colorInput = Console.ReadLine()?.ToLower();
|
||||
if (string.IsNullOrWhiteSpace(colorInput) || (colorInput != "blue" && colorInput != "green" && colorInput != "red")) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
if (colorInput == "blue") {
|
||||
color = new RgbColor(0, 0, 254);
|
||||
} else if (colorInput == "green") {
|
||||
color = new RgbColor(0, 254, 0);
|
||||
} else if (colorInput == "red") {
|
||||
color = new RgbColor(254, 0, 0);
|
||||
}
|
||||
if (color is null) {
|
||||
Console.WriteLine("Invalid Color Input!");
|
||||
EndSegment();
|
||||
return;
|
||||
}
|
||||
_GoveeUdpService.SetColor(goveeUdpDevice.IP, color);
|
||||
Console.WriteLine($"Set Color of Device {goveeUdpDevice.IP} to {colorInput}!");
|
||||
EndSegment();
|
||||
}
|
||||
|
||||
private static GoveeUdpDevice? GetUdpDeviceSelection() {
|
||||
int count = 1;
|
||||
Console.WriteLine("Please Choose a Device from the List:");
|
||||
foreach (var device in _udpDevices)
|
||||
{
|
||||
Console.WriteLine($"{count} - IpAdress: {device.ip}, Device Id {device.device}, Model {device.sku}");
|
||||
count++;
|
||||
if (_UDPDevices is not null) {
|
||||
foreach (GoveeUdpDevice device in _UDPDevices) {
|
||||
Console.WriteLine($"{count} - IpAddress: {device.IP}, Device Id {device.Device}, Model {device.Sku}");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
var input = Console.ReadLine();
|
||||
if (string.IsNullOrWhiteSpace(input) || Int16.TryParse(input, out var result) is false)
|
||||
{
|
||||
string? input = Console.ReadLine();
|
||||
if (string.IsNullOrWhiteSpace(input) || !short.TryParse(input, out short result)) {
|
||||
Console.WriteLine("Invalid Input!");
|
||||
return GetUdpDeviceSelection();
|
||||
}
|
||||
|
||||
return _udpDevices[result-1];
|
||||
return _UDPDevices is null || _UDPDevices.Count == 0 ? null : _UDPDevices[result - 1];
|
||||
}
|
||||
|
||||
private static void HandleApiInput()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
private static void HandleApiInput() {
|
||||
while (true) {
|
||||
Console.WriteLine("Please enter/paste your Govee Api Key ...");
|
||||
Console.WriteLine("Your Api Key should look something like this: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
|
||||
var input = Console.ReadLine();
|
||||
if (input is null || input.Length != 36)
|
||||
{
|
||||
string? input = Console.ReadLine();
|
||||
if (input is null || input.Length != 36) {
|
||||
Console.WriteLine("Wrong Api Key Format!");
|
||||
continue;
|
||||
}
|
||||
GoveeApiService.SetApiKey(input);
|
||||
_GoveeApiService.SetApiKey(input);
|
||||
break;
|
||||
}
|
||||
Console.WriteLine("Api Key saved!");
|
||||
}
|
||||
|
||||
private static void EndSegment()
|
||||
{
|
||||
private static void EndSegment() {
|
||||
Console.WriteLine("---------------------------Press any Key to continue---------------------------");
|
||||
Console.ReadLine();
|
||||
_ = Console.ReadLine();
|
||||
}
|
||||
|
||||
private static void PrintWelcomeMessage()
|
||||
{
|
||||
private static void PrintWelcomeMessage() {
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Welcome to the GoveeCSharpConnector Example!");
|
||||
Console.WriteLine($"Version: {Assembly.GetEntryAssembly()?.GetName().Version}");
|
||||
Console.WriteLine($"To test/explore the GoveeCSharpConnector Version: {Assembly.Load("GoveeCSharpConnector").GetName().Version}");
|
||||
Console.WriteLine("----------------------------------------------------------");
|
||||
if (string.IsNullOrEmpty(GoveeApiService.GetApiKey()))
|
||||
{
|
||||
if (string.IsNullOrEmpty(_GoveeApiService.GetApiKey())) {
|
||||
Console.WriteLine("1 - Enter GoveeApi Key - START HERE (Required for Api Service Options!)");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Console.WriteLine("1 - Enter GoveeApi Key - Already Set!");
|
||||
Console.WriteLine("Api Service:");
|
||||
Console.WriteLine("2 - Get a List of all Devices connected to the Api Key Account");
|
||||
@ -296,4 +307,5 @@ public class Program
|
||||
Console.WriteLine("8 - Set Brightness for Device");
|
||||
Console.WriteLine("9 - Set Color of Device");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user