diff --git a/.editorconfig b/.editorconfig
index e1b35f7cc..8f7ace825 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,8 +1,7 @@
-# editorconfig.org
-
-# top-most EditorConfig file
+# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
+# All files
[*]
charset = utf-8
end_of_line = crlf
@@ -25,4 +24,221 @@ indent_size = 2
# XML Configuration Files
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
-indent_size = 2
\ No newline at end of file
+indent_size = 2
+
+# C# files
+[*.cs]
+
+#### Core EditorConfig Options ####
+
+# Indentation and spacing
+indent_size = 4
+indent_style = space
+tab_width = 4
+
+# New line preferences
+end_of_line = crlf
+insert_final_newline = false
+
+#### .NET Coding Conventions ####
+
+# Organize usings
+dotnet_separate_import_directive_groups = false
+dotnet_sort_system_directives_first = false
+file_header_template = unset
+
+# this. and Me. preferences
+dotnet_style_qualification_for_event = false:suggestion
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+
+# Language keywords vs BCL types preferences
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true
+
+# Parentheses preferences
+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
+
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = for_non_interface_members
+
+# Expression-level preferences
+dotnet_style_coalesce_expression = true
+dotnet_style_collection_initializer = true
+dotnet_style_explicit_tuple_names = true
+dotnet_style_namespace_match_folder = true
+dotnet_style_null_propagation = true
+dotnet_style_object_initializer = true
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+dotnet_style_prefer_auto_properties = true:suggestion
+dotnet_style_prefer_compound_assignment = true
+dotnet_style_prefer_conditional_expression_over_assignment = true
+dotnet_style_prefer_conditional_expression_over_return = true
+dotnet_style_prefer_inferred_anonymous_type_member_names = true
+dotnet_style_prefer_inferred_tuple_names = true
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true
+dotnet_style_prefer_simplified_boolean_expressions = true
+dotnet_style_prefer_simplified_interpolation = true
+
+# Field preferences
+dotnet_style_readonly_field = true
+
+# Parameter preferences
+dotnet_code_quality_unused_parameters = all
+
+# Suppression preferences
+dotnet_remove_unnecessary_suppression_exclusions = 0
+
+# New line preferences
+dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion
+dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
+
+#### C# Coding Conventions ####
+
+# var preferences
+csharp_style_var_elsewhere = true:suggestion
+csharp_style_var_for_built_in_types = true:suggestion
+csharp_style_var_when_type_is_apparent = true:suggestion
+
+# Expression-bodied members
+csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
+csharp_style_expression_bodied_constructors = true
+csharp_style_expression_bodied_indexers = true
+csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
+csharp_style_expression_bodied_local_functions = false
+csharp_style_expression_bodied_methods = true
+csharp_style_expression_bodied_operators = true
+csharp_style_expression_bodied_properties = true
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_as_with_null_check = true
+csharp_style_pattern_matching_over_is_with_cast_check = true
+csharp_style_prefer_not_pattern = true
+csharp_style_prefer_pattern_matching = true:suggestion
+csharp_style_prefer_switch_expression = true
+
+# Null-checking preferences
+csharp_style_conditional_delegate_call = true
+
+# Modifier preferences
+csharp_prefer_static_local_function = true
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
+
+# Code-block preferences
+csharp_prefer_braces = false:suggestion
+csharp_prefer_simple_using_statement = true
+csharp_style_namespace_declarations = file_scoped:suggestion
+
+# Expression-level preferences
+csharp_prefer_simple_default_expression = true
+csharp_style_deconstructed_variable_declaration = true
+csharp_style_implicit_object_creation_when_type_is_apparent = true
+csharp_style_inlined_variable_declaration = true
+csharp_style_pattern_local_over_anonymous_function = true
+csharp_style_prefer_index_operator = true:silent
+csharp_style_prefer_null_check_over_type_check = true
+csharp_style_prefer_range_operator = true:silent
+csharp_style_throw_expression = true
+csharp_style_unused_value_assignment_preference = discard_variable
+csharp_style_unused_value_expression_statement_preference = discard_variable
+
+# 'using' directive preferences
+csharp_using_directive_placement = outside_namespace:warning
+
+# New line preferences
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
+csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning
+
+#### C# Formatting Rules ####
+
+# New line preferences
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = false
+csharp_indent_labels = one_less_than_current
+csharp_indent_switch_labels = true
+
+# Space preferences
+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
+
+# Wrapping preferences
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+
+#### Naming styles ####
+
+# Naming rules
+
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+
+dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+
+# Symbol specifications
+
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.required_modifiers =
+
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.required_modifiers =
+
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.required_modifiers =
+
+# Naming styles
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.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.begins_with_i.capitalization = pascal_case
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 37f69a858..7d783a50a 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,6 +1,6 @@
# These are supported funding model platforms
-github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+github: [NickeManarin]
patreon: nicke
open_collective: # Replace with a single Open Collective username
ko_fi: nickemanarin
diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md
new file mode 100644
index 000000000..09ad559eb
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug-report.md
@@ -0,0 +1,31 @@
+---
+name: Bug Report
+about: Create a report to help us improve
+title: "[Bug] Title"
+labels: "\U0001F537 Bug \U0001F41B, ⬜ Pending"
+assignees: NickeManarin
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. Windows 10]
+ - Version [e.g. 2.35.2]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md
new file mode 100644
index 000000000..c368095d1
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature-request.md
@@ -0,0 +1,20 @@
+---
+name: Feature Request
+about: Suggest an idea for this project
+title: "[Feature Request] Title"
+labels: "\U0001F537Enhancement, ⬜ Pending"
+assignees: NickeManarin
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/workflows/discord-releases.yml b/.github/workflows/discord-releases.yml
new file mode 100644
index 000000000..ff95126a2
--- /dev/null
+++ b/.github/workflows/discord-releases.yml
@@ -0,0 +1,31 @@
+# This is a basic workflow to help you get started with Actions
+name: Discord • Releases
+
+# Controls when the action will run.
+on:
+ # Triggers the workflow on new release.
+ release:
+ types: [published]
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+ # This workflow contains a single job called "released"
+ released:
+ # The type of runner that the job will run on
+ runs-on: ubuntu-latest
+ name: Sends release details to Discord/News channel
+
+ # Steps represent a sequence of tasks that will be executed as part of the job
+ steps:
+ - name: Sending release notes
+
+ # Checks-out a repository, to send the release notes
+ uses: nhevia/discord-styled-releases@main
+
+ # Gets the ID and Token from the project secrets
+ with:
+ webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
+ webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 6d584557d..2e4c06826 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,17 +5,16 @@
/GifRecorder.v12.suo
/.vs
/GifRecorder
-/ScreenToGif/ScreenToGif.csproj.user
/GifRecorder.v12-Notebook-Nicke.suo
/GifRecorder.suo
-/GifRecorder.sln.DotSettings.user
/GifRecorder.sdf
/GifRecorder.sln.DotSettings
ScreenToGif/Util/Secret.cs
/ScreenToGif/Util/Secret.cs
-/Other/Translator/Translator.csproj.user
/ScreenToGif.UWP
/packages
obj
bin
+/log.txt
+*.user
diff --git a/GifRecorder.sln b/GifRecorder.sln
index 27f9c1865..99a05f512 100644
--- a/GifRecorder.sln
+++ b/GifRecorder.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29326.143
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31512.422
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{0039724A-6303-4D73-B5B2-7063DF16C573}"
ProjectSection(SolutionItems) = preProject
@@ -11,109 +11,146 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{0039724A
README.md = README.md
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenToGif", "ScreenToGif\ScreenToGif.csproj", "{9A332077-74BA-4C6A-8381-6D98C31A490A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenToGif", "ScreenToGif\ScreenToGif.csproj", "{9A332077-74BA-4C6A-8381-6D98C31A490A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{13F2A1B9-496A-446E-8B06-776ACAE5CEA4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HookTest", "Other\HookTest\HookTest.csproj", "{A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Translator", "Other\Translator\Translator.csproj", "{8B516DFB-0981-48A2-8A06-35F085C13980}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Translator", "Other\Translator\Translator.csproj", "{8B516DFB-0981-48A2-8A06-35F085C13980}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenToGif.Domain", "ScreenToGif.Model\ScreenToGif.Domain.csproj", "{EEE831AD-1447-474D-9875-94E56A854E71}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenToGif.Cloud.YandexDisk.Tests", "ScreenToGif.Cloud.YandexDisk.Tests\ScreenToGif.Cloud.YandexDisk.Tests.csproj", "{2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenToGif.Native", "ScreenToGif.Native\ScreenToGif.Native.csproj", "{66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{840C4813-08E8-42C9-83CB-C0FA8BBBD763}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenToGif.Test", "ScreenToGif.Test\ScreenToGif.Test.csproj", "{9D64714B-20BC-4A18-B89F-FA432E710EB4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PositioningTest", "Other\PositioningTest\PositioningTest.csproj", "{6204EAEF-C4AA-4005-A369-A8E779205696}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenToGif.Util", "ScreenToGif.Util\ScreenToGif.Util.csproj", "{B39A6DFB-F44E-403D-9451-3CEAD3423135}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenToGif.ViewModel", "ScreenToGif.ViewModel\ScreenToGif.ViewModel.csproj", "{97AAAA14-2793-49B7-96C5-6C6E83C55EB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
- Debug|ARM = Debug|ARM
+ Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
- Release|ARM = Release|ARM
+ Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|ARM.Build.0 = Debug|Any CPU
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|ARM64.Build.0 = Debug|ARM64
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|x64.ActiveCfg = Debug|x64
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|x64.Build.0 = Debug|x64
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|x86.ActiveCfg = Debug|x86
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Debug|x86.Build.0 = Debug|x86
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|Any CPU.Build.0 = Release|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|ARM.ActiveCfg = Release|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|ARM.Build.0 = Release|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x64.ActiveCfg = Release|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x64.Build.0 = Release|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x86.ActiveCfg = Release|Any CPU
- {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x86.Build.0 = Release|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Release|Any CPU.Build.0 = Release|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Release|ARM.ActiveCfg = Release|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Release|x64.ActiveCfg = Release|Any CPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}.Release|x86.ActiveCfg = Release|Any CPU
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|ARM64.ActiveCfg = Release|ARM64
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|ARM64.Build.0 = Release|ARM64
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x64.ActiveCfg = Release|x64
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x64.Build.0 = Release|x64
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x86.ActiveCfg = Release|x86
+ {9A332077-74BA-4C6A-8381-6D98C31A490A}.Release|x86.Build.0 = Release|x86
{8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|x64.ActiveCfg = Debug|Any CPU
- {8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|x64.ActiveCfg = Debug|x64
+ {8B516DFB-0981-48A2-8A06-35F085C13980}.Debug|x86.ActiveCfg = Debug|x86
{8B516DFB-0981-48A2-8A06-35F085C13980}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B516DFB-0981-48A2-8A06-35F085C13980}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B516DFB-0981-48A2-8A06-35F085C13980}.Release|ARM.ActiveCfg = Release|Any CPU
- {8B516DFB-0981-48A2-8A06-35F085C13980}.Release|x64.ActiveCfg = Release|Any CPU
- {8B516DFB-0981-48A2-8A06-35F085C13980}.Release|x86.ActiveCfg = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|ARM.Build.0 = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|x64.ActiveCfg = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|x64.Build.0 = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|x86.ActiveCfg = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Debug|x86.Build.0 = Debug|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|Any CPU.Build.0 = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|ARM.ActiveCfg = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|ARM.Build.0 = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|x64.ActiveCfg = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|x64.Build.0 = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|x86.ActiveCfg = Release|Any CPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}.Release|x86.Build.0 = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|ARM.Build.0 = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|x64.ActiveCfg = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|x64.Build.0 = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Debug|x86.Build.0 = Debug|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|Any CPU.Build.0 = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|ARM.ActiveCfg = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|ARM.Build.0 = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|x64.ActiveCfg = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|x64.Build.0 = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|x86.ActiveCfg = Release|Any CPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}.Release|x86.Build.0 = Release|Any CPU
+ {8B516DFB-0981-48A2-8A06-35F085C13980}.Release|ARM64.ActiveCfg = Release|ARM64
+ {8B516DFB-0981-48A2-8A06-35F085C13980}.Release|x64.ActiveCfg = Release|x64
+ {8B516DFB-0981-48A2-8A06-35F085C13980}.Release|x86.ActiveCfg = Release|x86
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|ARM64.Build.0 = Debug|ARM64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|x64.ActiveCfg = Debug|x64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|x64.Build.0 = Debug|x64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|x86.ActiveCfg = Debug|x86
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Debug|x86.Build.0 = Debug|x86
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|ARM64.ActiveCfg = Release|ARM64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|ARM64.Build.0 = Release|ARM64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|x64.ActiveCfg = Release|x64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|x64.Build.0 = Release|x64
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|x86.ActiveCfg = Release|x86
+ {EEE831AD-1447-474D-9875-94E56A854E71}.Release|x86.Build.0 = Release|x86
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|ARM64.Build.0 = Debug|ARM64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|x64.ActiveCfg = Debug|x64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|x64.Build.0 = Debug|x64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|x86.ActiveCfg = Debug|x86
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Debug|x86.Build.0 = Debug|x86
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|Any CPU.Build.0 = Release|Any CPU
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|ARM64.ActiveCfg = Release|ARM64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|ARM64.Build.0 = Release|ARM64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|x64.ActiveCfg = Release|x64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|x64.Build.0 = Release|x64
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|x86.ActiveCfg = Release|x86
+ {66D60F4A-C0B4-4077-8DE6-0431F6AD5E87}.Release|x86.Build.0 = Release|x86
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|ARM64.Build.0 = Debug|ARM64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|x64.ActiveCfg = Debug|x64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|x64.Build.0 = Debug|x64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|x86.ActiveCfg = Debug|x86
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Debug|x86.Build.0 = Debug|x86
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|ARM64.ActiveCfg = Release|ARM64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|ARM64.Build.0 = Release|ARM64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|x64.ActiveCfg = Release|x64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|x64.Build.0 = Release|x64
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|x86.ActiveCfg = Release|x86
+ {9D64714B-20BC-4A18-B89F-FA432E710EB4}.Release|x86.Build.0 = Release|x86
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|ARM64.Build.0 = Debug|ARM64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|x64.ActiveCfg = Debug|x64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|x64.Build.0 = Debug|x64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|x86.ActiveCfg = Debug|x86
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Debug|x86.Build.0 = Debug|x86
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|ARM64.ActiveCfg = Release|ARM64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|ARM64.Build.0 = Release|ARM64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|x64.ActiveCfg = Release|x64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|x64.Build.0 = Release|x64
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|x86.ActiveCfg = Release|x86
+ {B39A6DFB-F44E-403D-9451-3CEAD3423135}.Release|x86.Build.0 = Release|x86
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|ARM64.Build.0 = Debug|ARM64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|x64.ActiveCfg = Debug|x64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|x64.Build.0 = Debug|x64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|x86.ActiveCfg = Debug|x86
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Debug|x86.Build.0 = Debug|x86
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|ARM64.ActiveCfg = Release|ARM64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|ARM64.Build.0 = Release|ARM64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|x64.ActiveCfg = Release|x64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|x64.Build.0 = Release|x64
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|x86.ActiveCfg = Release|x86
+ {97AAAA14-2793-49B7-96C5-6C6E83C55EB7}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5} = {13F2A1B9-496A-446E-8B06-776ACAE5CEA4}
{8B516DFB-0981-48A2-8A06-35F085C13980} = {13F2A1B9-496A-446E-8B06-776ACAE5CEA4}
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D} = {840C4813-08E8-42C9-83CB-C0FA8BBBD763}
- {6204EAEF-C4AA-4005-A369-A8E779205696} = {13F2A1B9-496A-446E-8B06-776ACAE5CEA4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E505E312-14B9-49C0-AC18-B3B2FB6C1661}
diff --git a/LOCALIZATION.md b/LOCALIZATION.md
index 8c30438ee..9ec0fa2df 100644
--- a/LOCALIZATION.md
+++ b/LOCALIZATION.md
@@ -1,24 +1,16 @@
# Localization
ScreenToGif's base language is [English](https://github.com/NickeManarin/ScreenToGif/blob/master/ScreenToGif/Resources/Localization/StringResources.en.xaml).
-To contribute to the translation of ScreenToGif, you can fork this repository or copy the texts resources and send it to nicke@outlook.com.br.
-[](https://github.com/NickeManarin/ScreenToGif)
+The typical workflow for translation work comprises three key stages: translating, testing, and submission. To contribute to the translation of ScreenToGif, it is advisable to first review the guidelines provided in the wiki:
-This allows you to edit and push changes of files to your fork so that you can then open a pull request.
+- [Translating the App](https://github.com/NickeManarin/ScreenToGif/wiki/Localization)
+- [Translating the Installer](https://github.com/NickeManarin/ScreenToGif/wiki/Localization-%28Installer%29)
+- [Translating the Website](https://github.com/NickeManarin/ScreenToGif/wiki/Localization-%28Website%29)
-For more information, visit GitHub's official [forking guide](https://guides.github.com/activities/forking/).
+As this project always are moving forward, new strings get added from time to time which means they need to be added to the language files and be translated. Anyone can still contribute to the languages.
-## Maintaining languages
-As this project always are moving forward, new strings get added from time to time which means they need to be added to the language files and be translated.
-
-Use the [Translator](https://github.com/NickeManarin/ScreenToGif/tree/master/Other/Translator) application to help you.
-
-You can get more information on the [wiki](https://github.com/NickeManarin/ScreenToGif/wiki/Localization).
-
-## Creating a new language
-If you want to begin translating ScreenToGif for a new language, create a new file in the ``./Resources/Localization`` directory with the correct two letter [language](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes#Partial_ISO_639_table) and [country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Decoding_table) (e.g. `es-AR`), then paste the contents of the ScreenToGif's base language file into it and start translating the strings.
-
-### Language Status
+---
+## Language Status
| Language | Maintainer | Status |
| -------- | ---------- | ----------- |
@@ -43,5 +35,3 @@ If you want to begin translating ScreenToGif for a new language, create a new fi
| [](https://github.com/NickeManarin/ScreenToGif/blob/master/ScreenToGif/Resources/Localization/StringResources.uk.xaml) | [NickeManarin](https://github.com/NickeManarin) | Need help |
| [](https://github.com/NickeManarin/ScreenToGif/blob/master/ScreenToGif/Resources/Localization/StringResources.zh--Hant.xaml) | [spietras](https://github.com/spietras) | Updated |
| [](https://github.com/NickeManarin/ScreenToGif/blob/master/ScreenToGif/Resources/Localization/StringResources.zh.xaml) | [spietras](https://github.com/spietras) | Updated |
-
-Anyone can still contribute to the languages.
diff --git a/Other/HookTest/App.config b/Other/HookTest/App.config
deleted file mode 100644
index 8e1564635..000000000
--- a/Other/HookTest/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/HookTest/App.xaml b/Other/HookTest/App.xaml
deleted file mode 100644
index 2b8374e0b..000000000
--- a/Other/HookTest/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Other/HookTest/App.xaml.cs b/Other/HookTest/App.xaml.cs
deleted file mode 100644
index 38e9fbacd..000000000
--- a/Other/HookTest/App.xaml.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace HookTest
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/Other/HookTest/HookTest.csproj b/Other/HookTest/HookTest.csproj
deleted file mode 100644
index 14ae50420..000000000
--- a/Other/HookTest/HookTest.csproj
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {A4BCA4D6-B6F4-4875-BD8A-A59E0CE5E7B5}
- WinExe
- Properties
- HookTest
- HookTest
- v4.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/HookTest/MainWindow.xaml b/Other/HookTest/MainWindow.xaml
deleted file mode 100644
index 8f374f1ba..000000000
--- a/Other/HookTest/MainWindow.xaml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Other/HookTest/MainWindow.xaml.cs b/Other/HookTest/MainWindow.xaml.cs
deleted file mode 100644
index 0eb64f357..000000000
--- a/Other/HookTest/MainWindow.xaml.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Windows;
-using HookTest.Util;
-
-namespace HookTest
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
- {
- private UserActivityHook _hook;
-
- public MainWindow()
- {
- InitializeComponent();
-
- _hook = new UserActivityHook(true, true);
- _hook.OnMouseActivity += _hook_OnMouseActivity;
- _hook.KeyDown += _hook_KeyDown;
- }
-
- void _hook_KeyDown(object sender, CustomKeyEventArgs e)
- {
- KeyboardTextBox.Text += String.Format(">> {0} - {1}{2}", e.Key, DateTime.Now.ToString("HH:mm:ss"), Environment.NewLine);
- MouseTextBox.ScrollToLine(MouseTextBox.LineCount - 1);
- }
-
- void _hook_OnMouseActivity(object sender, CustomMouseEventArgs e)
- {
- MouseTextBox.Text += String.Format(">> {0} - {1}{2}", e.Button, DateTime.Now.ToString("HH:mm:ss"), Environment.NewLine);
- MouseTextBox.ScrollToLine(MouseTextBox.LineCount - 1);
- }
-
- private void StartButton_Click(object sender, RoutedEventArgs e)
- {
- _hook.Start();
- }
-
- private void StopButton_Click(object sender, RoutedEventArgs e)
- {
- _hook.Stop();
- }
- }
-}
diff --git a/Other/HookTest/Properties/AssemblyInfo.cs b/Other/HookTest/Properties/AssemblyInfo.cs
deleted file mode 100644
index 26bb2ab32..000000000
--- a/Other/HookTest/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("HookTest")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("HookTest")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Other/HookTest/Properties/Resources.Designer.cs b/Other/HookTest/Properties/Resources.Designer.cs
deleted file mode 100644
index 3c6e9dd9a..000000000
--- a/Other/HookTest/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace HookTest.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HookTest.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Other/HookTest/Properties/Resources.resx b/Other/HookTest/Properties/Resources.resx
deleted file mode 100644
index af7dbebba..000000000
--- a/Other/HookTest/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Other/HookTest/Properties/Settings.Designer.cs b/Other/HookTest/Properties/Settings.Designer.cs
deleted file mode 100644
index af0024a0d..000000000
--- a/Other/HookTest/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace HookTest.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Other/HookTest/Properties/Settings.settings b/Other/HookTest/Properties/Settings.settings
deleted file mode 100644
index 033d7a5e9..000000000
--- a/Other/HookTest/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/HookTest/Util/CustomKeyEventArgs.cs b/Other/HookTest/Util/CustomKeyEventArgs.cs
deleted file mode 100644
index c6f687f33..000000000
--- a/Other/HookTest/Util/CustomKeyEventArgs.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Input;
-
-namespace HookTest.Util
-{
- public class CustomKeyEventArgs : EventArgs
- {
- public Keys Key { get; private set; }
-
- public bool Handled { get; private set; }
-
- public CustomKeyEventArgs(Keys key)
- {
- Key = key;
- }
- }
-}
diff --git a/Other/HookTest/Util/CustomKeyPressEventArgs.cs b/Other/HookTest/Util/CustomKeyPressEventArgs.cs
deleted file mode 100644
index cacd33f37..000000000
--- a/Other/HookTest/Util/CustomKeyPressEventArgs.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace HookTest.Util
-{
- public class CustomKeyPressEventArgs : EventArgs
- {
- ///
- /// Gets or sets the character corresponding to the key pressed.
- ///
- ///
- /// The ASCII character that is composed. For example, if the user presses SHIFT + K,
- /// this property returns an uppercase K.
- ///
- public char KeyChar { get; private set; }
-
- public bool Handled { get; private set; }
-
- public CustomKeyPressEventArgs(char keyChar)
- {
- KeyChar = keyChar;
- }
- }
-}
diff --git a/Other/HookTest/Util/CustomMouseEventArgs.cs b/Other/HookTest/Util/CustomMouseEventArgs.cs
deleted file mode 100644
index 6754cc3bc..000000000
--- a/Other/HookTest/Util/CustomMouseEventArgs.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Windows.Input;
-
-namespace HookTest.Util
-{
- public class CustomMouseEventArgs : EventArgs
- {
- public MouseButton Button { get; private set; }
-
- public int Clicks { get; private set; }
-
- public int PosX { get; private set; }
-
- public int PosY { get; private set; }
-
- public int Delta { get; private set; }
-
- public CustomMouseEventArgs(MouseButton button, int clicks, int x, int y, int delta)
- {
- Button = button;
- Clicks = clicks;
- PosX = x;
- PosY = y;
- Delta = delta;
- }
- }
-}
diff --git a/Other/HookTest/Util/Keys.cs b/Other/HookTest/Util/Keys.cs
deleted file mode 100644
index 1d9e7cec9..000000000
--- a/Other/HookTest/Util/Keys.cs
+++ /dev/null
@@ -1,841 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Input;
-
-namespace HookTest.Util
-{
- ///
- /// Specifies key codes and modifiers.
- ///
- [ComVisible(true)]
- [Flags]
- [TypeConverter(typeof(KeyConverter))]
- public enum Keys
- {
- ///
- /// The bitmask to extract modifiers from a key value.
- ///
- Modifiers = -65536,
-
- ///
- /// No key pressed.
- ///
- None = 0,
-
- ///
- /// The left mouse button.
- ///
- LButton = 1,
- //
- // Summary:
- // The right mouse button.
- RButton = 2,
- //
- // Summary:
- // The CANCEL key.
- Cancel = 3,
- //
- // Summary:
- // The middle mouse button (three-button mouse).
- MButton = 4,
- //
- // Summary:
- // The first x mouse button (five-button mouse).
- XButton1 = 5,
- //
- // Summary:
- // The second x mouse button (five-button mouse).
- XButton2 = 6,
- //
- // Summary:
- // The BACKSPACE key.
- Back = 8,
- //
- // Summary:
- // The TAB key.
- Tab = 9,
- //
- // Summary:
- // The LINEFEED key.
- LineFeed = 10,
- //
- // Summary:
- // The CLEAR key.
- Clear = 12,
- //
- // Summary:
- // The ENTER key.
- Enter = 13,
- //
- // Summary:
- // The RETURN key.
- Return = 13,
- //
- // Summary:
- // The SHIFT key.
- ShiftKey = 16,
- //
- // Summary:
- // The CTRL key.
- ControlKey = 17,
- //
- // Summary:
- // The ALT key.
- Menu = 18,
- //
- // Summary:
- // The PAUSE key.
- Pause = 19,
- //
- // Summary:
- // The CAPS LOCK key.
- CapsLock = 20,
- //
- // Summary:
- // The CAPS LOCK key.
- Capital = 20,
- //
- // Summary:
- // The IME Kana mode key.
- KanaMode = 21,
- //
- // Summary:
- // The IME Hanguel mode key. (maintained for compatibility; use HangulMode)
- HanguelMode = 21,
- //
- // Summary:
- // The IME Hangul mode key.
- HangulMode = 21,
- //
- // Summary:
- // The IME Junja mode key.
- JunjaMode = 23,
- //
- // Summary:
- // The IME final mode key.
- FinalMode = 24,
- //
- // Summary:
- // The IME Kanji mode key.
- KanjiMode = 25,
- //
- // Summary:
- // The IME Hanja mode key.
- HanjaMode = 25,
- //
- // Summary:
- // The ESC key.
- Escape = 27,
- //
- // Summary:
- // The IME convert key.
- IMEConvert = 28,
- //
- // Summary:
- // The IME nonconvert key.
- IMENonconvert = 29,
- //
- // Summary:
- // The IME accept key. Obsolete, use System.Windows.Forms.Keys.IMEAccept instead.
- IMEAceept = 30,
- //
- // Summary:
- // The IME accept key, replaces System.Windows.Forms.Keys.IMEAceept.
- IMEAccept = 30,
- //
- // Summary:
- // The IME mode change key.
- IMEModeChange = 31,
- //
- // Summary:
- // The SPACEBAR key.
- Space = 32,
- //
- // Summary:
- // The PAGE UP key.
- Prior = 33,
- //
- // Summary:
- // The PAGE UP key.
- PageUp = 33,
- //
- // Summary:
- // The PAGE DOWN key.
- Next = 34,
- //
- // Summary:
- // The PAGE DOWN key.
- PageDown = 34,
- //
- // Summary:
- // The END key.
- End = 35,
- //
- // Summary:
- // The HOME key.
- Home = 36,
- //
- // Summary:
- // The LEFT ARROW key.
- Left = 37,
- //
- // Summary:
- // The UP ARROW key.
- Up = 38,
- //
- // Summary:
- // The RIGHT ARROW key.
- Right = 39,
- //
- // Summary:
- // The DOWN ARROW key.
- Down = 40,
- //
- // Summary:
- // The SELECT key.
- Select = 41,
- //
- // Summary:
- // The PRINT key.
- Print = 42,
- //
- // Summary:
- // The EXECUTE key.
- Execute = 43,
- //
- // Summary:
- // The PRINT SCREEN key.
- PrintScreen = 44,
- //
- // Summary:
- // The PRINT SCREEN key.
- Snapshot = 44,
- //
- // Summary:
- // The INS key.
- Insert = 45,
- //
- // Summary:
- // The DEL key.
- Delete = 46,
- //
- // Summary:
- // The HELP key.
- Help = 47,
- //
- // Summary:
- // The 0 key.
- D0 = 48,
- //
- // Summary:
- // The 1 key.
- D1 = 49,
- //
- // Summary:
- // The 2 key.
- D2 = 50,
- //
- // Summary:
- // The 3 key.
- D3 = 51,
- //
- // Summary:
- // The 4 key.
- D4 = 52,
- //
- // Summary:
- // The 5 key.
- D5 = 53,
- //
- // Summary:
- // The 6 key.
- D6 = 54,
- //
- // Summary:
- // The 7 key.
- D7 = 55,
- //
- // Summary:
- // The 8 key.
- D8 = 56,
- //
- // Summary:
- // The 9 key.
- D9 = 57,
- //
- // Summary:
- // The A key.
- A = 65,
- //
- // Summary:
- // The B key.
- B = 66,
- //
- // Summary:
- // The C key.
- C = 67,
- //
- // Summary:
- // The D key.
- D = 68,
- //
- // Summary:
- // The E key.
- E = 69,
- //
- // Summary:
- // The F key.
- F = 70,
- //
- // Summary:
- // The G key.
- G = 71,
- //
- // Summary:
- // The H key.
- H = 72,
- //
- // Summary:
- // The I key.
- I = 73,
- //
- // Summary:
- // The J key.
- J = 74,
- //
- // Summary:
- // The K key.
- K = 75,
- //
- // Summary:
- // The L key.
- L = 76,
- //
- // Summary:
- // The M key.
- M = 77,
- //
- // Summary:
- // The N key.
- N = 78,
- //
- // Summary:
- // The O key.
- O = 79,
- //
- // Summary:
- // The P key.
- P = 80,
- //
- // Summary:
- // The Q key.
- Q = 81,
- //
- // Summary:
- // The R key.
- R = 82,
- //
- // Summary:
- // The S key.
- S = 83,
- //
- // Summary:
- // The T key.
- T = 84,
- //
- // Summary:
- // The U key.
- U = 85,
- //
- // Summary:
- // The V key.
- V = 86,
- //
- // Summary:
- // The W key.
- W = 87,
- //
- // Summary:
- // The X key.
- X = 88,
- //
- // Summary:
- // The Y key.
- Y = 89,
- //
- // Summary:
- // The Z key.
- Z = 90,
- //
- // Summary:
- // The left Windows logo key (Microsoft Natural Keyboard).
- LWin = 91,
- //
- // Summary:
- // The right Windows logo key (Microsoft Natural Keyboard).
- RWin = 92,
- //
- // Summary:
- // The application key (Microsoft Natural Keyboard).
- Apps = 93,
- //
- // Summary:
- // The computer sleep key.
- Sleep = 95,
- //
- // Summary:
- // The 0 key on the numeric keypad.
- NumPad0 = 96,
- //
- // Summary:
- // The 1 key on the numeric keypad.
- NumPad1 = 97,
- //
- // Summary:
- // The 2 key on the numeric keypad.
- NumPad2 = 98,
- //
- // Summary:
- // The 3 key on the numeric keypad.
- NumPad3 = 99,
- //
- // Summary:
- // The 4 key on the numeric keypad.
- NumPad4 = 100,
- //
- // Summary:
- // The 5 key on the numeric keypad.
- NumPad5 = 101,
- //
- // Summary:
- // The 6 key on the numeric keypad.
- NumPad6 = 102,
- //
- // Summary:
- // The 7 key on the numeric keypad.
- NumPad7 = 103,
- //
- // Summary:
- // The 8 key on the numeric keypad.
- NumPad8 = 104,
- //
- // Summary:
- // The 9 key on the numeric keypad.
- NumPad9 = 105,
- //
- // Summary:
- // The multiply key.
- Multiply = 106,
- //
- // Summary:
- // The add key.
- Add = 107,
- //
- // Summary:
- // The separator key.
- Separator = 108,
- //
- // Summary:
- // The subtract key.
- Subtract = 109,
- //
- // Summary:
- // The decimal key.
- Decimal = 110,
- //
- // Summary:
- // The divide key.
- Divide = 111,
- //
- // Summary:
- // The F1 key.
- F1 = 112,
- //
- // Summary:
- // The F2 key.
- F2 = 113,
- //
- // Summary:
- // The F3 key.
- F3 = 114,
- //
- // Summary:
- // The F4 key.
- F4 = 115,
- //
- // Summary:
- // The F5 key.
- F5 = 116,
- //
- // Summary:
- // The F6 key.
- F6 = 117,
- //
- // Summary:
- // The F7 key.
- F7 = 118,
- //
- // Summary:
- // The F8 key.
- F8 = 119,
- //
- // Summary:
- // The F9 key.
- F9 = 120,
- //
- // Summary:
- // The F10 key.
- F10 = 121,
- //
- // Summary:
- // The F11 key.
- F11 = 122,
- //
- // Summary:
- // The F12 key.
- F12 = 123,
- //
- // Summary:
- // The F13 key.
- F13 = 124,
- //
- // Summary:
- // The F14 key.
- F14 = 125,
- //
- // Summary:
- // The F15 key.
- F15 = 126,
- //
- // Summary:
- // The F16 key.
- F16 = 127,
- //
- // Summary:
- // The F17 key.
- F17 = 128,
- //
- // Summary:
- // The F18 key.
- F18 = 129,
- //
- // Summary:
- // The F19 key.
- F19 = 130,
- //
- // Summary:
- // The F20 key.
- F20 = 131,
- //
- // Summary:
- // The F21 key.
- F21 = 132,
- //
- // Summary:
- // The F22 key.
- F22 = 133,
- //
- // Summary:
- // The F23 key.
- F23 = 134,
- //
- // Summary:
- // The F24 key.
- F24 = 135,
- //
- // Summary:
- // The NUM LOCK key.
- NumLock = 144,
- //
- // Summary:
- // The SCROLL LOCK key.
- Scroll = 145,
- //
- // Summary:
- // The left SHIFT key.
- LShiftKey = 160,
- //
- // Summary:
- // The right SHIFT key.
- RShiftKey = 161,
- //
- // Summary:
- // The left CTRL key.
- LControlKey = 162,
- //
- // Summary:
- // The right CTRL key.
- RControlKey = 163,
- //
- // Summary:
- // The left ALT key.
- LMenu = 164,
- //
- // Summary:
- // The right ALT key.
- RMenu = 165,
- //
- // Summary:
- // The browser back key (Windows 2000 or later).
- BrowserBack = 166,
- //
- // Summary:
- // The browser forward key (Windows 2000 or later).
- BrowserForward = 167,
- //
- // Summary:
- // The browser refresh key (Windows 2000 or later).
- BrowserRefresh = 168,
- //
- // Summary:
- // The browser stop key (Windows 2000 or later).
- BrowserStop = 169,
- //
- // Summary:
- // The browser search key (Windows 2000 or later).
- BrowserSearch = 170,
- //
- // Summary:
- // The browser favorites key (Windows 2000 or later).
- BrowserFavorites = 171,
- //
- // Summary:
- // The browser home key (Windows 2000 or later).
- BrowserHome = 172,
- //
- // Summary:
- // The volume mute key (Windows 2000 or later).
- VolumeMute = 173,
- //
- // Summary:
- // The volume down key (Windows 2000 or later).
- VolumeDown = 174,
- //
- // Summary:
- // The volume up key (Windows 2000 or later).
- VolumeUp = 175,
- //
- // Summary:
- // The media next track key (Windows 2000 or later).
- MediaNextTrack = 176,
- //
- // Summary:
- // The media previous track key (Windows 2000 or later).
- MediaPreviousTrack = 177,
- //
- // Summary:
- // The media Stop key (Windows 2000 or later).
- MediaStop = 178,
- //
- // Summary:
- // The media play pause key (Windows 2000 or later).
- MediaPlayPause = 179,
- //
- // Summary:
- // The launch mail key (Windows 2000 or later).
- LaunchMail = 180,
- //
- // Summary:
- // The select media key (Windows 2000 or later).
- SelectMedia = 181,
-
- ///
- /// The start application one key (Windows 2000 or later).
- ///
- LaunchApplication1 = 182,
-
- ///
- /// The start application two key (Windows 2000 or later).
- ///
- LaunchApplication2 = 183,
-
- ///
- /// The OEM 1 key.
- ///
- Oem1 = 186,
-
- ///
- /// The OEM Semicolon key on a US standard keyboard (Windows 2000 or later).
- ///
- OemSemicolon = 186,
-
- ///
- /// The OEM plus key on any country/region keyboard (Windows 2000 or later).
- ///
- Oemplus = 187,
-
- ///
- /// The OEM comma key on any country/region keyboard (Windows 2000 or later).
- ///
- Oemcomma = 188,
-
- ///
- /// The OEM minus key on any country/region keyboard (Windows 2000 or later).
- ///
- OemMinus = 189,
-
- ///
- /// The OEM period key on any country/region keyboard (Windows 2000 or later).
- ///
- OemPeriod = 190,
-
- ///
- /// The OEM question mark key on a US standard keyboard (Windows 2000 or later).
- ///
- OemQuestion = 191,
-
- ///
- /// The OEM 2 key.
- ///
- Oem2 = 191,
-
- ///
- /// The OEM tilde key on a US standard keyboard (Windows 2000 or later).
- ///
- Oemtilde = 192,
-
- ///
- /// The OEM 3 key.
- ///
- Oem3 = 192,
-
- ///
- /// The OEM 4 key.
- ///
- Oem4 = 219,
-
- ///
- /// The OEM open bracket key on a US standard keyboard (Windows 2000 or later).
- ///
- OemOpenBrackets = 219,
-
- ///
- /// The OEM pipe key on a US standard keyboard (Windows 2000 or later).
- ///
- OemPipe = 220,
-
- ///
- /// The OEM 5 key.
- ///
- Oem5 = 220,
-
- ///
- /// The OEM 6 key.
- ///
- Oem6 = 221,
-
- ///
- /// The OEM close bracket key on a US standard keyboard (Windows 2000 or later).
- ///
- OemCloseBrackets = 221,
-
- ///
- /// The OEM 7 key.
- ///
- Oem7 = 222,
-
- ///
- /// The OEM singled/double quote key on a US standard keyboard (Windows 2000
- // or later).
- ///
- OemQuotes = 222,
-
- ///
- /// The OEM 8 key.
- ///
- Oem8 = 223,
-
- ///
- /// The OEM 102 key.
- ///
- Oem102 = 226,
-
- ///
- /// The OEM angle bracket or backslash key on the RT 102 key keyboard (Windows
- // 2000 or later).
- ///
- OemBackslash = 226,
-
- ///
- /// The PROCESS KEY key.
- ///
- ProcessKey = 229,
-
- ///
- /// Used to pass Unicode characters as if they were keystrokes. The Packet key
- /// value is the low word of a 32-bit virtual-key value used for non-keyboard
- /// input methods.
- ///
- Packet = 231,
-
- ///
- /// The ATTN key.
- ///
- Attn = 246,
-
- ///
- /// The CRSEL key.
- ///
- Crsel = 247,
-
- ///
- /// The EXSEL key.
- ///
- Exsel = 248,
-
- ///
- /// The ERASE EOF key.
- ///
- EraseEof = 249,
-
- ///
- /// The PLAY key.
- ///
- Play = 250,
-
- ///
- /// The ZOOM key.
- ///
- Zoom = 251,
-
- ///
- /// A constant reserved for future use.
- ///
- NoName = 252,
-
- ///
- /// The PA1 key.
- ///
- Pa1 = 253,
-
- ///
- /// The CLEAR key.
- ///
- OemClear = 254,
-
- ///
- /// The bitmask to extract a key code from a key value.
- ///
- KeyCode = 65535,
-
- ///
- /// The SHIFT modifier key.
- ///
- Shift = 65536,
-
- ///
- /// The CTRL modifier key.
- ///
- Control = 131072,
-
- ///
- /// The ALT modifier key.
- ///
- Alt = 262144,
- }
-}
diff --git a/Other/HookTest/Util/UserActivityHook.cs b/Other/HookTest/Util/UserActivityHook.cs
deleted file mode 100644
index dfac0d260..000000000
--- a/Other/HookTest/Util/UserActivityHook.cs
+++ /dev/null
@@ -1,870 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Windows.Input;
-
-//http://joelabrahamsson.com/detecting-mouse-and-keyboard-input-with-net/
-namespace HookTest.Util
-{
- ///
- /// This class allows you to tap keyboard and mouse and / or to detect their activity even when an
- /// application runes in background or does not have any user interface at all. This class raises
- /// common .NET events with KeyEventArgs and MouseEventArgs so you can easily retrive any information you need.
- ///
- public class UserActivityHook
- {
- #region Windows structure definitions
-
- ///
- /// The POINT structure defines the x- and y- coordinates of a point.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/rectangl_0tiq.asp
- ///
- [StructLayout(LayoutKind.Sequential)]
- private class POINT
- {
- ///
- /// Specifies the x-coordinate of the point.
- ///
- public int x;
- ///
- /// Specifies the y-coordinate of the point.
- ///
- public int y;
- }
-
- ///
- /// The MOUSEHOOKSTRUCT structure contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp
- ///
- [StructLayout(LayoutKind.Sequential)]
- private class MouseHookStruct
- {
- ///
- /// Specifies a POINT structure that contains the x- and y-coordinates of the cursor, in screen coordinates.
- ///
- public POINT pt;
- ///
- /// Handle to the window that will receive the mouse message corresponding to the mouse event.
- ///
- public int hwnd;
- ///
- /// Specifies the hit-test value. For a list of hit-test values, see the description of the WM_NCHITTEST message.
- ///
- public int wHitTestCode;
- ///
- /// Specifies extra information associated with the message.
- ///
- public int dwExtraInfo;
- }
-
- ///
- /// The MSLLHOOKSTRUCT structure contains information about a low-level keyboard input event.
- ///
- [StructLayout(LayoutKind.Sequential)]
- private class MouseLLHookStruct
- {
- ///
- /// Specifies a POINT structure that contains the x- and y-coordinates of the cursor, in screen coordinates.
- ///
- public POINT pt;
- ///
- /// If the message is WM_MOUSEWHEEL, the high-order word of this member is the wheel delta.
- /// The low-order word is reserved. A positive value indicates that the wheel was rotated forward,
- /// away from the user; a negative value indicates that the wheel was rotated backward, toward the user.
- /// One wheel click is defined as WHEEL_DELTA, which is 120.
- ///If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP,
- /// or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released,
- /// and the low-order word is reserved. This value can be one or more of the following values. Otherwise, mouseData is not used.
- ///XBUTTON1
- ///The first X button was pressed or released.
- ///XBUTTON2
- ///The second X button was pressed or released.
- ///
- public int mouseData;
- ///
- /// Specifies the event-injected flag. An application can use the following value to test the mouse flags. Value Purpose
- ///LLMHF_INJECTED Test the event-injected flag.
- ///0
- ///Specifies whether the event was injected. The value is 1 if the event was injected; otherwise, it is 0.
- ///1-15
- ///Reserved.
- ///
- public int flags;
- ///
- /// Specifies the time stamp for this message.
- ///
- public int time;
- ///
- /// Specifies extra information associated with the message.
- ///
- public int dwExtraInfo;
- }
-
-
- ///
- /// The KBDLLHOOKSTRUCT structure contains information about a low-level keyboard input event.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp
- ///
- [StructLayout(LayoutKind.Sequential)]
- private class KeyboardHookStruct
- {
- ///
- /// Specifies a virtual-key code. The code must be a value in the range 1 to 254.
- ///
- public int vkCode;
- ///
- /// Specifies a hardware scan code for the key.
- ///
- public int scanCode;
- ///
- /// Specifies the extended-key flag, event-injected flag, context code, and transition-state flag.
- ///
- public int flags;
- ///
- /// Specifies the time stamp for this message.
- ///
- public int time;
- ///
- /// Specifies extra information associated with the message.
- ///
- public int dwExtraInfo;
- }
- #endregion
-
- #region Windows function imports
- ///
- /// The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain.
- /// You would install a hook procedure to monitor the system for certain types of events. These events
- /// are associated either with a specific thread or with all threads in the same desktop as the calling thread.
- ///
- ///
- /// [in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.
- ///
- ///
- /// [in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a
- /// thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link
- /// library (DLL). Otherwise, lpfn can point to a hook procedure in the code associated with the current process.
- ///
- ///
- /// [in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter.
- /// The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by
- /// the current process and if the hook procedure is within the code associated with the current process.
- ///
- ///
- /// [in] Specifies the identifier of the thread with which the hook procedure is to be associated.
- /// If this parameter is zero, the hook procedure is associated with all existing threads running in the
- /// same desktop as the calling thread.
- ///
- ///
- /// If the function succeeds, the return value is the handle to the hook procedure.
- /// If the function fails, the return value is NULL. To get extended error information, call GetLastError.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
- ///
- [DllImport("user32.dll", CharSet = CharSet.Auto,
- CallingConvention = CallingConvention.StdCall, SetLastError = true)]
- private static extern int SetWindowsHookEx(
- int idHook,
- HookProc lpfn,
- IntPtr hMod,
- int dwThreadId);
-
- ///
- /// The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
- ///
- ///
- /// [in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.
- ///
- ///
- /// If the function succeeds, the return value is nonzero.
- /// If the function fails, the return value is zero. To get extended error information, call GetLastError.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
- ///
- [DllImport("user32.dll", CharSet = CharSet.Auto,
- CallingConvention = CallingConvention.StdCall, SetLastError = true)]
- private static extern int UnhookWindowsHookEx(int idHook);
-
- ///
- /// The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain.
- /// A hook procedure can call this function either before or after processing the hook information.
- ///
- /// Ignored.
- ///
- /// [in] Specifies the hook code passed to the current hook procedure.
- /// The next hook procedure uses this code to determine how to process the hook information.
- ///
- ///
- /// [in] Specifies the wParam value passed to the current hook procedure.
- /// The meaning of this parameter depends on the type of hook associated with the current hook chain.
- ///
- ///
- /// [in] Specifies the lParam value passed to the current hook procedure.
- /// The meaning of this parameter depends on the type of hook associated with the current hook chain.
- ///
- ///
- /// This value is returned by the next hook procedure in the chain.
- /// The current hook procedure must also return this value. The meaning of the return value depends on the hook type.
- /// For more information, see the descriptions of the individual hook procedures.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
- ///
- [DllImport("user32.dll", CharSet = CharSet.Auto,
- CallingConvention = CallingConvention.StdCall)]
- private static extern int CallNextHookEx(
- int idHook,
- int nCode,
- int wParam,
- IntPtr lParam);
-
- ///
- /// The CallWndProc hook procedure is an application-defined or library-defined callback
- /// function used with the SetWindowsHookEx function. The HOOKPROC type defines a pointer
- /// to this callback function. CallWndProc is a placeholder for the application-defined
- /// or library-defined function name.
- ///
- ///
- /// [in] Specifies whether the hook procedure must process the message.
- /// If nCode is HC_ACTION, the hook procedure must process the message.
- /// If nCode is less than zero, the hook procedure must pass the message to the
- /// CallNextHookEx function without further processing and must return the
- /// value returned by CallNextHookEx.
- ///
- ///
- /// [in] Specifies whether the message was sent by the current thread.
- /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
- ///
- ///
- /// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
- ///
- ///
- /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
- /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
- /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
- /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
- /// procedure does not call CallNextHookEx, the return value should be zero.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/callwndproc.asp
- ///
- private delegate int HookProc(int nCode, int wParam, IntPtr lParam);
-
- ///
- /// The ToAscii function translates the specified virtual-key code and keyboard
- /// state to the corresponding character or characters. The function translates the code
- /// using the input language and physical keyboard layout identified by the keyboard layout handle.
- ///
- ///
- /// [in] Specifies the virtual-key code to be translated.
- ///
- ///
- /// [in] Specifies the hardware scan code of the key to be translated.
- /// The high-order bit of this value is set if the key is up (not pressed).
- ///
- ///
- /// [in] Pointer to a 256-byte array that contains the current keyboard state.
- /// Each element (byte) in the array contains the state of one key.
- /// If the high-order bit of a byte is set, the key is down (pressed).
- /// The low bit, if set, indicates that the key is toggled on. In this function,
- /// only the toggle bit of the CAPS LOCK key is relevant. The toggle state
- /// of the NUM LOCK and SCROLL LOCK keys is ignored.
- ///
- ///
- /// [out] Pointer to the buffer that receives the translated character or characters.
- ///
- ///
- /// [in] Specifies whether a menu is active. This parameter must be 1 if a menu is active, or 0 otherwise.
- ///
- ///
- /// If the specified key is a dead key, the return value is negative. Otherwise, it is one of the following values.
- /// Value Meaning
- /// 0 The specified virtual key has no translation for the current state of the keyboard.
- /// 1 One character was copied to the buffer.
- /// 2 Two characters were copied to the buffer. This usually happens when a dead-key character
- /// (accent or diacritic) stored in the keyboard layout cannot be composed with the specified
- /// virtual key to form a single character.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/toascii.asp
- ///
- [DllImport("user32")]
- private static extern int ToAscii(
- int uVirtKey,
- int uScanCode,
- byte[] lpbKeyState,
- byte[] lpwTransKey,
- int fuState);
-
- ///
- /// The GetKeyboardState function copies the status of the 256 virtual keys to the
- /// specified buffer.
- ///
- ///
- /// [in] Pointer to a 256-byte array that contains keyboard key states.
- ///
- ///
- /// If the function succeeds, the return value is nonzero.
- /// If the function fails, the return value is zero. To get extended error information, call GetLastError.
- ///
- ///
- /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/toascii.asp
- ///
- [DllImport("user32")]
- private static extern int GetKeyboardState(byte[] pbKeyState);
-
- [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
- private static extern short GetKeyState(int vKey);
-
- #endregion
-
- #region Windows constants
-
- //values from Winuser.h in Microsoft SDK.
- ///
- /// Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events.
- ///
- private const int WH_MOUSE_LL = 14;
- ///
- /// Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events.
- ///
- private const int WH_KEYBOARD_LL = 13;
-
- ///
- /// Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.
- ///
- private const int WH_MOUSE = 7;
- ///
- /// Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.
- ///
- private const int WH_KEYBOARD = 2;
-
- ///
- /// The WM_MOUSEMOVE message is posted to a window when the cursor moves.
- ///
- private const int WM_MOUSEMOVE = 0x200;
- ///
- /// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button
- ///
- private const int WM_LBUTTONDOWN = 0x201;
- ///
- /// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button
- ///
- private const int WM_RBUTTONDOWN = 0x204;
- ///
- /// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button
- ///
- private const int WM_MBUTTONDOWN = 0x207;
- ///
- /// The WM_LBUTTONUP message is posted when the user releases the left mouse button
- ///
- private const int WM_LBUTTONUP = 0x202;
- ///
- /// The WM_RBUTTONUP message is posted when the user releases the right mouse button
- ///
- private const int WM_RBUTTONUP = 0x205;
- ///
- /// The WM_MBUTTONUP message is posted when the user releases the middle mouse button
- ///
- private const int WM_MBUTTONUP = 0x208;
- ///
- /// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button
- ///
- private const int WM_LBUTTONDBLCLK = 0x203;
- ///
- /// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button
- ///
- private const int WM_RBUTTONDBLCLK = 0x206;
- ///
- /// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button
- ///
- private const int WM_MBUTTONDBLCLK = 0x209;
- ///
- /// The WM_MOUSEWHEEL message is posted when the user presses the mouse wheel.
- ///
- private const int WM_MOUSEWHEEL = 0x020A;
-
- ///
- /// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem
- /// key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.
- ///
- private const int WM_KEYDOWN = 0x100;
- ///
- /// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem
- /// key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed,
- /// or a keyboard key that is pressed when a window has the keyboard focus.
- ///
- private const int WM_KEYUP = 0x101;
- ///
- /// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user
- /// presses the F10 key (which activates the menu bar) or holds down the ALT key and then
- /// presses another key. It also occurs when no window currently has the keyboard focus;
- /// in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that
- /// receives the message can distinguish between these two contexts by checking the context
- /// code in the lParam parameter.
- ///
- private const int WM_SYSKEYDOWN = 0x104;
- ///
- /// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user
- /// releases a key that was pressed while the ALT key was held down. It also occurs when no
- /// window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent
- /// to the active window. The window that receives the message can distinguish between
- /// these two contexts by checking the context code in the lParam parameter.
- ///
- private const int WM_SYSKEYUP = 0x105;
-
- private const byte VK_SHIFT = 0x10;
- private const byte VK_CAPITAL = 0x14;
- private const byte VK_NUMLOCK = 0x90;
-
- #endregion
-
- #region Constructors
-
- ///
- /// Creates an instance of UserActivityHook object and sets mouse and keyboard hooks.
- ///
- /// Any windows problem.
- public UserActivityHook()
- {
- new System.Security.Permissions.UIPermission(System.Security.Permissions.UIPermissionWindow.AllWindows).Demand();
-
- Start();
- }
-
- ///
- /// Creates an instance of UserActivityHook object and installs both or one of mouse and/or keyboard hooks and starts rasing events
- ///
- /// true if mouse events must be monitored
- /// true if keyboard events must be monitored
- /// Any windows problem.
- ///
- /// To create an instance without installing hooks call new UserActivityHook(false, false)
- ///
- public UserActivityHook(bool installMouseHook, bool installKeyboardHook)
- {
- Start(installMouseHook, installKeyboardHook);
- }
-
- ///
- /// Destruction.
- ///
- ~UserActivityHook()
- {
- //uninstall hooks and do not throw exceptions
- Stop(true, true, false);
- }
-
- #endregion
-
- #region Variables
-
- ///
- /// Custom Mouse Event Handler, Since the WPF version it's way different from the WinForms.
- ///
- /// Object sender.
- /// Event Args.
- public delegate void CustomMouseEventHandler(object sender, CustomMouseEventArgs e);
-
- ///
- /// Custom Key Event Handler, Since the WPF version it's way different from the WinForms.
- ///
- /// Object sender.
- /// Event Args.
- public delegate void CustomKeyEventHandler(object sender, CustomKeyEventArgs e);
-
- ///
- /// Custom KeyPress Event Handler, Since the WPF version it's way different from the WinForms.
- ///
- /// Object sender.
- /// Event Args.
- public delegate void CustomKeyPressEventHandler(object sender, CustomKeyPressEventArgs e);
-
- ///
- /// Custom KeyUp Event Handler, Since the WPF version it's way different from the WinForms.
- ///
- /// Object sender.
- /// Event Args.
- public delegate void CustomKeyUpEventHandler(object sender, CustomKeyEventArgs e);
-
- ///
- /// Occurs when the user moves the mouse, presses any mouse button or scrolls the wheel
- ///
- public event CustomMouseEventHandler OnMouseActivity;
- //public event MouseEventHandler OnMouseActivity;
-
- ///
- /// Occurs when the user presses a key
- ///
- public event CustomKeyEventHandler KeyDown;
-
- /////
- ///// Occurs when the user presses and releases
- /////
- public event CustomKeyPressEventHandler KeyPress;
-
- ///
- /// Occurs when the user releases a key
- ///
- public event CustomKeyEventHandler KeyUp;
-
-
- ///
- /// Stores the handle to the mouse hook procedure.
- ///
- private int hMouseHook = 0;
- ///
- /// Stores the handle to the keyboard hook procedure.
- ///
- private int hKeyboardHook = 0;
-
-
- ///
- /// Declare MouseHookProcedure as HookProc type.
- ///
- private static HookProc MouseHookProcedure;
- ///
- /// Declare KeyboardHookProcedure as HookProc type.
- ///
- private static HookProc KeyboardHookProcedure;
-
- #endregion
-
- #region Start/Stop
-
- ///
- /// Installs both mouse and keyboard hooks and starts rasing events
- ///
- /// Any windows problem.
- public void Start()
- {
- this.Start(true, true);
- }
-
- ///
- /// Installs both or one of mouse and/or keyboard hooks and starts rasing events
- ///
- /// true if mouse events must be monitored
- /// true if keyboard events must be monitored
- /// Any windows problem.
- public void Start(bool installMouseHook, bool installKeyboardHook)
- {
- //Gets the system info
- OperatingSystem osInfo = Environment.OSVersion;
-
- //Install Mouse hook only if it is not installed and must be installed
- if (hMouseHook == 0 && installMouseHook)
- {
- //Create an instance of HookProc.
- MouseHookProcedure = new HookProc(MouseHookProc);
-
- //XP bug... - Nicke SM
- if (osInfo.Version.Major < 6)
- {
- hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProcedure, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
- }
- else
- {
- //Install hook
- hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProcedure, IntPtr.Zero, 0);
- }
-
-
- //If SetWindowsHookEx fails.
- if (hMouseHook == 0)
- {
- //Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
- int errorCode = Marshal.GetLastWin32Error();
- //Do cleanup
- Stop(true, false, false);
- //Initializes and throws a new instance of the Win32Exception class with the specified error.
- throw new Win32Exception(errorCode);
- }
- }
-
- //Install Keyboard hook only if it is not installed and must be installed
- if (hKeyboardHook == 0 && installKeyboardHook)
- {
- //Create an instance of HookProc.
- KeyboardHookProcedure = new HookProc(KeyboardHookProc);
-
- //Install hook
- //XP bug... - Nicke SM
- if (osInfo.Version.Major < 6)
- {
- hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProcedure, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
- }
- else
- {
- hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProcedure, IntPtr.Zero, 0);
- }
-
- //If SetWindowsHookEx fails.
- if (hKeyboardHook == 0)
- {
- //Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
- int errorCode = Marshal.GetLastWin32Error();
- //do cleanup
- Stop(false, true, false);
- //Initializes and throws a new instance of the Win32Exception class with the specified error.
- throw new Win32Exception(errorCode);
- }
- }
- }
-
- ///
- /// Stops monitoring both mouse and keyboard events and rasing events.
- ///
- /// Any windows problem.
- public void Stop()
- {
- this.Stop(true, true, true);
- }
-
- ///
- /// Stops monitoring both or one of mouse and/or keyboard events and rasing events.
- ///
- /// true if mouse hook must be uninstalled
- /// true if keyboard hook must be uninstalled
- /// true if exceptions which occured during uninstalling must be thrown
- /// Any windows problem.
- public void Stop(bool uninstallMouseHook, bool uninstallKeyboardHook, bool throwExceptions)
- {
- //if mouse hook set and must be uninstalled
- if (hMouseHook != 0 && uninstallMouseHook)
- {
- //uninstall hook
- int retMouse = UnhookWindowsHookEx(hMouseHook);
- //reset invalid handle
- hMouseHook = 0;
- //if failed and exception must be thrown
- if (retMouse == 0 && throwExceptions)
- {
- //Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
- int errorCode = Marshal.GetLastWin32Error();
- //Initializes and throws a new instance of the Win32Exception class with the specified error.
- throw new Win32Exception(errorCode);
- }
- }
-
- //If keyboard hook set and must be uninstalled
- if (hKeyboardHook != 0 && uninstallKeyboardHook)
- {
- //Uninstall hook
- int retKeyboard = UnhookWindowsHookEx(hKeyboardHook);
-
- //Reset invalid handle
- hKeyboardHook = 0;
-
- //If failed and exception must be thrown
- if (retKeyboard == 0 && throwExceptions)
- {
- //Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
- int errorCode = Marshal.GetLastWin32Error();
- //Initializes and throws a new instance of the Win32Exception class with the specified error.
- throw new Win32Exception(errorCode);
- }
- }
- }
-
- #endregion
-
- #region Event Triggers
-
- ///
- /// A callback function which will be called every time a mouse activity detected.
- ///
- ///
- /// [in] Specifies whether the hook procedure must process the message.
- /// If nCode is HC_ACTION, the hook procedure must process the message.
- /// If nCode is less than zero, the hook procedure must pass the message to the
- /// CallNextHookEx function without further processing and must return the
- /// value returned by CallNextHookEx.
- ///
- ///
- /// [in] Specifies whether the message was sent by the current thread.
- /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
- ///
- ///
- /// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
- ///
- ///
- /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
- /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
- /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
- /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
- /// procedure does not call CallNextHookEx, the return value should be zero.
- ///
- private int MouseHookProc(int nCode, int wParam, IntPtr lParam)
- {
- //If Ok and someone listens to our events
- if ((nCode >= 0) && (OnMouseActivity != null))
- {
- //Marshall the data from callback.
- var mouseHookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct));
-
- //Detect button clicked
- var button = MouseButton.XButton1;
- short mouseDelta = 0;
-
- #region Switch Mouse Actions
-
- switch (wParam)
- {
- case WM_LBUTTONDOWN:
- //case WM_LBUTTONUP:
- //case WM_LBUTTONDBLCLK:
- button = MouseButton.Left;
- break;
- case WM_RBUTTONDOWN:
- //case WM_RBUTTONUP:
- //case WM_RBUTTONDBLCLK:
- button = MouseButton.Right;
- break;
- case WM_MOUSEWHEEL:
- //If the message is WM_MOUSEWHEEL, the high-order word of mouseData member is the wheel delta.
- //One wheel click is defined as WHEEL_DELTA, which is 120.
- //(value >> 16) & 0xffff; retrieves the high-order word from the given 32-bit value
- mouseDelta = (short)((mouseHookStruct.mouseData >> 16) & 0xffff);
- //TODO: X BUTTONS (I havent them so was unable to test)
- //If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP,
- //or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released,
- //and the low-order word is reserved. This value can be one or more of the following values.
- //Otherwise, mouseData is not used.
- button = MouseButton.Middle;
- break;
- case WM_MBUTTONDOWN:
- //case WM_MBUTTONUP:
- //case WM_MBUTTONDBLCLK:
- button = MouseButton.Middle;
- break;
- default:
- return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
- //HU3HU3 - A little funny momment: I just frooze my cursor by returning 1 instead of calling the next hook. - Nicke
- //Congrats to myself. ;D
- //05:24 AM 01/02/2014 (day-month-year)
- }
-
- #endregion
-
- //Double clicks
- int clickCount = (wParam == WM_LBUTTONDBLCLK || wParam == WM_RBUTTONDBLCLK) ? 2 : 1;
-
- //Generate event
- var e = new CustomMouseEventArgs(button, clickCount, mouseHookStruct.pt.x, mouseHookStruct.pt.y, mouseDelta);
-
- //Raise it
- OnMouseActivity?.Invoke(this, e);
- }
-
- //Call next hook
- return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
- }
-
- ///
- /// A callback function which will be called every time a keyboard activity detected.
- ///
- ///
- /// [in] Specifies whether the hook procedure must process the message.
- /// If nCode is HC_ACTION, the hook procedure must process the message.
- /// If nCode is less than zero, the hook procedure must pass the message to the
- /// CallNextHookEx function without further processing and must return the
- /// value returned by CallNextHookEx.
- ///
- ///
- /// [in] Specifies whether the message was sent by the current thread.
- /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
- ///
- ///
- /// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
- ///
- ///
- /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
- /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
- /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
- /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
- /// procedure does not call CallNextHookEx, the return value should be zero.
- ///
- private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
- {
- //Indicates if any of underlaing events set e.Handled flag
- bool handled = false;
-
- //If was Ok and someone listens to events
- if ((nCode >= 0) && (KeyDown != null || KeyUp != null || KeyPress != null))
- {
- //Read structure KeyboardHookStruct at lParam
- var myKeyboardHookStruct = (KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct));
-
- if (KeyDown != null && (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN))
- {
- #region Raise KeyDown
-
- var keyData = (Keys)myKeyboardHookStruct.vkCode;
- var e = new CustomKeyEventArgs(keyData);
- KeyDown?.Invoke(this, e);
-
- handled = handled || e.Handled;
-
- #endregion
- }
-
- if (KeyPress != null && wParam == WM_KEYDOWN)
- {
- #region Raise KeyPress
-
- bool isDownShift = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80);
- bool isDownCapslock = (GetKeyState(VK_CAPITAL) != 0);
-
- var keyState = new byte[256];
- GetKeyboardState(keyState);
- var inBuffer = new byte[2];
-
- if (ToAscii(myKeyboardHookStruct.vkCode, myKeyboardHookStruct.scanCode, keyState, inBuffer, myKeyboardHookStruct.flags) == 1)
- {
- var key = (char)inBuffer[0];
- if ((isDownCapslock ^ isDownShift) && Char.IsLetter(key))
- key = Char.ToUpper(key);
-
- var e = new CustomKeyPressEventArgs(key);
- KeyPress?.Invoke(this, e);
-
- handled = handled || e.Handled;
- }
-
- #endregion
- }
-
- if (KeyUp != null && (wParam == WM_KEYUP || wParam == WM_SYSKEYUP))
- {
- #region Raise KeyUp
-
- var keyData = (Keys)myKeyboardHookStruct.vkCode;
- var e = new CustomKeyEventArgs(keyData);
- KeyUp?.Invoke(this, e);
-
- handled = handled || e.Handled;
-
- #endregion
- }
- }
-
- //If event handled in application do not handoff to other listeners
- if (handled)
- return 1;
-
- return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
- }
-
- #endregion
- }
-}
diff --git a/Other/PositioningTest/App.config b/Other/PositioningTest/App.config
deleted file mode 100644
index 193aecc67..000000000
--- a/Other/PositioningTest/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/PositioningTest/App.xaml b/Other/PositioningTest/App.xaml
deleted file mode 100644
index 8bd9aab3c..000000000
--- a/Other/PositioningTest/App.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
diff --git a/Other/PositioningTest/App.xaml.cs b/Other/PositioningTest/App.xaml.cs
deleted file mode 100644
index b57427452..000000000
--- a/Other/PositioningTest/App.xaml.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace PositioningTest
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/Other/PositioningTest/MainWindow.xaml b/Other/PositioningTest/MainWindow.xaml
deleted file mode 100644
index 45b666466..000000000
--- a/Other/PositioningTest/MainWindow.xaml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/PositioningTest/MainWindow.xaml.cs b/Other/PositioningTest/MainWindow.xaml.cs
deleted file mode 100644
index 29d41ab2d..000000000
--- a/Other/PositioningTest/MainWindow.xaml.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Windows;
-
-namespace PositioningTest
-{
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
-
- private void MainWindow_LocationChanged(object sender, EventArgs e)
- {
- UpdateText();
- }
-
- private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- UpdateText();
- }
-
- private void MainWindow_DpiChanged(object sender, DpiChangedEventArgs e)
- {
- UpdateText();
- }
-
- private void UpdateText()
- {
- TopLeftTextBlock.Text = $"{Top} • {Left}";
- TopRightTextBlock.Text = $"{Top} • {Left + Width}";
-
- SizeTextBlock.Text = $"{Width} x {Height}";
-
- BottomLeftTextBlock.Text = $"{Top + Height} • {Left}";
- BottomRightTextBlock.Text = $"{Top + Height} • {Left + Width}";
- }
- }
-}
\ No newline at end of file
diff --git a/Other/PositioningTest/PositioningTest.csproj b/Other/PositioningTest/PositioningTest.csproj
deleted file mode 100644
index faf053a02..000000000
--- a/Other/PositioningTest/PositioningTest.csproj
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {6204EAEF-C4AA-4005-A369-A8E779205696}
- WinExe
- PositioningTest
- PositioningTest
- v4.8
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- app.manifest
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/PositioningTest/Properties/AssemblyInfo.cs b/Other/PositioningTest/Properties/AssemblyInfo.cs
deleted file mode 100644
index 0f9eacdc3..000000000
--- a/Other/PositioningTest/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("PositioningTest")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("PositioningTest")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Other/PositioningTest/Properties/Resources.Designer.cs b/Other/PositioningTest/Properties/Resources.Designer.cs
deleted file mode 100644
index 044b71061..000000000
--- a/Other/PositioningTest/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace PositioningTest.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PositioningTest.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Other/PositioningTest/Properties/Resources.resx b/Other/PositioningTest/Properties/Resources.resx
deleted file mode 100644
index af7dbebba..000000000
--- a/Other/PositioningTest/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Other/PositioningTest/Properties/Settings.Designer.cs b/Other/PositioningTest/Properties/Settings.Designer.cs
deleted file mode 100644
index c6bbbe297..000000000
--- a/Other/PositioningTest/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace PositioningTest.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Other/PositioningTest/Properties/Settings.settings b/Other/PositioningTest/Properties/Settings.settings
deleted file mode 100644
index 033d7a5e9..000000000
--- a/Other/PositioningTest/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/PositioningTest/app.manifest b/Other/PositioningTest/app.manifest
deleted file mode 100644
index 765c59b86..000000000
--- a/Other/PositioningTest/app.manifest
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PerMonitorV2
- true/PM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Other/Translator/App.config b/Other/Translator/App.config
deleted file mode 100644
index 731f6de6c..000000000
--- a/Other/Translator/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Other/Translator/App.xaml.cs b/Other/Translator/App.xaml.cs
index 6e90d73e2..bff825ab8 100644
--- a/Other/Translator/App.xaml.cs
+++ b/Other/Translator/App.xaml.cs
@@ -1,68 +1,68 @@
-using System;
+using System;
using System.Reflection;
using System.Windows;
using System.Windows.Threading;
using Translator.Util;
-namespace Translator
+namespace Translator;
+
+public partial class App : Application
{
- public partial class App : Application
+ private void App_Startup(object sender, StartupEventArgs e)
{
- private void App_Startup(object sender, StartupEventArgs e)
+ //Unhandled Exceptions.
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ }
+
+ private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ LogWriter.Log(e.Exception, "On Dispacher Unhandled Exception - Unknown");
+
+ try
{
- //Unhandled Exceptions.
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ ExceptionDialog.Ok(e.Exception, "ScreenToGif - Translator", "Unhandled exception", e.Exception.Message);
}
-
- private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ catch (Exception ex)
{
- LogWriter.Log(e.Exception, "On Dispacher Unhandled Exception - Unknown");
-
- try
- {
- ExceptionDialog.Ok(e.Exception, "ScreenToGif - Translator", "Unhandled exception", e.Exception.Message);
- }
- catch (Exception ex)
- {
- LogWriter.Log(ex, "Error while displaying the error.");
- //Ignored.
- }
-
- e.Handled = true;
+ LogWriter.Log(ex, "Error while displaying the error.");
+ //Ignored.
}
- private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
- {
- if (!(e.ExceptionObject is Exception exception)) return;
+ e.Handled = true;
+ }
- LogWriter.Log(exception, "Current Domain Unhandled Exception - Unknown");
+ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ if (e.ExceptionObject is not Exception exception)
+ return;
+
+ LogWriter.Log(exception, "Current Domain Unhandled Exception - Unknown");
- try
- {
- ExceptionDialog.Ok(exception, "ScreenToGif - Translator", "Unhandled exception", exception.Message);
- }
- catch (Exception)
- {
- //Ignored.
- }
+ try
+ {
+ ExceptionDialog.Ok(exception, "ScreenToGif - Translator", "Unhandled exception", exception.Message);
+ }
+ catch (Exception)
+ {
+ //Ignored.
}
+ }
- public static string Version => ToStringShort(Assembly.GetEntryAssembly()?.GetName().Version) ?? "0.0";
+ public static string Version => ToStringShort(Assembly.GetEntryAssembly()?.GetName().Version) ?? "0.0";
- internal static string ToStringShort(Version version)
- {
- if (version == null)
- return null;
+ internal static string ToStringShort(Version version)
+ {
+ if (version == null)
+ return null;
- var result = $"{version.Major}.{version.Minor}";
+ var result = $"{version.Major}.{version.Minor}";
- if (version.Build > 0)
- result += $".{version.Build}";
+ if (version.Build > 0)
+ result += $".{version.Build}";
- if (version.Revision > 0)
- result += $".{version.Revision}";
+ if (version.Revision > 0)
+ result += $".{version.Revision}";
- return result;
- }
+ return result;
}
}
\ No newline at end of file
diff --git a/Other/Translator/Controls/ExtendedTextBox.cs b/Other/Translator/Controls/ExtendedTextBox.cs
index bed5ca4f5..3d2d50bce 100644
--- a/Other/Translator/Controls/ExtendedTextBox.cs
+++ b/Other/Translator/Controls/ExtendedTextBox.cs
@@ -1,30 +1,29 @@
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-namespace Translator.Controls
+namespace Translator.Controls;
+
+public class ExtendedTextBox : TextBox
{
- public class ExtendedTextBox : TextBox
+ static ExtendedTextBox()
{
- static ExtendedTextBox()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(ExtendedTextBox), new FrameworkPropertyMetadata(typeof(ExtendedTextBox)));
- }
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ExtendedTextBox), new FrameworkPropertyMetadata(typeof(ExtendedTextBox)));
+ }
- protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
+ protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
+ {
+ if (!IsKeyboardFocusWithin)
{
- if (!IsKeyboardFocusWithin)
- {
- e.Handled = true;
- Focus();
- }
+ e.Handled = true;
+ Focus();
}
+ }
- protected override void OnGotFocus(RoutedEventArgs e)
- {
- base.OnGotFocus(e);
+ protected override void OnGotFocus(RoutedEventArgs e)
+ {
+ base.OnGotFocus(e);
- SelectAll();
- }
+ SelectAll();
}
-}
+}
\ No newline at end of file
diff --git a/Other/Translator/Controls/ImageButton.cs b/Other/Translator/Controls/ImageButton.cs
index ab7336d33..3d0b8219d 100644
--- a/Other/Translator/Controls/ImageButton.cs
+++ b/Other/Translator/Controls/ImageButton.cs
@@ -1,77 +1,76 @@
-using System.ComponentModel;
+using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
-namespace Translator.Controls
+namespace Translator.Controls;
+
+///
+/// Button with a image inside.
+///
+public class ImageButton : Button
{
- ///
- /// Button with a image inside.
- ///
- public class ImageButton : Button
- {
- #region Variables
+ #region Variables
- public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ImageButton), new FrameworkPropertyMetadata("Button"));
+ public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ImageButton), new FrameworkPropertyMetadata("Button"));
- public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register("MaxSize", typeof(double), typeof(ImageButton), new FrameworkPropertyMetadata(26.0));
+ public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register("MaxSize", typeof(double), typeof(ImageButton), new FrameworkPropertyMetadata(26.0));
- public static readonly DependencyProperty KeyGestureProperty = DependencyProperty.Register("KeyGesture", typeof(string), typeof(ImageButton), new FrameworkPropertyMetadata(""));
+ public static readonly DependencyProperty KeyGestureProperty = DependencyProperty.Register("KeyGesture", typeof(string), typeof(ImageButton), new FrameworkPropertyMetadata(""));
- ///
- /// DependencyProperty for property.
- ///
- public static readonly DependencyProperty TextWrappingProperty = DependencyProperty.Register("TextWrapping", typeof(TextWrapping), typeof(ImageButton),
- new FrameworkPropertyMetadata(TextWrapping.NoWrap, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
+ ///
+ /// DependencyProperty for property.
+ ///
+ public static readonly DependencyProperty TextWrappingProperty = DependencyProperty.Register("TextWrapping", typeof(TextWrapping), typeof(ImageButton),
+ new FrameworkPropertyMetadata(TextWrapping.NoWrap, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
- #endregion
+ #endregion
- #region Properties
+ #region Properties
- ///
- /// The text of the button.
- ///
- [Description("The text of the button."), Category("Common")]
- public string Text
- {
- get { return (string)GetValue(TextProperty); }
- set { SetCurrentValue(TextProperty, value); }
- }
+ ///
+ /// The text of the button.
+ ///
+ [Description("The text of the button."), Category("Common")]
+ public string Text
+ {
+ get => (string)GetValue(TextProperty);
+ set => SetCurrentValue(TextProperty, value);
+ }
- ///
- /// The maximum size of the image.
- ///
- [Description("The maximum size of the image."), Category("Common")]
- public double MaxSize
- {
- get { return (double)GetValue(MaxSizeProperty); }
- set { SetCurrentValue(MaxSizeProperty, value); }
- }
+ ///
+ /// The maximum size of the image.
+ ///
+ [Description("The maximum size of the image."), Category("Common")]
+ public double MaxSize
+ {
+ get => (double)GetValue(MaxSizeProperty);
+ set => SetCurrentValue(MaxSizeProperty, value);
+ }
- ///
- /// The KeyGesture of the button.
- ///
- [Description("The KeyGesture of the button."), Category("Common")]
- public string KeyGesture
- {
- get { return (string)GetValue(KeyGestureProperty); }
- set { SetCurrentValue(KeyGestureProperty, value); }
- }
+ ///
+ /// The KeyGesture of the button.
+ ///
+ [Description("The KeyGesture of the button."), Category("Common")]
+ public string KeyGesture
+ {
+ get => (string)GetValue(KeyGestureProperty);
+ set => SetCurrentValue(KeyGestureProperty, value);
+ }
- ///
- /// The TextWrapping property controls whether or not text wraps
- /// when it reaches the flow edge of its containing block box.
- ///
- public TextWrapping TextWrapping
- {
- get { return (TextWrapping)GetValue(TextWrappingProperty); }
- set { SetValue(TextWrappingProperty, value); }
- }
+ ///
+ /// The TextWrapping property controls whether or not text wraps
+ /// when it reaches the flow edge of its containing block box.
+ ///
+ public TextWrapping TextWrapping
+ {
+ get => (TextWrapping)GetValue(TextWrappingProperty);
+ set => SetValue(TextWrappingProperty, value);
+ }
- #endregion
+ #endregion
- static ImageButton()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(typeof(ImageButton)));
- }
+ static ImageButton()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(typeof(ImageButton)));
}
}
\ No newline at end of file
diff --git a/Other/Translator/Controls/ImageMenuItem.cs b/Other/Translator/Controls/ImageMenuItem.cs
index a609b4da0..903b8b13f 100644
--- a/Other/Translator/Controls/ImageMenuItem.cs
+++ b/Other/Translator/Controls/ImageMenuItem.cs
@@ -1,67 +1,66 @@
-using System.ComponentModel;
+using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
-namespace Translator.Controls
+namespace Translator.Controls;
+
+///
+/// MenuItem with an image to the left.
+///
+public class ImageMenuItem : MenuItem
{
- ///
- /// MenuItem with an image to the left.
- ///
- public class ImageMenuItem : MenuItem
- {
- #region Variables
+ #region Variables
- public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(UIElement), typeof(ImageMenuItem), new FrameworkPropertyMetadata());
+ public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(UIElement), typeof(ImageMenuItem), new FrameworkPropertyMetadata());
- public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register("MaxSize", typeof(double), typeof(ImageMenuItem), new FrameworkPropertyMetadata(15.0));
+ public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register("MaxSize", typeof(double), typeof(ImageMenuItem), new FrameworkPropertyMetadata(15.0));
- public static readonly DependencyProperty HasImageProperty = DependencyProperty.Register("HasImage", typeof(bool), typeof(ImageMenuItem), new FrameworkPropertyMetadata(false));
+ public static readonly DependencyProperty HasImageProperty = DependencyProperty.Register("HasImage", typeof(bool), typeof(ImageMenuItem), new FrameworkPropertyMetadata(false));
- #endregion
+ #endregion
- #region Properties
+ #region Properties
- ///
- /// The Image of the button.
- ///
- [Description("The Image of the button.")]
- public UIElement Image
+ ///
+ /// The Image of the button.
+ ///
+ [Description("The Image of the button.")]
+ public UIElement Image
+ {
+ get { return (UIElement)GetValue(ImageProperty); }
+ set
{
- get { return (UIElement)GetValue(ImageProperty); }
- set
- {
- SetCurrentValue(ImageProperty, value);
+ SetCurrentValue(ImageProperty, value);
- //Has Image.
- SetCurrentValue(HasImageProperty, value != null);
- }
+ //Has Image.
+ SetCurrentValue(HasImageProperty, value != null);
}
+ }
- ///
- /// The maximum size of the image.
- ///
- [Description("The maximum size of the image.")]
- public double MaxSize
- {
- get { return (double)GetValue(MaxSizeProperty); }
- set { SetCurrentValue(MaxSizeProperty, value); }
- }
+ ///
+ /// The maximum size of the image.
+ ///
+ [Description("The maximum size of the image.")]
+ public double MaxSize
+ {
+ get { return (double)GetValue(MaxSizeProperty); }
+ set { SetCurrentValue(MaxSizeProperty, value); }
+ }
- ///
- /// The maximum size of the image.
- ///
- [Description("The maximum size of the image.")]
- public bool HasImage
- {
- get { return (bool)GetValue(HasImageProperty); }
- set { SetCurrentValue(HasImageProperty, value); }
- }
+ ///
+ /// The maximum size of the image.
+ ///
+ [Description("The maximum size of the image.")]
+ public bool HasImage
+ {
+ get { return (bool)GetValue(HasImageProperty); }
+ set { SetCurrentValue(HasImageProperty, value); }
+ }
- #endregion
+ #endregion
- static ImageMenuItem()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageMenuItem), new FrameworkPropertyMetadata(typeof(ImageMenuItem)));
- }
+ static ImageMenuItem()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageMenuItem), new FrameworkPropertyMetadata(typeof(ImageMenuItem)));
}
}
diff --git a/Other/Translator/Controls/StatusBand.cs b/Other/Translator/Controls/StatusBand.cs
index d538160e9..5f1a71bde 100644
--- a/Other/Translator/Controls/StatusBand.cs
+++ b/Other/Translator/Controls/StatusBand.cs
@@ -1,183 +1,172 @@
-using System.ComponentModel;
+using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
-namespace Translator.Controls
-{
- public class StatusBand : Control
- {
- #region Variables
-
- public enum StatusType
- {
- Info,
- Warning,
- Error
- }
+namespace Translator.Controls;
- private Grid _warningGrid;
- private Button _supressButton;
+public class StatusBand : Control
+{
+ #region Variables
- #endregion
+ public enum StatusTypes
+ {
+ Info,
+ Warning,
+ Error
+ }
- #region Dependency Properties
+ private Grid _warningGrid;
+ private Button _supressButton;
- public static readonly DependencyProperty TypeProperty = DependencyProperty.Register("Type", typeof(StatusType), typeof(StatusBand),
- new FrameworkPropertyMetadata(StatusType.Warning, OnTypePropertyChanged));
+ #endregion
- public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(StatusBand),
- new FrameworkPropertyMetadata("", OnTextPropertyChanged));
+ #region Dependency Properties
- public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(UIElement), typeof(StatusBand),
- new FrameworkPropertyMetadata(null, OnImagePropertyChanged));
+ public static readonly DependencyProperty TypeProperty = DependencyProperty.Register("Type", typeof(StatusTypes), typeof(StatusBand),
+ new FrameworkPropertyMetadata(StatusTypes.Warning, OnTypePropertyChanged));
- public static readonly DependencyProperty StartingProperty = DependencyProperty.Register("Starting", typeof(bool), typeof(StatusBand),
- new PropertyMetadata(default(bool)));
+ public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(StatusBand),
+ new FrameworkPropertyMetadata("", OnTextPropertyChanged));
- #endregion
+ public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(UIElement), typeof(StatusBand),
+ new FrameworkPropertyMetadata(null, OnImagePropertyChanged));
- #region Properties
+ public static readonly DependencyProperty StartingProperty = DependencyProperty.Register("Starting", typeof(bool), typeof(StatusBand),
+ new PropertyMetadata(default(bool)));
- [Bindable(true), Category("Common")]
- public StatusType Type
- {
- get { return (StatusType)GetValue(TypeProperty); }
- set { SetValue(TypeProperty, value); }
- }
+ #endregion
- [Bindable(true), Category("Common")]
- public string Text
- {
- get { return (string)GetValue(TextProperty); }
- set { SetValue(TextProperty, value); }
- }
+ #region Properties
- [Bindable(true), Category("Common")]
- public UIElement Image
- {
- get { return (UIElement)GetValue(ImageProperty); }
- set { SetValue(ImageProperty, value); }
- }
+ [Bindable(true), Category("Common")]
+ public StatusTypes Type
+ {
+ get => (StatusTypes)GetValue(TypeProperty);
+ set => SetValue(TypeProperty, value);
+ }
- ///
- /// True if started to display the message.
- ///
- [Bindable(true), Category("Common")]
- public bool Starting
- {
- get { return (bool)GetValue(StartingProperty); }
- set { SetValue(StartingProperty, value); }
- }
+ [Bindable(true), Category("Common")]
+ public string Text
+ {
+ get => (string)GetValue(TextProperty);
+ set => SetValue(TextProperty, value);
+ }
- #endregion
+ [Bindable(true), Category("Common")]
+ public UIElement Image
+ {
+ get => (UIElement)GetValue(ImageProperty);
+ set => SetValue(ImageProperty, value);
+ }
- #region Property Changed
+ ///
+ /// True if started to display the message.
+ ///
+ [Bindable(true), Category("Common")]
+ public bool Starting
+ {
+ get => (bool)GetValue(StartingProperty);
+ set => SetValue(StartingProperty, value);
+ }
- private static void OnTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var band = d as StatusBand;
+ #endregion
- if (band == null)
- return;
+ #region Property Changed
- band.Type = (StatusType)e.NewValue;
- band.Image = (Canvas)band.FindResource(band.Type == StatusType.Info ? "Vector.Info" : band.Type == StatusType.Warning ? "Vector.Warning" : "Vector.Error");
- }
+ private static void OnTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is not StatusBand band)
+ return;
- private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var band = d as StatusBand;
+ band.Type = (StatusTypes)e.NewValue;
+ band.Image = (Canvas)band.FindResource(band.Type == StatusTypes.Info ? "Vector.Info" : band.Type == StatusTypes.Warning ? "Vector.Warning" : "Vector.Error");
+ }
- if (band == null)
- return;
+ private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is not StatusBand band)
+ return;
- band.Text = (string)e.NewValue;
- }
+ band.Text = (string)e.NewValue;
+ }
- private static void OnImagePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var band = d as StatusBand;
+ private static void OnImagePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is not StatusBand band)
+ return;
- if (band == null)
- return;
+ band.Image = (UIElement)e.NewValue;
+ }
- band.Image = (UIElement)e.NewValue;
- }
+ #endregion
- #endregion
+ static StatusBand()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusBand), new FrameworkPropertyMetadata(typeof(StatusBand)));
+ }
- static StatusBand()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusBand), new FrameworkPropertyMetadata(typeof(StatusBand)));
- }
+ public override void OnApplyTemplate()
+ {
+ _warningGrid = GetTemplateChild("WarningGrid") as Grid;
+ _supressButton = GetTemplateChild("SuppressButton") as ImageButton;
- public override void OnApplyTemplate()
+ if (_supressButton != null)
{
- _warningGrid = GetTemplateChild("WarningGrid") as Grid;
- _supressButton = GetTemplateChild("SuppressButton") as ImageButton;
-
- if (_supressButton != null)
- {
- _supressButton.Click += SupressButton_Click;
- }
-
- base.OnApplyTemplate();
+ _supressButton.Click += SupressButton_Click;
}
- #region Methods
-
- public void Show(StatusType type, string text, UIElement image = null)
- {
- //Collapsed-by-default elements do not apply templates.
- //http://stackoverflow.com/a/2115873/1735672
- //So it's necessary to do this here.
- ApplyTemplate();
-
- Starting = true;
- Type = type;
- Text = text;
- Image = image;
-
- var show = _warningGrid?.FindResource("ShowWarningStoryboard") as Storyboard;
+ base.OnApplyTemplate();
+ }
- if (show != null)
- BeginStoryboard(show);
- }
+ #region Methods
- public void Info(string text, UIElement image = null)
- {
- Show(StatusType.Info, text, image ?? (Canvas)FindResource("Vector.Info"));
- }
+ public void Show(StatusTypes type, string text, UIElement image = null)
+ {
+ //Collapsed-by-default elements do not apply templates.
+ //http://stackoverflow.com/a/2115873/1735672
+ //So it's necessary to do this here.
+ ApplyTemplate();
+
+ Starting = true;
+ Type = type;
+ Text = text;
+ Image = image;
+
+ if (_warningGrid?.FindResource("ShowWarningStoryboard") is Storyboard show)
+ BeginStoryboard(show);
+ }
- public void Warning(string text, UIElement image = null)
- {
- Show(StatusType.Warning, text, image ?? (Canvas)FindResource("Vector.Warning"));
- }
+ public void Info(string text, UIElement image = null)
+ {
+ Show(StatusTypes.Info, text, image ?? (Canvas)FindResource("Vector.Info"));
+ }
- public void Error(string text, UIElement image = null)
- {
- Show(StatusType.Error, text, image ?? (Canvas)FindResource("Vector.Error"));
- }
+ public void Warning(string text, UIElement image = null)
+ {
+ Show(StatusTypes.Warning, text, image ?? (Canvas)FindResource("Vector.Warning"));
+ }
- public void Hide()
- {
- Starting = false;
+ public void Error(string text, UIElement image = null)
+ {
+ Show(StatusTypes.Error, text, image ?? (Canvas)FindResource("Vector.Error"));
+ }
- if (_warningGrid?.Visibility == Visibility.Collapsed)
- return;
+ public void Hide()
+ {
+ Starting = false;
- var show = _warningGrid?.FindResource("HideWarningStoryboard") as Storyboard;
+ if (_warningGrid?.Visibility == Visibility.Collapsed)
+ return;
- if (show != null)
- BeginStoryboard(show);
- }
+ if (_warningGrid?.FindResource("HideWarningStoryboard") is Storyboard show)
+ BeginStoryboard(show);
+ }
- #endregion
+ #endregion
- private void SupressButton_Click(object sender, RoutedEventArgs e)
- {
- Hide();
- }
+ private void SupressButton_Click(object sender, RoutedEventArgs e)
+ {
+ Hide();
}
-}
+}
\ No newline at end of file
diff --git a/Other/Translator/Converters/MultiLineTitle.cs b/Other/Translator/Converters/MultiLineTitle.cs
index 38f3553df..4f2da6ae3 100644
--- a/Other/Translator/Converters/MultiLineTitle.cs
+++ b/Other/Translator/Converters/MultiLineTitle.cs
@@ -1,24 +1,20 @@
-using System;
+using System;
using System.Globalization;
using System.Windows.Data;
-namespace Translator.Converters
+namespace Translator.Converters;
+
+public class MultiLineTitle : IValueConverter
{
- class MultiLineTitle : IValueConverter
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var text = value as string;
-
- if (String.IsNullOrEmpty(text))
- return value;
+ var text = value as string;
- return text.Replace(@"\n", Environment.NewLine);
- }
+ return string.IsNullOrEmpty(text) ? value : text.Replace(@"\n", Environment.NewLine);
+ }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value;
- }
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value;
}
-}
+}
\ No newline at end of file
diff --git a/Other/Translator/Converters/NullToInvertedBool.cs b/Other/Translator/Converters/NullToInvertedBool.cs
index ad218ffa2..ed8a3d4a0 100644
--- a/Other/Translator/Converters/NullToInvertedBool.cs
+++ b/Other/Translator/Converters/NullToInvertedBool.cs
@@ -1,19 +1,18 @@
-using System;
+using System;
using System.Globalization;
using System.Windows.Data;
-namespace Translator.Converters
+namespace Translator.Converters;
+
+public class NullToInvertedBool : IValueConverter
{
- public class NullToInvertedBool : IValueConverter
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value == null;
- }
+ return value == null;
+ }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return Binding.DoNothing;
- }
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return Binding.DoNothing;
}
-}
+}
\ No newline at end of file
diff --git a/Other/Translator/DataGridHelper.cs b/Other/Translator/DataGridHelper.cs
deleted file mode 100644
index 0e677c4f6..000000000
--- a/Other/Translator/DataGridHelper.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Media;
-
-namespace Translator
-{
- public static class DataGridHelper
- {
- public static DataGridCell GetCell(DataGrid dg, int row, int column)
- {
- var rowContainer = GetRow(dg, row);
-
- if (rowContainer != null)
- {
- var presenter = VisualHelper.GetVisualChild(rowContainer);
-
- // try to get the cell but it may possibly be virtualized
- var cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
-
- if (cell == null)
- {
- // now try to bring into view and retreive the cell
- dg.ScrollIntoView(rowContainer, dg.Columns[column]);
- cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
- }
-
- return cell;
- }
-
- return null;
- }
-
- public static DataGridRow GetRow(DataGrid dg, int index)
- {
- dg.UpdateLayout();
- var row = (DataGridRow)dg.ItemContainerGenerator.ContainerFromIndex(index);
-
- if (row == null)
- {
- // may be virtualized, bring into view and try again
- dg.ScrollIntoView(dg.Items[index]);
- row = (DataGridRow)dg.ItemContainerGenerator.ContainerFromIndex(index);
- }
-
- return row;
- }
-
- public static int GetRowIndex(DataGrid dg, DataGridCellInfo dgci)
- {
- if (!dgci.IsValid)
- return -1;
-
- var dgrow = (DataGridRow)dg.ItemContainerGenerator.ContainerFromItem(dgci.Item);
-
- return dgrow?.GetIndex() ?? -1;
- }
-
- public static int GetColIndex(DataGridCellInfo dgci)
- {
- return dgci.Column.DisplayIndex;
- }
-
- public static DataGridCell FindParentCell(DataGrid grid, DependencyObject child, int i)
- {
- var parent = VisualTreeHelper.GetParent(child);
- var logicalParent = LogicalTreeHelper.GetParent(child);
-
- if (logicalParent is DataGridCell)
- return logicalParent as DataGridCell;
-
- if (i > 4 || parent == null || parent is DataGridCell)
- return parent as DataGridCell;
-
- return FindParentCell(grid, parent, i + 1);
- }
-
- public static DataGridCell GetDataGridCell(DataGridCellInfo cellInfo)
- {
- if (cellInfo.IsValid == false)
- return null;
-
- var cellContent = cellInfo.Column.GetCellContent(cellInfo.Item);
-
- return cellContent?.Parent as DataGridCell;
- }
-
- public static DataGridCell GetDataGridCell(DataGrid dataGrid)
- {
- if (dataGrid.CurrentCell.IsValid == false)
- return null;
-
- var cellContent = dataGrid.CurrentCell.Column.GetCellContent(dataGrid.CurrentCell.Item);
-
- if (cellContent == null)
- {
- return GetCell(dataGrid, GetColIndex(dataGrid.CurrentCell), GetRowIndex(dataGrid, dataGrid.CurrentCell));
- }
-
- return cellContent.Parent as DataGridCell;
- }
-
- public static void FocusOnFirstCell(this DataGrid dataGrid)
- {
- dataGrid.SelectedIndex = 0;
- //dataGrid.CurrentCell = new DataGridCellInfo(DataGrid.Items[0], DataGrid.Columns[0]);
-
- var cell = GetCell(dataGrid, 0, 0);
-
- cell?.Focus();
- }
-
- public static bool Sort(this DataGrid grid, ListSortDirection direction, string property, string second = null)
- {
- //If there's already a sort defind in another property.
- foreach (var column in grid.Columns)
- {
- if (column.SortDirection.HasValue)
- return false;
-
- var dataColumn = column as DataGridTextColumn;
-
- if (dataColumn == null || dataColumn.Binding == null) continue;
-
- var binding = dataColumn.Binding as Binding;
-
- if (binding != null && binding.Path != null && binding.Path.Path == property)
- column.SortDirection = direction;
- }
-
- //Add the new sort description.
- grid.Items.SortDescriptions.Add(new SortDescription(property, direction));
-
- if (second != null)
- grid.Items.SortDescriptions.Add(new SortDescription(second, direction));
-
- return true;
- }
-
- public static void ReSort(this DataGrid grid, Dictionary sorted)
- {
- if (sorted == null || !sorted.Any())
- sorted = grid.Columns.Where(x => x.SortDirection.HasValue)
- .ToDictionary(w => w.SortMemberPath, w => w.SortDirection.Value);
-
- grid.Items.SortDescriptions.Clear();
-
- foreach (var sort in sorted)
- {
- #region Search for the column that should be sorted
-
- var column = grid.Columns.FirstOrDefault(x =>
- {
- var dataColumn = x as DataGridTextColumn;
-
- if (dataColumn == null || dataColumn.Binding == null)
- return false;
-
- var binding = dataColumn.Binding as Binding;
-
- //Only returns true if it's the match.
- if (binding != null && binding.Path != null && binding.Path.Path == sort.Key)
- return true;
-
- return false;
- });
-
- #endregion
-
- //Displays the sort direction glyph.
- if (column != null)
- column.SortDirection = sort.Value;
-
- //Add the new sort description.
- grid.Items.SortDescriptions.Add(new SortDescription(sort.Key, sort.Value));
- }
- }
- }
-}
diff --git a/Other/Translator/Dialog.xaml.cs b/Other/Translator/Dialog.xaml.cs
index 3feb66fa2..2117dd416 100644
--- a/Other/Translator/Dialog.xaml.cs
+++ b/Other/Translator/Dialog.xaml.cs
@@ -1,183 +1,182 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Controls;
-namespace Translator
+namespace Translator;
+
+///
+/// Interaction logic for Dialog.xaml
+///
+public partial class Dialog : Window
{
///
- /// Interaction logic for Dialog.xaml
+ /// Default constructor.
///
- public partial class Dialog : Window
+ public Dialog()
{
- ///
- /// Default contructor.
- ///
- public Dialog()
- {
- InitializeComponent();
- }
+ InitializeComponent();
+ }
- #region Methods
+ #region Methods
- private Canvas GetIcon(Icons icon)
+ private Canvas GetIcon(Icons icon)
+ {
+ switch (icon)
{
- switch (icon)
- {
- case Icons.Error:
- return (Canvas)FindResource("Vector.Error");
- case Icons.Info:
- return (Canvas)FindResource("Vector.Info");
- case Icons.Success:
- return (Canvas)FindResource("Vector.Success");
- case Icons.Warning:
- return (Canvas)FindResource("Vector.Warning");
- case Icons.Question:
- return (Canvas)FindResource("Vector.Question");
-
- default:
- return (Canvas)FindResource("Vector.Info");
- }
+ case Icons.Error:
+ return (Canvas)FindResource("Vector.Error");
+ case Icons.Info:
+ return (Canvas)FindResource("Vector.Info");
+ case Icons.Success:
+ return (Canvas)FindResource("Vector.Success");
+ case Icons.Warning:
+ return (Canvas)FindResource("Vector.Warning");
+ case Icons.Question:
+ return (Canvas)FindResource("Vector.Question");
+
+ default:
+ return (Canvas)FindResource("Vector.Info");
}
+ }
- private void PrepareOk(string title, string instruction, string observation, Icons icon)
- {
- CancelButton.Visibility = Visibility.Collapsed;
- YesButton.Visibility = Visibility.Collapsed;
- NoButton.Visibility = Visibility.Collapsed;
+ private void PrepareOk(string title, string instruction, string observation, Icons icon)
+ {
+ CancelButton.Visibility = Visibility.Collapsed;
+ YesButton.Visibility = Visibility.Collapsed;
+ NoButton.Visibility = Visibility.Collapsed;
- OkButton.Focus();
+ OkButton.Focus();
- IconViewbox.Child = GetIcon(icon);
+ IconViewbox.Child = GetIcon(icon);
- InstructionLabel.Content = instruction;
- ObservationTextBlock.Text = observation;
- Title = title;
- }
+ InstructionLabel.Content = instruction;
+ ObservationTextBlock.Text = observation;
+ Title = title;
+ }
- private void PrepareOkCancel(string title, string instruction, string observation, Icons icon)
- {
- YesButton.Visibility = Visibility.Collapsed;
- NoButton.Visibility = Visibility.Collapsed;
+ private void PrepareOkCancel(string title, string instruction, string observation, Icons icon)
+ {
+ YesButton.Visibility = Visibility.Collapsed;
+ NoButton.Visibility = Visibility.Collapsed;
- CancelButton.Focus();
+ CancelButton.Focus();
- IconViewbox.Child = GetIcon(icon);
+ IconViewbox.Child = GetIcon(icon);
- InstructionLabel.Content = instruction;
- ObservationTextBlock.Text = observation;
- Title = title;
- }
+ InstructionLabel.Content = instruction;
+ ObservationTextBlock.Text = observation;
+ Title = title;
+ }
- private void PrepareAsk(string title, string instruction, string observation, Icons icon)
- {
- CancelButton.Visibility = Visibility.Collapsed;
- OkButton.Visibility = Visibility.Collapsed;
+ private void PrepareAsk(string title, string instruction, string observation, Icons icon)
+ {
+ CancelButton.Visibility = Visibility.Collapsed;
+ OkButton.Visibility = Visibility.Collapsed;
- NoButton.Focus();
+ NoButton.Focus();
- IconViewbox.Child = GetIcon(icon);
+ IconViewbox.Child = GetIcon(icon);
- InstructionLabel.Content = instruction;
- ObservationTextBlock.Text = observation;
- Title = title;
- }
+ InstructionLabel.Content = instruction;
+ ObservationTextBlock.Text = observation;
+ Title = title;
+ }
- ///
- /// Shows a Ok dialog.
- ///
- /// The title of the window.
- /// The main instruction.
- /// A complementar observation.
- /// The image of the dialog.
- /// True if Ok
- public static bool Ok(string title, string instruction, string observation, Icons icon = Icons.Error)
- {
- var dialog = new Dialog();
- dialog.PrepareOk(title, instruction, observation.Replace(@"\n", Environment.NewLine).Replace(@"\r", ""), icon);
- var result = dialog.ShowDialog();
+ ///
+ /// Shows a Ok dialog.
+ ///
+ /// The title of the window.
+ /// The main instruction.
+ /// A complementar observation.
+ /// The image of the dialog.
+ /// True if Ok
+ public static bool Ok(string title, string instruction, string observation, Icons icon = Icons.Error)
+ {
+ var dialog = new Dialog();
+ dialog.PrepareOk(title, instruction, observation.Replace(@"\n", Environment.NewLine).Replace(@"\r", ""), icon);
+ var result = dialog.ShowDialog();
- return result.HasValue && result.Value;
- }
+ return result.HasValue && result.Value;
+ }
- ///
- /// Shows a Ok/Cancel dialog.
- ///
- /// The title of the window.
- /// The main instruction.
- /// A complementar observation.
- /// The image of the dialog.
- /// True if Ok
- public static bool OkCancel(string title, string instruction, string observation, Icons icon = Icons.Error)
- {
- var dialog = new Dialog();
- dialog.PrepareOkCancel(title, instruction, observation.Replace(@"\n", Environment.NewLine).Replace(@"\r", ""), icon);
- var result = dialog.ShowDialog();
+ ///
+ /// Shows a Ok/Cancel dialog.
+ ///
+ /// The title of the window.
+ /// The main instruction.
+ /// A complementar observation.
+ /// The image of the dialog.
+ /// True if Ok
+ public static bool OkCancel(string title, string instruction, string observation, Icons icon = Icons.Error)
+ {
+ var dialog = new Dialog();
+ dialog.PrepareOkCancel(title, instruction, observation.Replace(@"\n", Environment.NewLine).Replace(@"\r", ""), icon);
+ var result = dialog.ShowDialog();
- return result.HasValue && result.Value;
- }
+ return result.HasValue && result.Value;
+ }
- ///
- /// Shows a Yes/No dialog.
- ///
- /// The title of the window.
- /// The main instruction.
- /// A complementar observation.
- /// The image of the dialog.
- /// True if Yes
- public static bool Ask(string title, string instruction, string observation, Icons icon = Icons.Question)
- {
- var dialog = new Dialog();
- dialog.PrepareAsk(title, instruction, observation.Replace(@"\n", Environment.NewLine).Replace(@"\r", ""), icon);
- var result = dialog.ShowDialog();
+ ///
+ /// Shows a Yes/No dialog.
+ ///
+ /// The title of the window.
+ /// The main instruction.
+ /// A complementar observation.
+ /// The image of the dialog.
+ /// True if Yes
+ public static bool Ask(string title, string instruction, string observation, Icons icon = Icons.Question)
+ {
+ var dialog = new Dialog();
+ dialog.PrepareAsk(title, instruction, observation.Replace(@"\n", Environment.NewLine).Replace(@"\r", ""), icon);
+ var result = dialog.ShowDialog();
- return result.HasValue && result.Value;
- }
+ return result.HasValue && result.Value;
+ }
- #endregion
+ #endregion
- #region Events
+ #region Events
- private void FalseActionButton_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = false;
- }
+ private void FalseActionButton_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ }
- private void TrueActionButton_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = true;
- }
+ private void TrueActionButton_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ }
- #endregion
+ #endregion
+ ///
+ /// Dialog Icons.
+ ///
+ public enum Icons
+ {
///
- /// Dialog Icons.
+ /// Information. Blue.
///
- public enum Icons
- {
- ///
- /// Information. Blue.
- ///
- Info,
-
- ///
- /// Warning, yellow.
- ///
- Warning,
-
- ///
- /// Error, red.
- ///
- Error,
-
- ///
- /// Success, green.
- ///
- Success,
-
- ///
- /// A question mark, blue.
- ///
- Question,
- }
+ Info,
+
+ ///
+ /// Warning, yellow.
+ ///
+ Warning,
+
+ ///
+ /// Error, red.
+ ///
+ Error,
+
+ ///
+ /// Success, green.
+ ///
+ Success,
+
+ ///
+ /// A question mark, blue.
+ ///
+ Question,
}
-}
+}
\ No newline at end of file
diff --git a/Other/Translator/ExceptionDialog.xaml.cs b/Other/Translator/ExceptionDialog.xaml.cs
index a0e8c80c9..c38413138 100644
--- a/Other/Translator/ExceptionDialog.xaml.cs
+++ b/Other/Translator/ExceptionDialog.xaml.cs
@@ -1,99 +1,98 @@
-using System;
+using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Documents;
using Translator.Util;
-namespace Translator
+namespace Translator;
+
+public partial class ExceptionDialog : Window
{
- public partial class ExceptionDialog : Window
- {
- #region Properties
+ #region Properties
- public bool BugWithHotFix4055002 { get; set; }
+ public bool BugWithHotFix4055002 { get; set; }
- public Exception Exception { get; set; }
+ public Exception Exception { get; set; }
- #endregion
+ #endregion
- public ExceptionDialog(Exception exception)
- {
- InitializeComponent();
+ public ExceptionDialog(Exception exception)
+ {
+ InitializeComponent();
- Exception = exception;
- }
+ Exception = exception;
+ }
- #region Eventos
+ #region Eventos
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- if (Exception == null)
- DetailsButton.IsEnabled = false;
- }
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (Exception == null)
+ DetailsButton.IsEnabled = false;
+ }
- private void DetailsButton_Click(object sender, RoutedEventArgs e)
- {
- var errorViewer = new ExceptionViewer(Exception);
- errorViewer.ShowDialog();
- }
+ private void DetailsButton_Click(object sender, RoutedEventArgs e)
+ {
+ var errorViewer = new ExceptionViewer(Exception);
+ errorViewer.ShowDialog();
+ }
- private void OkButton_Click(object sender, RoutedEventArgs e)
- {
- Close();
- }
+ private void OkButton_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
- #endregion
+ #endregion
- #region Métodos
+ #region Métodos
+
+ private void PrepareOk(string title, string instruction, string observation)
+ {
+ TypeTextBlock.Text = instruction;
+ DetailsTextBlock.Inlines.Add(new Run("\t" + observation));
+ Title = title ?? "ScreenToGif - Error";
- private void PrepareOk(string title, string instruction, string observation)
+ if (BugWithHotFix4055002)
{
- TypeTextBlock.Text = instruction;
- DetailsTextBlock.Inlines.Add(new Run("\t" + observation));
- Title = title ?? "ScreenToGif - Error";
-
- if (BugWithHotFix4055002)
- {
- DetailsTextBlock.Inlines.Add(new LineBreak());
- DetailsTextBlock.Inlines.Add(new LineBreak());
- DetailsTextBlock.Inlines.Add(new Run("\tThis was likely caused by a bug with an update for .Net Framework 4.7.1 (KB4055002, released in January 2018). This bug happens on machines with Windows 7 SP1 or Windows Server 2008 R2."));
- DetailsTextBlock.Inlines.Add(new LineBreak());
- DetailsTextBlock.Inlines.Add(new LineBreak());
- DetailsTextBlock.Inlines.Add(new Run("\t"));
-
- var hyper = new Hyperlink(new Run("Click here to open a page with some details on how to fix this issue.") {ToolTip = "https://github.com/dotnet/announcements/issues/53" });
- hyper.Click += HyperOnClick;
- DetailsTextBlock.Inlines.Add(hyper);
- }
-
- OkButton.Focus();
+ DetailsTextBlock.Inlines.Add(new LineBreak());
+ DetailsTextBlock.Inlines.Add(new LineBreak());
+ DetailsTextBlock.Inlines.Add(new Run("\tThis was likely caused by a bug with an update for .Net Framework 4.7.1 (KB4055002, released in January 2018). This bug happens on machines with Windows 7 SP1 or Windows Server 2008 R2."));
+ DetailsTextBlock.Inlines.Add(new LineBreak());
+ DetailsTextBlock.Inlines.Add(new LineBreak());
+ DetailsTextBlock.Inlines.Add(new Run("\t"));
+
+ var hyper = new Hyperlink(new Run("Click here to open a page with some details on how to fix this issue.") {ToolTip = "https://github.com/dotnet/announcements/issues/53" });
+ hyper.Click += HyperOnClick;
+ DetailsTextBlock.Inlines.Add(hyper);
}
- private void HyperOnClick(object sender, RoutedEventArgs routedEventArgs)
+ OkButton.Focus();
+ }
+
+ private void HyperOnClick(object sender, RoutedEventArgs routedEventArgs)
+ {
+ try
{
- try
- {
- Process.Start("https://github.com/dotnet/announcements/issues/53");
- }
- catch (Exception e)
- {
- LogWriter.Log(e, "Impossible to open link");
- }
+ Process.Start("https://github.com/dotnet/announcements/issues/53");
}
+ catch (Exception e)
+ {
+ LogWriter.Log(e, "Impossible to open link");
+ }
+ }
- #endregion
-
- #region Static Methods
+ #endregion
- public static bool Ok(Exception exception, string title, string instruction, string observation = "", bool bugWith4055002 = false)
- {
- var dialog = new ExceptionDialog(exception) { BugWithHotFix4055002 = bugWith4055002 };
- dialog.PrepareOk(title, instruction, observation);
- var result = dialog.ShowDialog();
+ #region Static Methods
- return result.HasValue && result.Value;
- }
+ public static bool Ok(Exception exception, string title, string instruction, string observation = "", bool bugWith4055002 = false)
+ {
+ var dialog = new ExceptionDialog(exception) { BugWithHotFix4055002 = bugWith4055002 };
+ dialog.PrepareOk(title, instruction, observation);
+ var result = dialog.ShowDialog();
- #endregion
+ return result.HasValue && result.Value;
}
+
+ #endregion
}
\ No newline at end of file
diff --git a/Other/Translator/ExceptionViewer.xaml.cs b/Other/Translator/ExceptionViewer.xaml.cs
index 254e281e4..fd8a0feea 100644
--- a/Other/Translator/ExceptionViewer.xaml.cs
+++ b/Other/Translator/ExceptionViewer.xaml.cs
@@ -1,57 +1,56 @@
-using System;
+using System;
using System.Windows;
-namespace Translator
+namespace Translator;
+
+public partial class ExceptionViewer
{
- public partial class ExceptionViewer
- {
- #region Variables
+ #region Variables
- private readonly Exception _exception;
+ private readonly Exception _exception;
- #endregion
+ #endregion
- ///
- /// Default constructor.
- ///
- /// The Exception to show.
- public ExceptionViewer(Exception ex)
- {
- InitializeComponent();
+ ///
+ /// Default constructor.
+ ///
+ /// The Exception to show.
+ public ExceptionViewer(Exception ex)
+ {
+ InitializeComponent();
- _exception = ex;
+ _exception = ex;
- #region Shows Information
+ #region Shows Information
- TypeLabel.Content = ex.GetType().Name;
- MessageTextBox.Text = ex.Message;
- StackTextBox.Text = ex.StackTrace;
- SourceTextBox.Text = ex.Source;
+ TypeLabel.Content = ex.GetType().Name;
+ MessageTextBox.Text = ex.Message;
+ StackTextBox.Text = ex.StackTrace;
+ SourceTextBox.Text = ex.Source;
- if (ex.TargetSite != null)
- SourceTextBox.Text += "." + ex.TargetSite.Name;
+ if (ex.TargetSite != null)
+ SourceTextBox.Text += "." + ex.TargetSite.Name;
- //If there's aditional details.
- if (!string.IsNullOrEmpty(ex.HelpLink))
- StackTextBox.Text += Environment.NewLine + Environment.NewLine + ex.HelpLink;
+ //If there's additional details.
+ if (!string.IsNullOrEmpty(ex.HelpLink))
+ StackTextBox.Text += Environment.NewLine + Environment.NewLine + ex.HelpLink;
- if (ex.InnerException != null)
- InnerButton.IsEnabled = true;
+ if (ex.InnerException != null)
+ InnerButton.IsEnabled = true;
- #endregion
- }
+ #endregion
+ }
- private void InnerButton_Click(object sender, RoutedEventArgs e)
- {
- var errorViewer = new ExceptionViewer(_exception.InnerException);
- errorViewer.ShowDialog();
+ private void InnerButton_Click(object sender, RoutedEventArgs e)
+ {
+ var errorViewer = new ExceptionViewer(_exception.InnerException);
+ errorViewer.ShowDialog();
- GC.Collect(1);
- }
+ GC.Collect(1);
+ }
- private void DoneButton_Click(object sender, RoutedEventArgs e)
- {
- Close();
- }
+ private void DoneButton_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
}
}
\ No newline at end of file
diff --git a/Other/Translator/Themes/Generic.xaml b/Other/Translator/Themes/Generic.xaml
index 0cd342cec..bee9b0f2e 100644
--- a/Other/Translator/Themes/Generic.xaml
+++ b/Other/Translator/Themes/Generic.xaml
@@ -345,7 +345,7 @@
-
+
\ No newline at end of file
diff --git a/Other/Translator/TranslatorWindow.xaml.cs b/Other/Translator/TranslatorWindow.xaml.cs
index eca622f2a..2dc0e535f 100644
--- a/Other/Translator/TranslatorWindow.xaml.cs
+++ b/Other/Translator/TranslatorWindow.xaml.cs
@@ -1,4 +1,4 @@
-using Microsoft.Win32;
+using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -19,659 +19,661 @@
using System.Windows.Threading;
using System.Xml.Linq;
using System.Xml.XPath;
+using Translator.Util;
using XamlReader = System.Windows.Markup.XamlReader;
-namespace Translator
+namespace Translator;
+
+public partial class TranslatorWindow : Window
{
- public partial class TranslatorWindow : Window
- {
- private string TempPath => Path.Combine(".", "ScreenToGif", "Resources");
+ private readonly List _resourceList = new();
+ private IEnumerable _cultures;
+ private ObservableCollection _translationList = new();
+ private string _tempPath;
+ private string _resourceTemplate;
- private readonly List _resourceList = new List();
- private IEnumerable _cultures;
- private ObservableCollection _translationList = new ObservableCollection();
- private string _resourceTemplate;
+ public TranslatorWindow()
+ {
+ InitializeComponent();
+ }
- public TranslatorWindow()
- {
- InitializeComponent();
- }
+ #region Events
- #region Events
+ private async void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ PrepareTempPath();
- private async void Window_Loaded(object sender, RoutedEventArgs e)
- {
- if (!Directory.Exists(TempPath))
- Directory.CreateDirectory(TempPath);
+ OpenButton.IsEnabled = false;
+ RefreshButton.IsEnabled = false;
+ ToComboBox.IsEnabled = false;
- OpenButton.IsEnabled = false;
- RefreshButton.IsEnabled = false;
- ToComboBox.IsEnabled = false;
+ #region Languages
- #region Languages
+ FromComboBox.Text = "Loading...";
+ ToComboBox.Text = "Loading...";
- FromComboBox.Text = "Loading...";
- ToComboBox.Text = "Loading...";
+ StatusBand.Info("Downloading English resource file...");
- StatusBand.Info("Downloading English resource file...");
+ //We have to get english resource first in case we import first without refreshing
+ await DownloadSingleResourceAsync("en");
- //We have to get english resource first in case we import first without refreshing
- await DownloadSingleResourceAsync("en");
+ StatusBand.Info("Loading language codes...");
- StatusBand.Info("Loading language codes...");
+ _cultures = await GetProperCulturesAsync();
+ var languageList = await Task.Factory.StartNew(() => _cultures.Select(x => new Culture { Code = x, Name = CultureInfo.GetCultureInfo(x).DisplayName }).ToList());
+ //var languageList = CultureInfo.GetCultures(CultureTypes.AllCultures).Select(x => new Culture { Code = x.IetfLanguageTag, Name = x.EnglishName }).ToList();
- _cultures = await GetProperCulturesAsync();
- var languageList = await Task.Factory.StartNew(() => _cultures.Select(x => new Culture { Code = x, Name = CultureInfo.GetCultureInfo(x).DisplayName }).ToList());
- //var languageList = CultureInfo.GetCultures(CultureTypes.AllCultures).Select(x => new Culture { Code = x.IetfLanguageTag, Name = x.EnglishName }).ToList();
+ FromComboBox.ItemsSource = languageList;
+ ToComboBox.ItemsSource = languageList;
+ ToComboBox.Text = null;
+ FromComboBox.SelectedIndex = languageList.FindIndex(x => x.Code == "en");
- FromComboBox.ItemsSource = languageList;
- ToComboBox.ItemsSource = languageList;
- ToComboBox.Text = null;
- FromComboBox.SelectedIndex = languageList.FindIndex(x => x.Code == "en");
+ StatusBand.Hide();
- StatusBand.Hide();
+ #endregion
- #endregion
+ OpenButton.IsEnabled = true;
+ RefreshButton.IsEnabled = true;
+ ToComboBox.IsEnabled = true;
- OpenButton.IsEnabled = true;
- RefreshButton.IsEnabled = true;
- ToComboBox.IsEnabled = true;
+ ToComboBox.Focus();
+ }
- ToComboBox.Focus();
+ private void TutorialHyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
+ {
+ try
+ {
+ Process.Start("https://github.com/NickeManarin/ScreenToGif/wiki/Localization");
}
-
- private void TutorialHyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
+ catch (Exception ex)
{
- try
- {
- Process.Start("https://github.com/NickeManarin/ScreenToGif/wiki/Localization");
- }
- catch (Exception ex)
- {
- Dialog.Ok("Translator", "Tutorial", "Error while trying to open the tutorial link");
- }
+ Dialog.Ok("Translator", "Tutorial", "Error while trying to open the tutorial link");
}
+ }
- private void NewLineHyperlink_Click(object sender, RoutedEventArgs e)
+ private void NewLineHyperlink_Click(object sender, RoutedEventArgs e)
+ {
+ Clipboard.SetText("
");
+ }
+
+ private void ComboBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Return || e.Key == Key.Enter)
{
- Clipboard.SetText("
");
+ e.Handled = true;
+ RefreshButton.Focus();
}
+ }
- private void ComboBox_KeyDown(object sender, KeyEventArgs e)
+ private async void Refresh_Click(object sender, RoutedEventArgs e)
+ {
+ var baseCulture = FromComboBox.SelectedValue as string;
+
+ if (ToComboBox.SelectedValue is not string specificCulture)
{
- if (e.Key == Key.Return || e.Key == Key.Enter)
- {
- e.Handled = true;
- RefreshButton.Focus();
- }
+ StatusBand.Info("You need to select a target language to load the translations.");
+ return;
}
- private async void Refresh_Click(object sender, RoutedEventArgs e)
- {
- var baseCulture = FromComboBox.SelectedValue as string;
- var specificCulture = ToComboBox.SelectedValue as string;
+ HeaderLabel.Content = "Downloading resources...";
+ StatusBand.Info("Downloading selected translations...");
- if (specificCulture == null)
- {
- StatusBand.Info("You need to select a target language to load the translations.");
- return;
- }
+ await DownloadResourcesAsync(baseCulture, specificCulture);
+ ShowTranslations(baseCulture, specificCulture);
- HeaderLabel.Content = "Downloading resources...";
- StatusBand.Info("Dowloading selected translations...");
+ HeaderLabel.Content = "Translator";
+ BaseDataGrid.IsEnabled = true;
+ StatusBand.Hide();
+ }
- await DownloadResourcesAsync(baseCulture, specificCulture);
- ShowTranslations(baseCulture, specificCulture);
+ private void Itens_GotFocus(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is not TextBox ue)
+ return;
- HeaderLabel.Content = "Translator";
- BaseDataGrid.IsEnabled = true;
- StatusBand.Hide();
+ ue.Dispatcher.BeginInvoke(DispatcherPriority.Send, () => ue.SelectAll());
+
+ BaseDataGrid.SelectedItem = ((FrameworkElement)sender).DataContext;
+ }
+
+ private void Item_PreviewKeyDown(object sender, KeyEventArgs e)
+ {
+ var source = e.OriginalSource as TextBox;
+
+ if (source == null)
+ return;
+
+ //Back, up.
+ if (e.Key == Key.Up || e.Key is Key.Enter or Key.Return && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)))
+ {
+ source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Up));
+ BaseDataGrid.BeginEdit();
+
+ var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
+
+ current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Up));
+
+ e.Handled = true;
+ return;
}
- private void Itens_GotFocus(object sender, RoutedEventArgs e)
+ //Back, left.
+ if ((e.Key == Key.Left && (source.CaretIndex == 0 || source.IsReadOnly)) || (e.Key == Key.Tab && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))))
{
- var ue = e.OriginalSource as TextBox;
- if (ue == null) return;
+ source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Left));
+ BaseDataGrid.BeginEdit();
+
+ var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
- ue.Dispatcher.BeginInvoke(DispatcherPriority.Send, (Action)(() => ue.SelectAll()));
+ current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Left));
- BaseDataGrid.SelectedItem = ((FrameworkElement)sender).DataContext;
+ e.Handled = true;
+ return;
}
- private void Item_PreviewKeyDown(object sender, KeyEventArgs e)
+ //Next, down.
+ if (e.Key == Key.Down || e.Key == Key.Enter || e.Key == Key.Return)
{
- var source = e.OriginalSource as TextBox;
+ source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
+ BaseDataGrid.BeginEdit();
- if (source == null)
- return;
+ var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
- //Back, up.
- if (e.Key == Key.Up || (e.Key == Key.Enter || e.Key == Key.Return) && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)))
- {
- source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Up));
- BaseDataGrid.BeginEdit();
+ current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
- var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
+ e.Handled = true;
+ return;
+ }
- current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Up));
+ //Next, right. OLD (e.Key == Key.Right && (source.CaretIndex == source.Text.Length - 1 || source.IsReadOnly)) ||
+ if (e.Key == Key.Tab)
+ {
+ source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
+ BaseDataGrid.BeginEdit();
- e.Handled = true;
- return;
- }
+ var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
- //Back, left.
- if ((e.Key == Key.Left && (source.CaretIndex == 0 || source.IsReadOnly)) || (e.Key == Key.Tab && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))))
- {
- source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Left));
- BaseDataGrid.BeginEdit();
+ current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
- var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
+ e.Handled = true;
+ return;
+ }
+ }
- current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Left));
+ private void Load_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ {
+ e.CanExecute = true;
+ }
- e.Handled = true;
- return;
- }
+ private void Export_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ {
+ e.CanExecute = BaseDataGrid.IsEnabled && ToComboBox.SelectedValue != null && BaseDataGrid.Items.Count > 0;
+ }
- //Next, down.
- if (e.Key == Key.Down || e.Key == Key.Enter || e.Key == Key.Return)
- {
- source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
- BaseDataGrid.BeginEdit();
+ private async void Load_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ var ofd = new OpenFileDialog
+ {
+ AddExtension = true,
+ CheckFileExists = true,
+ Title = "Open a Resource Dictionary",
+ Filter = "Resource Dictionary (*.xaml)|*.xaml;",
+ InitialDirectory = Path.GetFullPath(_tempPath)
+ };
- var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
+ var result = ofd.ShowDialog();
- current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
+ if (!result.HasValue || !result.Value)
+ return;
- e.Handled = true;
- return;
- }
+ //Will save the file to other folder.
+ var tempFile = Path.Combine(_tempPath, "Temp", Path.GetFileName(ofd.FileName));
- //Next, right. OLD (e.Key == Key.Right && (source.CaretIndex == source.Text.Length - 1 || source.IsReadOnly)) ||
- if (e.Key == Key.Tab)
- {
- source.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
- BaseDataGrid.BeginEdit();
+ Directory.CreateDirectory(Path.Combine(_tempPath, "Temp"));
- var current = DataGridHelper.GetDataGridCell(BaseDataGrid.CurrentCell);
+ //Replaces the special chars.
+ var text = await Task.Factory.StartNew(() => File.ReadAllText(ofd.FileName, Encoding.UTF8).Replace("", "&#").Replace("-->", "-->"));
+ await Task.Factory.StartNew(() => File.WriteAllText(tempFile, text, Encoding.UTF8));
- current?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
+ var dictionary = await Task.Factory.StartNew(() => new ResourceDictionary { Source = new Uri(Path.GetFullPath(tempFile), UriKind.Absolute) });
+ _resourceList.Add(dictionary);
- e.Handled = true;
- return;
- }
- }
+ var baseCulture = FromComboBox.SelectedValue as string;
+ var specificCulture = Path.GetFileName(ofd.FileName).Replace("StringResources.", "").Replace(".xaml", "");
+
+ string properCulture;
- private void Load_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ //Catching here, because we can access UI thread easily here to show dialogs
+ try
{
- e.CanExecute = true;
+ properCulture = await Task.Factory.StartNew(() => CheckSupportedCulture(specificCulture));
}
+ catch (CultureNotFoundException)
+ {
+ Dialog.Ok("Action Denied", "Unknown Language.",
+ $"The \"{specificCulture}\" and its family were not recognized as a valid language codes.");
- private void Export_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ return;
+ }
+ catch (Exception ex)
{
- e.CanExecute = BaseDataGrid.IsEnabled && ToComboBox.SelectedValue != null && BaseDataGrid.Items.Count > 0;
+ Dialog.Ok("Action Denied", "Error checking culture.", ex.Message);
+
+ return;
}
- private async void Load_Executed(object sender, ExecutedRoutedEventArgs e)
+ if (properCulture != specificCulture)
{
- var ofd = new OpenFileDialog
- {
- AddExtension = true,
- CheckFileExists = true,
- Title = "Open a Resource Dictionary",
- Filter = "Resource Dictionay (*.xaml)|*.xaml;",
- InitialDirectory = Path.GetFullPath(TempPath)
- };
+ Dialog.Ok("Action Denied", "Redundant Language Code.",
+ $"The \"{specificCulture}\" code is redundant. Try using \'{properCulture}\" instead");
- var result = ofd.ShowDialog();
+ return;
+ }
- if (!result.HasValue || !result.Value) return;
+ ToComboBox.SelectedValue = specificCulture;
- //Will save the file to other folder.
- var tempFile = Path.Combine(TempPath, "Temp", Path.GetFileName(ofd.FileName));
+ ShowTranslations(baseCulture, specificCulture);
- Directory.CreateDirectory(Path.Combine(TempPath, "Temp"));
+ BaseDataGrid.IsEnabled = true;
+ }
- //Replaces the special chars.
- var text = await Task.Factory.StartNew(() => File.ReadAllText(ofd.FileName, Encoding.UTF8).Replace("", "&#").Replace("-->", "-->"));
- await Task.Factory.StartNew(() => File.WriteAllText(tempFile, text, Encoding.UTF8));
+ private async void Export_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ var sfd = new SaveFileDialog
+ {
+ AddExtension = true,
+ Filter = "Resource Dictionary (*.xaml)|*.xaml",
+ Title = "Save Resource Dictionary",
+ FileName = $"StringResources.{ToComboBox.SelectedValue}.xaml"
+ };
- var dictionary = await Task.Factory.StartNew(() => new ResourceDictionary { Source = new Uri(Path.GetFullPath(tempFile), UriKind.Absolute) });
- _resourceList.Add(dictionary);
+ var result = sfd.ShowDialog();
- var baseCulture = FromComboBox.SelectedValue as string;
- var specificCulture = Path.GetFileName(ofd.FileName).Replace("StringResources.", "").Replace(".xaml", "");
+ if (!result.HasValue || !result.Value)
+ return;
- string properCulture;
+ BaseDataGrid.IsEnabled = false;
+ StatusBand.Info("Exporting translation...");
- //Catching here, because we can access UI thread easily here to show dialogs
- try
- {
- properCulture = await Task.Factory.StartNew(() => CheckSupportedCulture(specificCulture));
- }
- catch (CultureNotFoundException)
- {
- Dialog.Ok("Action Denied", "Unknown Language.",
- $"The \"{specificCulture}\" and its family were not recognized as a valid language codes.");
+ var fileName = sfd.FileName;
+ var saved = await Task.Factory.StartNew(() => ExportTranslation(fileName));
- return;
- }
- catch (Exception ex)
- {
- Dialog.Ok("Action Denied", "Error checking culture.", ex.Message);
+ BaseDataGrid.IsEnabled = true;
- return;
- }
+ if (saved)
+ StatusBand.Info("Translation saved!");
+ else
+ StatusBand.Hide();
+ }
- if (properCulture != specificCulture)
- {
- Dialog.Ok("Action Denied", "Redundant Language Code.",
- $"The \"{specificCulture}\" code is redundant. Try using \'{properCulture}\" instead");
+ private void CancelButton_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
- return;
- }
+ private void Window_Closing(object sender, CancelEventArgs e)
+ {
+ if (BaseDataGrid.Items.Count > 0 && !Dialog.Ask("Translator", "Do you really wish to close?", "Don't forget to export your translation, if you started translating but not exported yet."))
+ e.Cancel = true;
+ }
- ToComboBox.SelectedValue = specificCulture;
+ #endregion
- ShowTranslations(baseCulture, specificCulture);
+ #region Methods
- BaseDataGrid.IsEnabled = true;
- }
+ private void PrepareTempPath()
+ {
+ _tempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ScreenToGif", "Resources");
- private async void Export_Executed(object sender, ExecutedRoutedEventArgs e)
+ if (!Directory.Exists(_tempPath))
+ Directory.CreateDirectory(_tempPath);
+ }
+
+ private async Task DownloadSingleResourceAsync(string culture)
+ {
+ try
{
- var sfd = new SaveFileDialog
+ var request = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/NickeManarin/ScreenToGif/contents/ScreenToGif/Resources/Localization");
+ request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
+
+ var response = (HttpWebResponse)await request.GetResponseAsync();
+
+ await using (var resultStream = response.GetResponseStream())
{
- AddExtension = true,
- Filter = "Resource Dictionary (*.xaml)|*.xaml",
- Title = "Save Resource Dictionary",
- FileName = $"StringResources.{ToComboBox.SelectedValue}.xaml"
- };
+ using (var reader = new StreamReader(resultStream))
+ {
+ var result = await reader.ReadToEndAsync();
- var result = sfd.ShowDialog();
+ var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
+ new System.Xml.XmlDictionaryReaderQuotas());
- if (!result.HasValue || !result.Value) return;
+ var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
- BaseDataGrid.IsEnabled = false;
- StatusBand.Info("Exporting translation...");
+ var element = json.XPathSelectElement("/").Elements().FirstOrDefault(x => x.XPathSelectElement("name").Value.EndsWith(culture + ".xaml"));
- var fileName = sfd.FileName;
- var saved = await Task.Factory.StartNew(() => ExportTranslation(fileName));
+ if (element == null)
+ throw new WebException("File not found");
- BaseDataGrid.IsEnabled = true;
+ var name = element.XPathSelectElement("name").Value;
+ var downloadUrl = element.XPathSelectElement("download_url").Value;
- if (saved)
- StatusBand.Info("Translation saved!");
- else
- StatusBand.Hide();
- }
+ await DownloadFileAsync(new Uri(downloadUrl), name);
- private void CancelButton_Click(object sender, RoutedEventArgs e)
- {
- Close();
+ CommandManager.InvalidateRequerySuggested();
+ }
+ }
}
+ catch (WebException web)
+ {
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Single Resource", web.Message +
+ Environment.NewLine + "Trying to load files already downloaded."));
- private void Window_Closing(object sender, CancelEventArgs e)
+ await LoadFilesAsync();
+ }
+ catch (Exception ex)
{
- if (BaseDataGrid.Items.Count > 0 && !Dialog.Ask("Translator", "Do you really wish to close?", "Don't forget to export your translation, if you started translating but not exported yet."))
- e.Cancel = true;
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Single Resource", ex.Message));
}
- #endregion
-
- #region Methods
+ GC.Collect();
+ }
- private async Task DownloadSingleResourceAsync(string culture)
+ private async Task DownloadResourcesAsync(string baseCulture, string specificCulture)
+ {
+ try
{
- try
- {
- var request = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/NickeManarin/ScreenToGif/contents/ScreenToGif/Resources/Localization");
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
+ var request = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/NickeManarin/ScreenToGif/contents/ScreenToGif/Resources/Localization");
+ request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
- var response = (HttpWebResponse)await request.GetResponseAsync();
+ var response = (HttpWebResponse)await request.GetResponseAsync();
- using (var resultStream = response.GetResponseStream())
+ await using (var resultStream = response.GetResponseStream())
+ {
+ using (var reader = new StreamReader(resultStream))
{
- if (resultStream == null)
- return;
-
- using (var reader = new StreamReader(resultStream))
- {
- var result = await reader.ReadToEndAsync();
+ var result = await reader.ReadToEndAsync();
- var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
- new System.Xml.XmlDictionaryReaderQuotas());
+ var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
+ new System.Xml.XmlDictionaryReaderQuotas());
- var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
+ var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
- var element = json.XPathSelectElement("/").Elements().FirstOrDefault(x => x.XPathSelectElement("name").Value.EndsWith(culture + ".xaml"));
+ foreach (var element in json.XPathSelectElement("/").Elements())
+ {
+ var name = element.XPathSelectElement("name").Value;
- if (element == null)
- throw new WebException("File not found");
+ if (string.IsNullOrEmpty(name) || (!name.EndsWith(baseCulture + ".xaml") && !name.EndsWith(specificCulture + ".xaml")))
+ continue;
- var name = element.XPathSelectElement("name").Value;
var downloadUrl = element.XPathSelectElement("download_url").Value;
await DownloadFileAsync(new Uri(downloadUrl), name);
-
- CommandManager.InvalidateRequerySuggested();
}
- }
- }
- catch (WebException web)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Single Resource", web.Message +
- Environment.NewLine + "Trying to load files already downloaded."));
- await LoadFilesAsync();
- }
- catch (Exception ex)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Single Resource", ex.Message));
+ CommandManager.InvalidateRequerySuggested();
+ }
}
-
- GC.Collect();
}
-
- private async Task DownloadResourcesAsync(string baseCulture, string specificCulture)
+ catch (WebException web)
{
- try
- {
- var request = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/NickeManarin/ScreenToGif/contents/ScreenToGif/Resources/Localization");
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
-
- var response = (HttpWebResponse)await request.GetResponseAsync();
-
- using (var resultStream = response.GetResponseStream())
- {
- if (resultStream == null)
- return;
-
- using (var reader = new StreamReader(resultStream))
- {
- var result = await reader.ReadToEndAsync();
-
- var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
- new System.Xml.XmlDictionaryReaderQuotas());
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Resources", web.Message +
+ Environment.NewLine + "Trying to load files already downloaded."));
- var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
+ await LoadFilesAsync();
+ }
+ catch (Exception ex)
+ {
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Resources", ex.Message));
+ }
- foreach (var element in json.XPathSelectElement("/").Elements())
- {
- var name = element.XPathSelectElement("name").Value;
+ GC.Collect();
+ }
- if (string.IsNullOrEmpty(name) || (!name.EndsWith(baseCulture + ".xaml") && !name.EndsWith(specificCulture + ".xaml")))
- continue;
+ private async Task DownloadFileAsync2(Uri uri, string name)
+ {
+ try
+ {
+ var file = Path.Combine(Dispatcher.Invoke(() => _tempPath), name);
- var downloadUrl = element.XPathSelectElement("download_url").Value;
+ if (File.Exists(file))
+ File.Delete(file);
- await DownloadFileAsync(new Uri(downloadUrl), name);
- }
+ using (var webClient = new WebClient { Credentials = CredentialCache.DefaultNetworkCredentials })
+ await webClient.DownloadFileTaskAsync(uri, file);
- CommandManager.InvalidateRequerySuggested();
- }
+ //Saves the template for later, when exporting the translation.
+ if (name.EndsWith("en.xaml"))
+ {
+ using (var sr = new StreamReader(file, Encoding.UTF8))
+ {
+ _resourceTemplate = await sr.ReadToEndAsync();
}
}
- catch (WebException web)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Resources", web.Message +
- Environment.NewLine + "Trying to load files already downloaded."));
- await LoadFilesAsync();
- }
- catch (Exception ex)
+ await using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading Resources", ex.Message));
- }
+ var dictionary = await Task.Factory.StartNew(() => (ResourceDictionary)XamlReader.Load(fs, new ParserContext { XmlSpace = "preserve" }));
+ //var dictionary = new ResourceDictionary();
+ dictionary.Source = await Task.Factory.StartNew(() => new Uri(Path.GetFullPath(file), UriKind.Absolute));
- GC.Collect();
+ _resourceList.Add(dictionary);
+
+ if (name.EndsWith("en.xaml"))
+ Application.Current.Resources.MergedDictionaries.Add(dictionary);
+ }
}
+ catch (Exception ex)
+ {
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading File", ex.Message));
+ }
+ }
- private async Task DownloadFileAsync2(Uri uri, string name)
+ private async Task DownloadFileAsync(Uri uri, string name)
+ {
+ try
{
- try
- {
- var file = Path.Combine(Dispatcher.Invoke(() => TempPath), name);
+ var file = Path.Combine(Dispatcher.Invoke(() => _tempPath), name);
- if (File.Exists(file))
- File.Delete(file);
+ if (File.Exists(file))
+ File.Delete(file);
- using (var webClient = new WebClient { Credentials = CredentialCache.DefaultNetworkCredentials })
- await webClient.DownloadFileTaskAsync(uri, file);
+ using (var webClient = new WebClient { Credentials = CredentialCache.DefaultNetworkCredentials })
+ await webClient.DownloadFileTaskAsync(uri, file);
- //Saves the template for later, when exporting the translation.
- if (name.EndsWith("en.xaml"))
- {
- using (var sr = new StreamReader(file, Encoding.UTF8))
- {
- _resourceTemplate = await sr.ReadToEndAsync();
- }
- }
+ //Replaces the special chars.
+ var text = await Task.Factory.StartNew(() => File.ReadAllText(file, Encoding.UTF8).Replace("", "&#"));
+ await Task.Factory.StartNew(() => File.WriteAllText(file, text, Encoding.UTF8));
- using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
- {
- var dictionary = await Task.Factory.StartNew(() => (ResourceDictionary)XamlReader.Load(fs, new ParserContext { XmlSpace = "preserve" }));
- //var dictionary = new ResourceDictionary();
- dictionary.Source = await Task.Factory.StartNew(() => new Uri(Path.GetFullPath(file), UriKind.Absolute));
- _resourceList.Add(dictionary);
+ //Saves the template for later, when exporting the translation.
+ if (name.EndsWith("en.xaml"))
+ _resourceTemplate = text;
- if (name.EndsWith("en.xaml"))
- Application.Current.Resources.MergedDictionaries.Add(dictionary);
- }
- }
- catch (Exception ex)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading File", ex.Message));
- }
- }
+ var dictionary = await Task.Factory.StartNew(() => new ResourceDictionary { Source = new Uri(Path.GetFullPath(file), UriKind.Absolute) });
- private async Task DownloadFileAsync(Uri uri, string name)
- {
- try
- {
- var file = Path.Combine(Dispatcher.Invoke(() => TempPath), name);
+ _resourceList.Add(dictionary);
- if (File.Exists(file))
- File.Delete(file);
+ //if (name.EndsWith("en.xaml"))
+ // Application.Current.Resources.MergedDictionaries.Add(dictionary);
- using (var webClient = new WebClient { Credentials = CredentialCache.DefaultNetworkCredentials })
- await webClient.DownloadFileTaskAsync(uri, file);
+ //using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
+ //{
+ // var dictionary = (ResourceDictionary)System.Windows.Markup.XamlReader.Load(stream, new ParserContext { XmlSpace = "preserve" });
+ //}
+ }
+ catch (Exception ex)
+ {
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading File", ex.Message));
+ }
+ }
+ private async Task LoadFilesAsync()
+ {
+ try
+ {
+ var files = await Task.Factory.StartNew(() => Directory.EnumerateFiles(_tempPath, "*.xaml"));
+
+ foreach (var file in files)
+ {
//Replaces the special chars.
var text = await Task.Factory.StartNew(() => File.ReadAllText(file, Encoding.UTF8).Replace("", "&#"));
await Task.Factory.StartNew(() => File.WriteAllText(file, text, Encoding.UTF8));
-
//Saves the template for later, when exporting the translation.
- if (name.EndsWith("en.xaml"))
+ if (file.EndsWith("en.xaml"))
_resourceTemplate = text;
var dictionary = await Task.Factory.StartNew(() => new ResourceDictionary { Source = new Uri(Path.GetFullPath(file), UriKind.Absolute) });
_resourceList.Add(dictionary);
-
- //if (name.EndsWith("en.xaml"))
- // Application.Current.Resources.MergedDictionaries.Add(dictionary);
-
- //using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
- //{
- // var dictionary = (ResourceDictionary)System.Windows.Markup.XamlReader.Load(stream, new ParserContext { XmlSpace = "preserve" });
- //}
- }
- catch (Exception ex)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Downloading File", ex.Message));
}
}
-
- private async Task LoadFilesAsync()
+ catch (Exception ex)
{
- try
- {
- var files = await Task.Factory.StartNew(() => Directory.EnumerateFiles(TempPath, "*.xaml"));
-
- foreach (var file in files)
- {
- //Replaces the special chars.
- var text = await Task.Factory.StartNew(() => File.ReadAllText(file, Encoding.UTF8).Replace("", "&#"));
- await Task.Factory.StartNew(() => File.WriteAllText(file, text, Encoding.UTF8));
-
- //Saves the template for later, when exporting the translation.
- if (file.EndsWith("en.xaml"))
- _resourceTemplate = text;
-
- var dictionary = await Task.Factory.StartNew(() => new ResourceDictionary { Source = new Uri(Path.GetFullPath(file), UriKind.Absolute) });
-
- _resourceList.Add(dictionary);
- }
- }
- catch (Exception ex)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Loading Offline File", ex.Message));
- }
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Loading Offline File", ex.Message));
}
+ }
- private void ShowTranslations(string baseCulture, string specificCulture)
- {
- //var baseCulture = FromComboBox.SelectionBoxItem as Culture;
- //var specificCulture = ToComboBox.SelectionBoxItem as Culture;
+ private void ShowTranslations(string baseCulture, string specificCulture)
+ {
+ //var baseCulture = FromComboBox.SelectionBoxItem as Culture;
+ //var specificCulture = ToComboBox.SelectionBoxItem as Culture;
- if (baseCulture == null)
- {
- _translationList = null;
- BaseDataGrid.ItemsSource = null;
- return;
- }
+ if (baseCulture == null)
+ {
+ _translationList = null;
+ BaseDataGrid.ItemsSource = null;
+ return;
+ }
- var baseResource = _resourceList.FirstOrDefault(x => x.Source?.OriginalString.EndsWith(baseCulture + ".xaml") ?? false);
- //var baseResource = Application.Current.Resources.MergedDictionaries.FirstOrDefault(x => x.Source?.OriginalString.EndsWith(baseCulture + ".xaml") ?? false);
+ var baseResource = _resourceList.FirstOrDefault(x => x.Source?.OriginalString.EndsWith(baseCulture + ".xaml") ?? false);
+ //var baseResource = Application.Current.Resources.MergedDictionaries.FirstOrDefault(x => x.Source?.OriginalString.EndsWith(baseCulture + ".xaml") ?? false);
- if (baseResource == null)
- return;
+ if (baseResource == null)
+ return;
- if (specificCulture == null)
+ if (specificCulture == null)
+ {
+ _translationList = new ObservableCollection(baseResource.Keys.Cast().Select(y => new Translation
{
- _translationList = new ObservableCollection(baseResource.Keys.Cast().Select(y => new Translation
- {
- Key = y,
- BaseText = (string)baseResource[y]
- }).OrderBy(o => o.Key).ToList());
-
- BaseDataGrid.ItemsSource = _translationList;
- return;
- }
-
- var specificResource = _resourceList.LastOrDefault(x => x.Source?.OriginalString.EndsWith(specificCulture + ".xaml") ?? false);
+ Key = y,
+ BaseText = (string)baseResource[y]
+ }).OrderBy(o => o.Key).ToList());
- if (specificResource == null)
- {
- _translationList = new ObservableCollection(baseResource.Keys.Cast().Select(y => new Translation
- {
- Key = y,
- BaseText = (string)baseResource[y]
- }).OrderBy(o => o.Key).ToList());
+ BaseDataGrid.ItemsSource = _translationList;
+ return;
+ }
- BaseDataGrid.ItemsSource = _translationList;
- return;
- }
+ var specificResource = _resourceList.LastOrDefault(x => x.Source?.OriginalString.EndsWith(specificCulture + ".xaml") ?? false);
+ if (specificResource == null)
+ {
_translationList = new ObservableCollection(baseResource.Keys.Cast().Select(y => new Translation
{
Key = y,
- BaseText = (string)baseResource[y],
- SpecificText = (string)specificResource[y]
+ BaseText = (string)baseResource[y]
}).OrderBy(o => o.Key).ToList());
BaseDataGrid.ItemsSource = _translationList;
+ return;
}
- private bool ExportTranslation(string path)
+ _translationList = new ObservableCollection(baseResource.Keys.Cast().Select(y => new Translation
{
- try
- {
- var lines = _resourceTemplate.Split('\n');
+ Key = y,
+ BaseText = (string)baseResource[y],
+ SpecificText = (string)specificResource[y]
+ }).OrderBy(o => o.Key).ToList());
- for (var i = 0; i < lines.Length; i++)
- {
- var keyIndex = lines[i].IndexOf(":Key=", StringComparison.Ordinal);
+ BaseDataGrid.ItemsSource = _translationList;
+ }
- if (lines[i].TrimStart().StartsWith(""; //Comment the line.
- else
- lines[i] = $" {translated.SpecificText} ";
- }
+ var keyAux = lines[i].Substring(keyIndex + 6);
+ var key = keyAux.Substring(0, keyAux.IndexOf("\"", StringComparison.Ordinal));
- if (File.Exists(path))
- File.Delete(path);
+ var translated = _translationList.FirstOrDefault(x => x.Key == key);
- File.WriteAllText(path, string.Join(Environment.NewLine, lines).Replace("&#", ""), Encoding.UTF8);
- return true;
- }
- catch (Exception ex)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Saving Translation", ex.Message));
- return false;
+ //" Size "
+ if (string.IsNullOrWhiteSpace(translated?.SpecificText))
+ lines[i] = $" "; //Comment the line.
+ else
+ lines[i] = $" {translated.SpecificText} ";
}
- }
- private string CheckSupportedCulture(string cultureName)
+ if (File.Exists(path))
+ File.Delete(path);
+
+ File.WriteAllText(path, string.Join(Environment.NewLine, lines).Replace("&#", ""), Encoding.UTF8);
+ return true;
+ }
+ catch (Exception ex)
{
- //Using HashSet, because we can check if it contains string in O(1) time
- //Only creating it takes some time,
- //but it's better than performing Contains multiple times on the list in the loop below
- var cultureHash = new HashSet(_cultures);
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Saving Translation", ex.Message));
+ return false;
+ }
+ }
- if (cultureHash.Contains(cultureName))
- return cultureName;
+ private string CheckSupportedCulture(string cultureName)
+ {
+ //Using HashSet, because we can check if it contains string in O(1) time
+ //Only creating it takes some time,
+ //but it's better than performing Contains multiple times on the list in the loop below
+ var cultureHash = new HashSet(_cultures);
- var t = CultureInfo.GetCultureInfo(cultureName);
+ if (cultureHash.Contains(cultureName))
+ return cultureName;
- while (t != CultureInfo.InvariantCulture)
- {
- if (cultureHash.Contains(t.Name))
- return t.Name;
+ var t = CultureInfo.GetCultureInfo(cultureName);
- t = t.Parent;
- }
+ while (t != CultureInfo.InvariantCulture)
+ {
+ if (cultureHash.Contains(t.Name))
+ return t.Name;
- throw new CultureNotFoundException();
+ t = t.Parent;
}
- private async Task> GetProperCulturesAsync()
- {
- var allCodes = await Task.Factory.StartNew(() => CultureInfo.GetCultures(CultureTypes.AllCultures).Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => x.Name));
+ throw new CultureNotFoundException();
+ }
- try
- {
- var downloadedCodes = GetLanguageCodesOffline();
- var properCodes = await Task.Factory.StartNew(() => allCodes.Where(x => downloadedCodes.Contains(x)));
-
- return properCodes ?? allCodes;
- }
- catch (Exception ex)
- {
- Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Getting Language Codes", ex.Message +
- Environment.NewLine + "Loading all local language codes."));
- }
+ private async Task> GetProperCulturesAsync()
+ {
+ var allCodes = await Task.Factory.StartNew(() => CultureInfo.GetCultures(CultureTypes.AllCultures).Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => x.Name));
- GC.Collect();
- return allCodes;
+ try
+ {
+ var downloadedCodes = GetLanguageCodesOffline();
+ var properCodes = await Task.Factory.StartNew(() => allCodes.Where(x => downloadedCodes.Contains(x)));
+
+ return properCodes ?? allCodes;
}
-
- private List GetLanguageCodesOffline()
+ catch (Exception ex)
{
- //I'm taking a shortcut in here.
- return ("af;af-NA;agq;ak;am;ar;ar-AE;ar-BH;ar-DJ;ar-DZ;ar-EG;ar-ER;ar-IL;ar-IQ;ar-JO;ar-KM;ar-KW;ar-LB;ar-LY;ar-MA;ar-MR;ar-OM;ar-PS;ar-QA;ar-SA;ar-SD;ar-SO;" +
+ Dispatcher.Invoke(() => Dialog.Ok("Translator", "Translator - Getting Language Codes", ex.Message +
+ Environment.NewLine + "Loading all local language codes."));
+ }
+
+ GC.Collect();
+ return allCodes;
+ }
+
+ private List GetLanguageCodesOffline()
+ {
+ //I'm taking a shortcut in here.
+ return ("af;af-NA;agq;ak;am;ar;ar-AE;ar-BH;ar-DJ;ar-DZ;ar-EG;ar-ER;ar-IL;ar-IQ;ar-JO;ar-KM;ar-KW;ar-LB;ar-LY;ar-MA;ar-MR;ar-OM;ar-PS;ar-QA;ar-SA;ar-SD;ar-SO;" +
"ar-SS;ar-SY;ar-TD;ar-TN;ar-YE;as;asa;ast;az;az-Cyrl;bas;be;bem;bez;bg;bm;bn;bn-IN;bo;bo-IN;br;brx;bs;bs-Cyrl;ca;ca-FR;ccp;ce;ceb;cgg;chr;cs;cu;cy;da;" +
"dav;de;de-AT;de-CH;de-IT;de-LI;de-LU;dje;dsb;dua;dyo;dz;ebu;ee;ee-TG;el;en;en-001;en-150;en-AE;en-AG;en-AI;en-AT;en-AU;en-BB;en-BE;en-BI;en-BM;en-BS;" +
"en-BW;en-BZ;en-CA;en-CC;en-CH;en-CK;en-CM;en-CX;en-DE;en-DK;en-DM;en-ER;en-FI;en-FJ;en-FK;en-GB;en-GD;en-GG;en-GH;en-GI;en-GM;en-GU;en-GY;en-HK;en-IE;" +
@@ -687,80 +689,79 @@ private List GetLanguageCodesOffline()
"shi-Latn;si;sk;sl;smn;sn;so;so-DJ;so-ET;so-KE;sq;sq-MK;sq-XK;sr;sr-Cyrl-BA;sr-Cyrl-ME;sr-Cyrl-XK;sr-Latn;sr-Latn-BA;sr-Latn-ME;sr-Latn-XK;sv;sv-FI;sw;sw-CD;sw-KE;" +
"sw-UG;ta;ta-LK;ta-MY;ta-SG;te;teo;teo-KE;tg;th;ti;ti-ER;tk;to;tr;tr-CY;tt;twq;tzm;ug;uk;ur;ur-IN;uz;uz-Arab;uz-Cyrl;vai;vai-Latn;vi;vo;vun;wae;wo;xh;xog;yav;yi;yo;" +
"yo-BJ;zgh;zh;zh-Hans-HK;zh-Hans-MO;zh-Hant;zu").Split(';').ToList();
- }
+ }
- private async Task> GetLanguageCodesAsync()
- {
- var path = await GetLanguageCodesPathAsync();
+ private async Task> GetLanguageCodesAsync()
+ {
+ var path = await GetLanguageCodesPathAsync();
- if (string.IsNullOrEmpty(path))
- throw new WebException("Can't get language codes. Path to language codes is null");
+ if (string.IsNullOrEmpty(path))
+ throw new WebException("Can't get language codes. Path to language codes is null");
- var request = (HttpWebRequest)WebRequest.Create(path);
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
+ var request = (HttpWebRequest)WebRequest.Create(path);
+ request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
- var response = (HttpWebResponse)await request.GetResponseAsync();
+ var response = (HttpWebResponse)await request.GetResponseAsync();
+
+ using (var resultStream = response.GetResponseStream())
+ {
+ if (resultStream == null)
+ throw new WebException("Empty response from server when getting language codes");
- using (var resultStream = response.GetResponseStream())
+ using (var reader = new StreamReader(resultStream))
{
- if (resultStream == null)
- throw new WebException("Empty response from server when getting language codes");
+ var result = await reader.ReadToEndAsync();
- using (var reader = new StreamReader(resultStream))
- {
- var result = await reader.ReadToEndAsync();
+ var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
+ new System.Xml.XmlDictionaryReaderQuotas());
- var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
- new System.Xml.XmlDictionaryReaderQuotas());
+ var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
+ var languages = json.Elements();
- var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
- var languages = json.Elements();
-
- return await Task.Factory.StartNew(() => languages.Where(x => x.XPathSelectElement("defs").Value != "0").Select(x => x.XPathSelectElement("lang").Value));
- }
+ return await Task.Factory.StartNew(() => languages.Where(x => x.XPathSelectElement("defs").Value != "0").Select(x => x.XPathSelectElement("lang").Value));
}
}
+ }
- private async Task GetLanguageCodesPathAsync()
- {
- var request = (HttpWebRequest)WebRequest.Create("https://datahub.io/core/language-codes/datapackage.json");
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
+ private async Task GetLanguageCodesPathAsync()
+ {
+ var request = (HttpWebRequest)WebRequest.Create("https://datahub.io/core/language-codes/datapackage.json");
+ request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
- var response = (HttpWebResponse)await request.GetResponseAsync();
+ var response = (HttpWebResponse)await request.GetResponseAsync();
- using (var resultStream = response.GetResponseStream())
- {
- if (resultStream == null)
- throw new WebException("Empty response from server when getting language codes path");
+ using (var resultStream = response.GetResponseStream())
+ {
+ if (resultStream == null)
+ throw new WebException("Empty response from server when getting language codes path");
- using (var reader = new StreamReader(resultStream))
- {
- var result = await reader.ReadToEndAsync();
+ using (var reader = new StreamReader(resultStream))
+ {
+ var result = await reader.ReadToEndAsync();
- var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
- new System.Xml.XmlDictionaryReaderQuotas());
+ var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(result),
+ new System.Xml.XmlDictionaryReaderQuotas());
- var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
+ var json = await Task.Factory.StartNew(() => XElement.Load(jsonReader));
- return await Task.Factory.StartNew(() => json.XPathSelectElement("resources").Elements().First(x => x.XPathSelectElement("name").Value == "ietf-language-tags_json").XPathSelectElement("path").Value);
- }
+ return await Task.Factory.StartNew(() => json.XPathSelectElement("resources").Elements().First(x => x.XPathSelectElement("name").Value == "ietf-language-tags_json").XPathSelectElement("path").Value);
}
}
-
- #endregion
}
- internal class Culture
- {
- public string Code { get; set; }
- public string Name { get; set; }
- public string CodeName => Code.PadRight(3) + " - " + Name;
- }
+ #endregion
+}
- internal class Translation
- {
- public string Key { get; set; }
- public string BaseText { get; set; }
- public string SpecificText { get; set; }
- }
+internal class Culture
+{
+ public string Code { get; set; }
+ public string Name { get; set; }
+ public string CodeName => Code.PadRight(3) + " - " + Name;
+}
+
+internal class Translation
+{
+ public string Key { get; set; }
+ public string BaseText { get; set; }
+ public string SpecificText { get; set; }
}
\ No newline at end of file
diff --git a/Other/Translator/Util/DataGridHelper.cs b/Other/Translator/Util/DataGridHelper.cs
new file mode 100644
index 000000000..5f8422145
--- /dev/null
+++ b/Other/Translator/Util/DataGridHelper.cs
@@ -0,0 +1,182 @@
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace Translator.Util;
+
+public static class DataGridHelper
+{
+ public static DataGridCell GetCell(DataGrid dg, int row, int column)
+ {
+ var rowContainer = GetRow(dg, row);
+
+ if (rowContainer != null)
+ {
+ var presenter = VisualHelper.GetVisualChild(rowContainer);
+
+ // try to get the cell but it may possibly be virtualized
+ var cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
+
+ if (cell == null)
+ {
+ // now try to bring into view and retrieve the cell
+ dg.ScrollIntoView(rowContainer, dg.Columns[column]);
+ cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
+ }
+
+ return cell;
+ }
+
+ return null;
+ }
+
+ public static DataGridRow GetRow(DataGrid dg, int index)
+ {
+ dg.UpdateLayout();
+ var row = (DataGridRow)dg.ItemContainerGenerator.ContainerFromIndex(index);
+
+ if (row == null)
+ {
+ // may be virtualized, bring into view and try again
+ dg.ScrollIntoView(dg.Items[index]);
+ row = (DataGridRow)dg.ItemContainerGenerator.ContainerFromIndex(index);
+ }
+
+ return row;
+ }
+
+ public static int GetRowIndex(DataGrid dg, DataGridCellInfo dgci)
+ {
+ if (!dgci.IsValid)
+ return -1;
+
+ var dgrow = (DataGridRow)dg.ItemContainerGenerator.ContainerFromItem(dgci.Item);
+
+ return dgrow?.GetIndex() ?? -1;
+ }
+
+ public static int GetColIndex(DataGridCellInfo dgci)
+ {
+ return dgci.Column.DisplayIndex;
+ }
+
+ public static DataGridCell FindParentCell(DataGrid grid, DependencyObject child, int i)
+ {
+ var parent = VisualTreeHelper.GetParent(child);
+ var logicalParent = LogicalTreeHelper.GetParent(child);
+
+ if (logicalParent is DataGridCell)
+ return logicalParent as DataGridCell;
+
+ if (i > 4 || parent == null || parent is DataGridCell)
+ return parent as DataGridCell;
+
+ return FindParentCell(grid, parent, i + 1);
+ }
+
+ public static DataGridCell GetDataGridCell(DataGridCellInfo cellInfo)
+ {
+ if (cellInfo.IsValid == false)
+ return null;
+
+ var cellContent = cellInfo.Column.GetCellContent(cellInfo.Item);
+
+ return cellContent?.Parent as DataGridCell;
+ }
+
+ public static DataGridCell GetDataGridCell(DataGrid dataGrid)
+ {
+ if (dataGrid.CurrentCell.IsValid == false)
+ return null;
+
+ var cellContent = dataGrid.CurrentCell.Column.GetCellContent(dataGrid.CurrentCell.Item);
+
+ if (cellContent == null)
+ {
+ return GetCell(dataGrid, GetColIndex(dataGrid.CurrentCell), GetRowIndex(dataGrid, dataGrid.CurrentCell));
+ }
+
+ return cellContent.Parent as DataGridCell;
+ }
+
+ public static void FocusOnFirstCell(this DataGrid dataGrid)
+ {
+ dataGrid.SelectedIndex = 0;
+ //dataGrid.CurrentCell = new DataGridCellInfo(DataGrid.Items[0], DataGrid.Columns[0]);
+
+ var cell = GetCell(dataGrid, 0, 0);
+
+ cell?.Focus();
+ }
+
+ public static bool Sort(this DataGrid grid, ListSortDirection direction, string property, string second = null)
+ {
+ //If there's already a sort defined in another property.
+ foreach (var column in grid.Columns)
+ {
+ if (column.SortDirection.HasValue)
+ return false;
+
+ var dataColumn = column as DataGridTextColumn;
+
+ if (dataColumn == null || dataColumn.Binding == null) continue;
+
+ var binding = dataColumn.Binding as Binding;
+
+ if (binding != null && binding.Path != null && binding.Path.Path == property)
+ column.SortDirection = direction;
+ }
+
+ //Add the new sort description.
+ grid.Items.SortDescriptions.Add(new SortDescription(property, direction));
+
+ if (second != null)
+ grid.Items.SortDescriptions.Add(new SortDescription(second, direction));
+
+ return true;
+ }
+
+ public static void ReSort(this DataGrid grid, Dictionary sorted)
+ {
+ if (sorted == null || !sorted.Any())
+ sorted = grid.Columns.Where(x => x.SortDirection.HasValue)
+ .ToDictionary(w => w.SortMemberPath, w => w.SortDirection.Value);
+
+ grid.Items.SortDescriptions.Clear();
+
+ foreach (var sort in sorted)
+ {
+ #region Search for the column that should be sorted
+
+ var column = grid.Columns.FirstOrDefault(x =>
+ {
+ var dataColumn = x as DataGridTextColumn;
+
+ if (dataColumn == null || dataColumn.Binding == null)
+ return false;
+
+ var binding = dataColumn.Binding as Binding;
+
+ //Only returns true if it's the match.
+ if (binding != null && binding.Path != null && binding.Path.Path == sort.Key)
+ return true;
+
+ return false;
+ });
+
+ #endregion
+
+ //Displays the sort direction glyph.
+ if (column != null)
+ column.SortDirection = sort.Value;
+
+ //Add the new sort description.
+ grid.Items.SortDescriptions.Add(new SortDescription(sort.Key, sort.Value));
+ }
+ }
+}
diff --git a/Other/Translator/Util/LogWriter.cs b/Other/Translator/Util/LogWriter.cs
index 892c61fcb..7f354e286 100644
--- a/Other/Translator/Util/LogWriter.cs
+++ b/Other/Translator/Util/LogWriter.cs
@@ -1,123 +1,122 @@
-using System;
+using System;
using System.IO;
-namespace Translator.Util
+namespace Translator.Util;
+
+///
+/// Log Writer Class
+///
+public static class LogWriter
{
///
- /// Log Writer Class
+ /// Write to Error Log (Text File).
///
- public static class LogWriter
+ /// The Exception to write.
+ /// The name of the error
+ /// Additional information.
+ /// Fallbacks to the Documents folder.
+ public static void Log(Exception ex, string title, object additional = null, bool isFallback = false)
{
- ///
- /// Write to Error Log (Text File).
- ///
- /// The Exception to write.
- /// The name of the error
- /// Aditional information.
- /// Fallbacks to the Documents folder.
- public static void Log(Exception ex, string title, object aditional = null, bool isFallback = false)
+ try
{
- try
- {
- #region Output folder
+ #region Output folder
- var documents = isFallback? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) : ".";
- var folder = Path.Combine(documents, "ScreenToGif", "Logs");
+ var documents = isFallback ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) : ".";
+ var folder = Path.Combine(documents, "ScreenToGif", "Logs");
- if (!Directory.Exists(folder))
- Directory.CreateDirectory(folder);
+ if (!Directory.Exists(folder))
+ Directory.CreateDirectory(folder);
- #endregion
+ #endregion
- #region Creates the file
+ #region Creates the file
- var date = Path.Combine(folder, DateTime.Now.ToString("yy_MM_dd") + ".txt");
- var dateTime = Path.Combine(folder, DateTime.Now.ToString("yy_MM_dd hh_mm_ss_fff") + ".txt");
+ var date = Path.Combine(folder, DateTime.Now.ToString("yy_MM_dd") + ".txt");
+ var dateTime = Path.Combine(folder, DateTime.Now.ToString("yy_MM_dd hh_mm_ss_fff") + ".txt");
- FileStream fs = null;
- var inUse = false;
+ FileStream fs = null;
+ var inUse = false;
- try
- {
- fs = new FileStream(date, FileMode.OpenOrCreate, FileAccess.ReadWrite);
- }
- catch (Exception)
- {
- inUse = true;
- fs = new FileStream(dateTime, FileMode.OpenOrCreate, FileAccess.ReadWrite);
- }
+ try
+ {
+ fs = new FileStream(date, FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ }
+ catch (Exception)
+ {
+ inUse = true;
+ fs = new FileStream(dateTime, FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ }
- fs.Dispose();
+ fs.Dispose();
- #endregion
+ #endregion
- #region Append the exception information
+ #region Append the exception information
- using (var fileStream = new FileStream(inUse ? dateTime : date, FileMode.Append, FileAccess.Write))
+ using (var fileStream = new FileStream(inUse ? dateTime : date, FileMode.Append, FileAccess.Write))
+ {
+ using (var writer = new StreamWriter(fileStream))
{
- using (var writer = new StreamWriter(fileStream))
- {
- writer.WriteLine($"► Title - {Environment.NewLine}\t{title}");
- writer.WriteLine($"▬ Message - {Environment.NewLine}\t{ex.Message}");
- writer.WriteLine($"○ Type - {Environment.NewLine}\t{ex.GetType()}");
- writer.WriteLine(FormattableString.Invariant($"♦ [Version] Date/Hour - {Environment.NewLine}\t[{App.Version}] {DateTime.Now}"));
- writer.WriteLine($"▲ Source - {Environment.NewLine}\t{ex.Source}");
- writer.WriteLine($"▼ TargetSite - {Environment.NewLine}\t{ex.TargetSite}");
+ writer.WriteLine($"► Title - {Environment.NewLine}\t{title}");
+ writer.WriteLine($"▬ Message - {Environment.NewLine}\t{ex.Message}");
+ writer.WriteLine($"○ Type - {Environment.NewLine}\t{ex.GetType()}");
+ writer.WriteLine(FormattableString.Invariant($"♦ [Version] Date/Hour - {Environment.NewLine}\t[{App.Version}] {DateTime.Now}"));
+ writer.WriteLine($"▲ Source - {Environment.NewLine}\t{ex.Source}");
+ writer.WriteLine($"▼ TargetSite - {Environment.NewLine}\t{ex.TargetSite}");
- var bad = ex as BadImageFormatException;
+ var bad = ex as BadImageFormatException;
- if (bad != null)
- writer.WriteLine($"► Fuslog - {Environment.NewLine}\t{bad.FusionLog}");
+ if (bad != null)
+ writer.WriteLine($"► Fuslog - {Environment.NewLine}\t{bad.FusionLog}");
- if (aditional != null)
- writer.WriteLine($"◄ Aditional - {Environment.NewLine}\t{aditional}");
+ if (additional != null)
+ writer.WriteLine($"◄ Additional - {Environment.NewLine}\t{additional}");
- writer.WriteLine($"♠ StackTrace - {Environment.NewLine}{ex.StackTrace}");
+ writer.WriteLine($"♠ StackTrace - {Environment.NewLine}{ex.StackTrace}");
- if (ex.InnerException != null)
+ if (ex.InnerException != null)
+ {
+ writer.WriteLine();
+ writer.WriteLine($"▬▬ Message - {Environment.NewLine}\t{ex.InnerException.Message}");
+ writer.WriteLine($"○○ Type - {Environment.NewLine}\t{ex.InnerException.GetType()}");
+ writer.WriteLine($"▲▲ Source - {Environment.NewLine}\t{ex.InnerException.Source}");
+ writer.WriteLine($"▼▼ TargetSite - {Environment.NewLine}\t{ex.InnerException.TargetSite}");
+ writer.WriteLine($"♠♠ StackTrace - {Environment.NewLine}{ex.InnerException.StackTrace}");
+
+ if (ex.InnerException.InnerException != null)
{
writer.WriteLine();
- writer.WriteLine($"▬▬ Message - {Environment.NewLine}\t{ex.InnerException.Message}");
- writer.WriteLine($"○○ Type - {Environment.NewLine}\t{ex.InnerException.GetType()}");
- writer.WriteLine($"▲▲ Source - {Environment.NewLine}\t{ex.InnerException.Source}");
- writer.WriteLine($"▼▼ TargetSite - {Environment.NewLine}\t{ex.InnerException.TargetSite}");
- writer.WriteLine($"♠♠ StackTrace - {Environment.NewLine}{ex.InnerException.StackTrace}");
+ writer.WriteLine($"▬▬▬ Message - {Environment.NewLine}\t{ex.InnerException.InnerException.Message}");
+ writer.WriteLine($"○○○ Type - {Environment.NewLine}\t{ex.InnerException.InnerException.GetType()}");
+ writer.WriteLine($"▲▲▲ Source - {Environment.NewLine}\t{ex.InnerException.InnerException.Source}");
+ writer.WriteLine($"▼▼▼ TargetSite - {Environment.NewLine}\t{ex.InnerException.InnerException.TargetSite}");
+ writer.WriteLine($"♠♠♠ StackTrace - {Environment.NewLine}\t{ex.InnerException.InnerException.StackTrace}");
- if (ex.InnerException.InnerException != null)
+ if (ex.InnerException.InnerException.InnerException != null)
{
writer.WriteLine();
- writer.WriteLine($"▬▬▬ Message - {Environment.NewLine}\t{ex.InnerException.InnerException.Message}");
- writer.WriteLine($"○○○ Type - {Environment.NewLine}\t{ex.InnerException.InnerException.GetType()}");
- writer.WriteLine($"▲▲▲ Source - {Environment.NewLine}\t{ex.InnerException.InnerException.Source}");
- writer.WriteLine($"▼▼▼ TargetSite - {Environment.NewLine}\t{ex.InnerException.InnerException.TargetSite}");
- writer.WriteLine($"♠♠♠ StackTrace - {Environment.NewLine}\t{ex.InnerException.InnerException.StackTrace}");
-
- if (ex.InnerException.InnerException.InnerException != null)
- {
- writer.WriteLine();
- writer.WriteLine($"▬▬▬▬ Message - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.Message}");
- writer.WriteLine($"○○○○ Type - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.GetType()}");
- writer.WriteLine($"▲▲▲▲ Source - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.Source}");
- writer.WriteLine($"▼▼▼▼ TargetSite - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.TargetSite}");
- writer.WriteLine($"♠♠♠♠ StackTrace - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.StackTrace}");
- }
+ writer.WriteLine($"▬▬▬▬ Message - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.Message}");
+ writer.WriteLine($"○○○○ Type - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.GetType()}");
+ writer.WriteLine($"▲▲▲▲ Source - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.Source}");
+ writer.WriteLine($"▼▼▼▼ TargetSite - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.TargetSite}");
+ writer.WriteLine($"♠♠♠♠ StackTrace - {Environment.NewLine}\t{ex.InnerException.InnerException.InnerException.StackTrace}");
}
}
-
- writer.WriteLine();
- writer.WriteLine("----------------------------------");
- writer.WriteLine();
}
- }
- #endregion
- }
- catch (Exception)
- {
- //One last trial.
- if (!isFallback)
- Log(ex, title, aditional, true);
+ writer.WriteLine();
+ writer.WriteLine("----------------------------------");
+ writer.WriteLine();
+ }
}
+
+ #endregion
+ }
+ catch (Exception)
+ {
+ //One last trial.
+ if (!isFallback)
+ Log(ex, title, additional, true);
}
}
}
\ No newline at end of file
diff --git a/Other/Translator/Util/VisualHelper.cs b/Other/Translator/Util/VisualHelper.cs
new file mode 100644
index 000000000..9e1cf5889
--- /dev/null
+++ b/Other/Translator/Util/VisualHelper.cs
@@ -0,0 +1,82 @@
+using System;
+using System.IO;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+
+namespace Translator.Util;
+
+public static class VisualHelper
+{
+ public static TP GetParent(DependencyObject child, int i) where TP : DependencyObject
+ {
+ var parent = VisualTreeHelper.GetParent(child);
+ var logicalParent = LogicalTreeHelper.GetParent(child);
+
+ if (logicalParent is TP)
+ return logicalParent as TP;
+
+ if (i > 4 || parent == null || parent is TP)
+ return parent as TP;
+
+ return GetParent(parent, i + 1);
+ }
+
+ public static TP GetParent(DependencyObject child, Type stopWhen) where TP : Visual
+ {
+ var parent = VisualTreeHelper.GetParent(child);
+ var logicalParent = LogicalTreeHelper.GetParent(child);
+
+ if (logicalParent is TP)
+ return logicalParent as TP;
+
+ if (parent is TP)
+ return parent as TP;
+
+ if (parent == null || parent.GetType() == stopWhen)
+ return null;
+
+ return GetParent(parent, stopWhen);
+ }
+
+ public static T GetVisualChild(Visual parent) where T : Visual
+ {
+ var child = default(T);
+ var numVisuals = VisualTreeHelper.GetChildrenCount(parent);
+
+ for (var i = 0; i < numVisuals; i++)
+ {
+ var v = (Visual)VisualTreeHelper.GetChild(parent, i);
+
+ child = v as T ?? GetVisualChild(v);
+
+ if (child != null)
+ break;
+ }
+
+ return child;
+ }
+
+ public static T DeepCopy(UIElement source) where T : new()
+ {
+ if (source == null)
+ return new T();
+
+ var savedObject = System.Windows.Markup.XamlWriter.Save(source);
+
+ var stringReader = new StringReader(savedObject);
+ var xmlReader = System.Xml.XmlReader.Create(stringReader);
+
+ return (T)System.Windows.Markup.XamlReader.Load(xmlReader);
+ }
+
+ public static Storyboard FindStoryboard(this FrameworkElement visual, string key)
+ {
+ var resource = visual.FindResource(key) as Storyboard;
+
+ if (resource == null)
+ return new Storyboard();
+
+ return resource;
+ }
+}
diff --git a/Other/Translator/VisualHelper.cs b/Other/Translator/VisualHelper.cs
deleted file mode 100644
index 828fa6cd5..000000000
--- a/Other/Translator/VisualHelper.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using System;
-using System.IO;
-using System.Windows;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-
-namespace Translator
-{
- public static class VisualHelper
- {
- public static TP GetParent(DependencyObject child, int i) where TP : DependencyObject
- {
- var parent = VisualTreeHelper.GetParent(child);
- var logicalParent = LogicalTreeHelper.GetParent(child);
-
- if (logicalParent is TP)
- return logicalParent as TP;
-
- if (i > 4 || parent == null || parent is TP)
- return parent as TP;
-
- return GetParent(parent, i + 1);
- }
-
- public static TP GetParent(DependencyObject child, Type stopWhen) where TP : Visual
- {
- var parent = VisualTreeHelper.GetParent(child);
- var logicalParent = LogicalTreeHelper.GetParent(child);
-
- if (logicalParent is TP)
- return logicalParent as TP;
-
- if (parent is TP)
- return parent as TP;
-
- if (parent == null || parent.GetType() == stopWhen)
- return null;
-
- return GetParent(parent, stopWhen);
- }
-
- public static T GetVisualChild(Visual parent) where T : Visual
- {
- var child = default(T);
- var numVisuals = VisualTreeHelper.GetChildrenCount(parent);
-
- for (var i = 0; i < numVisuals; i++)
- {
- var v = (Visual)VisualTreeHelper.GetChild(parent, i);
-
- child = v as T ?? GetVisualChild(v);
-
- if (child != null)
- break;
- }
-
- return child;
- }
-
- public static T DeepCopy(UIElement source) where T : new()
- {
- if (source == null)
- return new T();
-
- var savedObject = System.Windows.Markup.XamlWriter.Save(source);
-
- var stringReader = new StringReader(savedObject);
- var xmlReader = System.Xml.XmlReader.Create(stringReader);
-
- return (T)System.Windows.Markup.XamlReader.Load(xmlReader);
- }
-
- public static Storyboard FindStoryboard(this FrameworkElement visual, string key)
- {
- var resource = visual.FindResource(key) as Storyboard;
-
- if (resource == null)
- return new Storyboard();
-
- return resource;
- }
- }
-}
\ No newline at end of file
diff --git a/README.md b/README.md
index 59638c672..bbe4db252 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
-This tool allows you to record a selected area of your screen , live feed from your webcam or live drawings from a sketchboard . Afterwards, you can edit and save the animation as a gif, apng, video, psd or png images.
+This tool allows you to record a selected area of your screen , live feed from your webcam or live drawings from a sketchboard . Afterward, you can edit and save the animation as a gif, apng, video, psd or png image.
@@ -33,7 +33,7 @@
-⚠️ Attention, it requires .Net Framework 4.8 (or above).
+⚠️ Attention, it requires .NET 6 Desktop Runtime (or above).
⚠️
@@ -62,7 +62,7 @@
* Ko-fi donation: [](https://ko-fi.com/B0B7Y5Z9)
* Flattr subscription: https://flattr.com/@NickeManarin/domain/screentogif.com
* Steam wishlist: [](http://steamcommunity.com/id/nickesm/wishlist)
- * GOG Galaxy wishlist: www.gog.com/u/Nickesm/wishlist
+ * GOG Galaxy wishlist: https://www.gog.com/u/Nickesm/wishlist
* Amazon wishlist: https://www.amazon.com/hz/wishlist/ls/2S54SRWY2K8KF?ref_=wl_share
* Feedback (reporting bugs, ideas, etc) [](https://twitter.com/NickeManarin)
* [Anyone can still contribute to the localization of the app/website/installer](https://github.com/NickeManarin/ScreenToGif/blob/master/LOCALIZATION.md)
@@ -98,10 +98,10 @@ That's not why I'm sharing the source code, at all.
Website
- Chip
+ Chip
- Softpedia
+ Softpedia
PortableFreeware
diff --git a/ScreenToGif.Cloud.YandexDisk.Tests/Properties/AssemblyInfo.cs b/ScreenToGif.Cloud.YandexDisk.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4724a6322..000000000
--- a/ScreenToGif.Cloud.YandexDisk.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("ScreenToGif.Cloud.YandexDisk.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ScreenToGif.Cloud.YandexDisk.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2018")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("2e037df4-b0ad-43ed-9b99-4623ddf86f5d")]
-
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ScreenToGif.Cloud.YandexDisk.Tests/ScreenToGif.Cloud.YandexDisk.Tests.csproj b/ScreenToGif.Cloud.YandexDisk.Tests/ScreenToGif.Cloud.YandexDisk.Tests.csproj
deleted file mode 100644
index 3006d33f8..000000000
--- a/ScreenToGif.Cloud.YandexDisk.Tests/ScreenToGif.Cloud.YandexDisk.Tests.csproj
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {2E037DF4-B0AD-43ED-9B99-4623DDF86F5D}
- Library
- Properties
- ScreenToGif.Cloud.YandexDisk.Tests
- ScreenToGif.Cloud.YandexDisk.Tests
- v4.6.1
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
-
-
- ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
- {9a332077-74ba-4c6a-8381-6d98c31a490a}
- ScreenToGif
-
-
-
-
-
-
- Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ScreenToGif.Cloud.YandexDisk.Tests/YandexDiskTests.cs b/ScreenToGif.Cloud.YandexDisk.Tests/YandexDiskTests.cs
deleted file mode 100644
index 2e2e174a9..000000000
--- a/ScreenToGif.Cloud.YandexDisk.Tests/YandexDiskTests.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Net;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ScreenToGif.Cloud.YandexDisk.Tests
-{
- [TestClass]
- public class YandexDiskTests
- {
- [TestMethod]
- public async Task CanUploadFile()
- {
- var cloud = new YandexDisk("2344534523e45LW2jwerdp-efUwe4rmg"); //Paste your OAuth token
-
- // upload
- var result = await cloud.UploadFileAsync("1.txt", CancellationToken.None);
-
- Assert.IsNotNull(result);
- Assert.AreEqual(false, string.IsNullOrEmpty(result.Link));
-
- Trace.WriteLine("link: " + result.Link);
-
- // download
- var data = new WebClient().DownloadData(result.Link);
- Assert.IsNotNull(data);
- }
-
- [TestMethod]
- [ExpectedException(typeof(UploadingException))]
- public async Task ThrowExceptionWhenUploadFileWithInvalidToken()
- {
- var cloud = new YandexDisk("invalid token");
-
- // upload
- var result = await cloud.UploadFileAsync("1.txt", CancellationToken.None);
- }
- }
-}
diff --git a/ScreenToGif.Cloud.YandexDisk.Tests/packages.config b/ScreenToGif.Cloud.YandexDisk.Tests/packages.config
deleted file mode 100644
index d8c1b9099..000000000
--- a/ScreenToGif.Cloud.YandexDisk.Tests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/AdornerPlacement.cs b/ScreenToGif.Model/Enums/AdornerPlacement.cs
new file mode 100644
index 000000000..acf8532aa
--- /dev/null
+++ b/ScreenToGif.Model/Enums/AdornerPlacement.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Specifies the placement of the adorner in related to the adorned control.
+///
+public enum AdornerPlacement
+{
+ Inside,
+ Outside
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/AppThemes.cs b/ScreenToGif.Model/Enums/AppThemes.cs
new file mode 100644
index 000000000..c44a09f44
--- /dev/null
+++ b/ScreenToGif.Model/Enums/AppThemes.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum AppThemes
+{
+ Light,
+ Medium,
+ Dark,
+ VeryDark,
+ FollowSystem
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ApplicationTypes.cs b/ScreenToGif.Model/Enums/ApplicationTypes.cs
new file mode 100644
index 000000000..be49d9596
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ApplicationTypes.cs
@@ -0,0 +1,30 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum ApplicationTypes
+{
+ Unidentified = 0,
+
+ ///
+ /// Light package (.NET 6 desktop runtime download and installation required).
+ /// Distributted as a single file, as an EXE.
+ ///
+ DependantSingle = 1,
+
+ ///
+ /// Full package (.NET 6 desktop runtime included).
+ /// Distributted as a single file, as an EXE.
+ ///
+ FullSingle = 2,
+
+ ///
+ /// Full package (.NET 6 desktop runtime included).
+ /// Distributted as multiple files, as a MSIX for the outside the Store.
+ ///
+ FullMultiMsix = 3,
+
+ ///
+ /// Full package (.NET 6 desktop runtime included).
+ /// Distributted as multiple files, as a MSIX for the Store.
+ ///
+ FullMultiMsixStore = 4,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/CaptureFrequencies.cs b/ScreenToGif.Model/Enums/CaptureFrequencies.cs
new file mode 100644
index 000000000..3e4b833bc
--- /dev/null
+++ b/ScreenToGif.Model/Enums/CaptureFrequencies.cs
@@ -0,0 +1,13 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Type of capture frequency mode for the screen recorder.
+///
+public enum CaptureFrequencies
+{
+ Manual,
+ Interaction,
+ PerSecond,
+ PerMinute,
+ PerHour
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ColorQuantizationType.cs b/ScreenToGif.Model/Enums/ColorQuantizationType.cs
new file mode 100644
index 000000000..36f8d9f8c
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ColorQuantizationType.cs
@@ -0,0 +1,14 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Type of color quantization methods of the gif encoder.
+///
+public enum ColorQuantizationTypes
+{
+ Neural = 0,
+ Octree = 1,
+ MedianCut = 2,
+ Grayscale = 3,
+ MostUsed = 4,
+ Palette = 5,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/CopyModes.cs b/ScreenToGif.Model/Enums/CopyModes.cs
new file mode 100644
index 000000000..f5bbe57c0
--- /dev/null
+++ b/ScreenToGif.Model/Enums/CopyModes.cs
@@ -0,0 +1,12 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Specifies the copy operation mode.
+///
+public enum CopyModes
+{
+ File,
+ FolderPath,
+ FilePath,
+ Link
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/DelayChangeType.cs b/ScreenToGif.Model/Enums/DelayChangeType.cs
new file mode 100644
index 000000000..e1524c221
--- /dev/null
+++ b/ScreenToGif.Model/Enums/DelayChangeType.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Type of delay change action.
+///
+public enum DelayChangeType
+{
+ Override,
+ IncreaseDecrease,
+ Scale
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/DelayUpdateModes.cs b/ScreenToGif.Model/Enums/DelayUpdateModes.cs
new file mode 100644
index 000000000..670130915
--- /dev/null
+++ b/ScreenToGif.Model/Enums/DelayUpdateModes.cs
@@ -0,0 +1,8 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum DelayUpdateModes
+{
+ Override = 0,
+ IncreaseDecrease = 1,
+ Scale = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/DitherMethods.cs b/ScreenToGif.Model/Enums/DitherMethods.cs
new file mode 100644
index 000000000..9d1483bbc
--- /dev/null
+++ b/ScreenToGif.Model/Enums/DitherMethods.cs
@@ -0,0 +1,24 @@
+using System.ComponentModel;
+
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Dither methods, currently being used by FFmpeg.
+///
+public enum DitherMethods
+{
+ [Description("bayer")]
+ Bayer,
+
+ [Description("heckbert")]
+ Heckbert,
+
+ [Description("floyd_steinberg")]
+ FloydSteinberg,
+
+ [Description("sierra2")]
+ Sierra2,
+
+ [Description("sierra2_4a")]
+ Sierra2Lite,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/DrawingModeType.cs b/ScreenToGif.Model/Enums/DrawingModeType.cs
new file mode 100644
index 000000000..85808bdea
--- /dev/null
+++ b/ScreenToGif.Model/Enums/DrawingModeType.cs
@@ -0,0 +1,18 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The types of drawings.
+///
+public enum DrawingModeType
+{
+ None = 0,
+ Ink,
+ Select,
+ EraseByPoint,
+ EraseByObject,
+ Rectangle,
+ Circle,
+ Triangle,
+ Arrow,
+ Balloon,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/DuplicatesDelayModes.cs b/ScreenToGif.Model/Enums/DuplicatesDelayModes.cs
new file mode 100644
index 000000000..d6450ac58
--- /dev/null
+++ b/ScreenToGif.Model/Enums/DuplicatesDelayModes.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Specifies the frame delay adjustment mode.
+///
+public enum DuplicatesDelayModes
+{
+ DontAdjust = 0,
+ Average = 1,
+ Sum = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/DuplicatesRemovalModes.cs b/ScreenToGif.Model/Enums/DuplicatesRemovalModes.cs
new file mode 100644
index 000000000..0566b087b
--- /dev/null
+++ b/ScreenToGif.Model/Enums/DuplicatesRemovalModes.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Specifies the frame removal mode.
+///
+public enum DuplicatesRemovalModes
+{
+ First = 0,
+ Last = 1
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/EncoderTypes.cs b/ScreenToGif.Model/Enums/EncoderTypes.cs
new file mode 100644
index 000000000..90af433c1
--- /dev/null
+++ b/ScreenToGif.Model/Enums/EncoderTypes.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum EncoderTypes
+{
+ ScreenToGif, //Gif, Apng
+ KGySoft, // Gif
+ System, //Gif, Video
+ FFmpeg, //Gif, Webp, Apng, Avif, Video
+ Gifski //Gif
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/EncodingStatus.cs b/ScreenToGif.Model/Enums/EncodingStatus.cs
new file mode 100644
index 000000000..e5e57983e
--- /dev/null
+++ b/ScreenToGif.Model/Enums/EncodingStatus.cs
@@ -0,0 +1,32 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Encoding status.
+///
+public enum EncodingStatus
+{
+ ///
+ /// Processing encoding/uploading status.
+ ///
+ Processing,
+
+ ///
+ /// The Encoding was canceled. So apparently "cancelled" (with two L's) is also a valid grammar. Huh, that's strange.
+ ///
+ Canceled,
+
+ ///
+ /// An error happened with the encoding process.
+ ///
+ Error,
+
+ ///
+ /// Encoding done.
+ ///
+ Completed,
+
+ ///
+ /// File deleted or Moved.
+ ///
+ FileDeletedOrMoved
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ExitAction.cs b/ScreenToGif.Model/Enums/ExitAction.cs
new file mode 100644
index 000000000..b74e0d78f
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ExitAction.cs
@@ -0,0 +1,22 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Exit actions after closing the Recording Window.
+///
+public enum ExitAction
+{
+ ///
+ /// Return to the StartUp Window.
+ ///
+ Return = 0,
+
+ ///
+ /// Something was recorded. Go to the Editor.
+ ///
+ Recorded = 1,
+
+ ///
+ /// Exit the application.
+ ///
+ Exit = 2,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ExportFormats.cs b/ScreenToGif.Model/Enums/ExportFormats.cs
new file mode 100644
index 000000000..11202db60
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ExportFormats.cs
@@ -0,0 +1,87 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum ExportFormats
+{
+ ///
+ /// Graphics Interchange Format.
+ ///
+ Gif,
+
+ ///
+ /// Animated Portable Network Graphics.
+ ///
+ Apng,
+
+ ///
+ /// Web Picture.
+ ///
+ Webp,
+
+ ///
+ /// Better portable graphics.
+ ///
+ Bpg,
+
+ ///
+ /// AV1 Still Image Format.
+ ///
+ Avif,
+
+ ///
+ /// Audio Video Interleaved.
+ ///
+ Avi,
+
+ ///
+ /// Matroska.
+ ///
+ Mkv,
+
+ ///
+ /// Quicktime movie.
+ ///
+ Mov,
+
+ ///
+ /// MPEG-4 Part 14.
+ ///
+ Mp4,
+
+ ///
+ /// Web Movie.
+ ///
+ Webm,
+
+
+ ///
+ /// Bitmap.
+ ///
+ Bmp,
+
+ ///
+ /// Joint Photographic Experts Group.
+ ///
+ Jpeg,
+
+ ///
+ /// Portable Network Graphics.
+ ///
+ Png,
+
+
+ ///
+ /// Project file, .stg or .zip.
+ ///
+ Stg,
+
+ ///
+ /// Photoshop file.
+ ///
+ Psd,
+
+ ///
+ /// Compressed file.
+ /// Not in directly use by the encoder, but as an option for the images and the project.
+ ///
+ Zip
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ExtrasStatus.cs b/ScreenToGif.Model/Enums/ExtrasStatus.cs
new file mode 100644
index 000000000..1e17c92fc
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ExtrasStatus.cs
@@ -0,0 +1,13 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Specifies the status of the image card control.
+///
+public enum ExtrasStatus
+{
+ NotAvailable,
+ Available,
+ Processing,
+ Ready,
+ Error
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/FadeModes.cs b/ScreenToGif.Model/Enums/FadeModes.cs
new file mode 100644
index 000000000..88d3b078b
--- /dev/null
+++ b/ScreenToGif.Model/Enums/FadeModes.cs
@@ -0,0 +1,17 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The type of fade transition.
+///
+public enum FadeModes
+{
+ ///
+ /// The next frame of the recording.
+ ///
+ NextFrame,
+
+ ///
+ /// A solid color.
+ ///
+ Color
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/FlipRotateType.cs b/ScreenToGif.Model/Enums/FlipRotateType.cs
new file mode 100644
index 000000000..8bd28ee5d
--- /dev/null
+++ b/ScreenToGif.Model/Enums/FlipRotateType.cs
@@ -0,0 +1,12 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Type of the Flip/Rotate action.
+///
+public enum FlipRotateType
+{
+ FlipHorizontal,
+ FlipVertical,
+ RotateRight90,
+ RotateLeft90
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Framerates.cs b/ScreenToGif.Model/Enums/Framerates.cs
new file mode 100644
index 000000000..3e6da0fde
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Framerates.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum Framerates
+{
+ Auto,
+ Custom,
+ Film,
+ Ntsc,
+ Pal
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/HardwareAcceleration.cs b/ScreenToGif.Model/Enums/HardwareAcceleration.cs
new file mode 100644
index 000000000..9e0a5ea45
--- /dev/null
+++ b/ScreenToGif.Model/Enums/HardwareAcceleration.cs
@@ -0,0 +1,19 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum HardwareAccelerationModes
+{
+ ///
+ /// Only lets you select non-hardware backed encoders.
+ ///
+ Off,
+
+ ///
+ /// Lets you select hardware backed encoders too. -hwaccel auto
+ ///
+ On,
+
+ ///
+ /// Only lets you select non-hardware backed encoders, but switches to one if possible. -hwaccel auto
+ ///
+ Auto
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Icons.cs b/ScreenToGif.Model/Enums/Icons.cs
new file mode 100644
index 000000000..735503a46
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Icons.cs
@@ -0,0 +1,32 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Dialog Icons.
+///
+public enum Icons
+{
+ ///
+ /// Information. Blue.
+ ///
+ Info,
+
+ ///
+ /// Warning, yellow.
+ ///
+ Warning,
+
+ ///
+ /// Error, red.
+ ///
+ Error,
+
+ ///
+ /// Success, green.
+ ///
+ Success,
+
+ ///
+ /// A question mark, blue.
+ ///
+ Question,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ModeType.cs b/ScreenToGif.Model/Enums/ModeType.cs
new file mode 100644
index 000000000..474b99cdf
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ModeType.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The type of capture area selection.
+///
+public enum ModeType
+{
+ Region = 0,
+ Window = 1,
+ Fullscreen = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/MouseButtons.cs b/ScreenToGif.Model/Enums/MouseButtons.cs
new file mode 100644
index 000000000..94e2ac416
--- /dev/null
+++ b/ScreenToGif.Model/Enums/MouseButtons.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum MouseButtons
+{
+ None,
+ Left,
+ Middle,
+ Right,
+ FirstExtra,
+ SecondExtra,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/MouseEventType.cs b/ScreenToGif.Model/Enums/MouseEventType.cs
new file mode 100644
index 000000000..eac409217
--- /dev/null
+++ b/ScreenToGif.Model/Enums/MouseEventType.cs
@@ -0,0 +1,16 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Event flags for mouse-related events.
+///
+public enum MouseEventType
+{
+ MouseMove,
+ IconRightMouseDown,
+ IconLeftMouseDown,
+ IconRightMouseUp,
+ IconLeftMouseUp,
+ IconMiddleMouseDown,
+ IconMiddleMouseUp,
+ IconLeftDoubleClick
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/BaloonFlags.cs b/ScreenToGif.Model/Enums/Native/BaloonFlags.cs
new file mode 100644
index 000000000..b403f45ac
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/BaloonFlags.cs
@@ -0,0 +1,60 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// Flags that define the icon that is shown on a balloon
+/// tooltip.
+///
+public enum BalloonFlags
+{
+ ///
+ /// No icon is displayed.
+ ///
+ None = 0x00,
+
+ ///
+ /// An information icon is displayed.
+ ///
+ Info = 0x01,
+
+ ///
+ /// A warning icon is displayed.
+ ///
+ Warning = 0x02,
+
+ ///
+ /// An error icon is displayed.
+ ///
+ Error = 0x03,
+
+ ///
+ /// Windows XP Service Pack 2 (SP2) and later.
+ /// Use a custom icon as the title icon.
+ ///
+ User = 0x04,
+
+ ///
+ /// Windows XP (Shell32.dll version 6.0) and later.
+ /// Do not play the associated sound. Applies only to balloon ToolTips.
+ ///
+ NoSound = 0x10,
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later. The large version
+ /// of the icon should be used as the balloon icon. This corresponds to the
+ /// icon with dimensions SM_CXICON x SM_CYICON. If this flag is not set,
+ /// the icon with dimensions XM_CXSMICON x SM_CYSMICON is used.
+ /// - This flag can be used with all stock icons.
+ /// - Applications that use older customized icons (NIIF_USER with hIcon) must
+ /// provide a new SM_CXICON x SM_CYICON version in the tray icon (hIcon). These
+ /// icons are scaled down when they are displayed in the System Tray or
+ /// System Control Area (SCA).
+ /// - New customized icons (NIIF_USER with hBalloonIcon) must supply an
+ /// SM_CXICON x SM_CYICON version in the supplied icon (hBalloonIcon).
+ ///
+ LargeIcon = 0x20,
+
+ ///
+ /// Windows 7 and later.
+ ///
+ RespectQuietTime = 0x80
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/BitmapCompressionModes.cs b/ScreenToGif.Model/Enums/Native/BitmapCompressionModes.cs
new file mode 100644
index 000000000..15c3c433a
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/BitmapCompressionModes.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum BitmapCompressionModes : uint
+{
+ Rgb = 0,
+ Rle8 = 1,
+ Rle4 = 2,
+ BitFields = 3,
+ Jpeg = 4,
+ Png = 5
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/CopyPixelOperations.cs b/ScreenToGif.Model/Enums/Native/CopyPixelOperations.cs
new file mode 100644
index 000000000..edd33b61b
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/CopyPixelOperations.cs
@@ -0,0 +1,63 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+///Specifies a raster-operation code. These codes define how the color data for the
+///source rectangle is to be combined with the color data for the destination
+///rectangle to achieve the final color.
+///
+[Flags]
+public enum CopyPixelOperations
+{
+ NoMirrorBitmap = -2147483648,
+
+ /// dest = BLACK, 0x00000042
+ Blackness = 66,
+
+ ///dest = (NOT src) AND (NOT dest), 0x001100A6
+ NotSourceErase = 1114278,
+
+ ///dest = (NOT source), 0x00330008
+ NotSourceCopy = 3342344,
+
+ ///dest = source AND (NOT dest), 0x00440328
+ SourceErase = 4457256,
+
+ /// dest = (NOT dest), 0x00550009
+ DestinationInvert = 5570569,
+
+ /// dest = pattern XOR dest, 0x005A0049
+ PatInvert = 5898313,
+
+ ///dest = source XOR dest, 0x00660046
+ SourceInvert = 6684742,
+
+ ///dest = source AND dest, 0x008800C6
+ SourceAnd = 8913094,
+
+ /// dest = (NOT source) OR dest, 0x00BB0226
+ MergePaint = 12255782,
+
+ ///dest = (source AND pattern), 0x00C000CA
+ MergeCopy = 12583114,
+
+ ///dest = source, 0x00CC0020
+ SourceCopy = 13369376,
+
+ /// dest = source OR dest, 0x00EE0086
+ SourcePaint = 15597702,
+
+ /// dest = pattern, 0x00F00021
+ PatCopy = 15728673,
+
+ /// dest = DPSnoo, 0x00FB0A09
+ PatPaint = 16452105,
+
+ /// dest = WHITE, 0x00FF0062
+ Whiteness = 16711778,
+
+ ///
+ /// Capture window as seen on screen. This includes layered windows
+ /// such as WPF windows with AllowsTransparency="true", 0x40000000
+ ///
+ CaptureBlt = 1073741824,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/CornerPreferences.cs b/ScreenToGif.Model/Enums/Native/CornerPreferences.cs
new file mode 100644
index 000000000..8b3826967
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/CornerPreferences.cs
@@ -0,0 +1,29 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// Flags used by the DwmSetWindowAttribute function to specify the rounded corner preference for a window.
+/// https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference
+/// Windows Build 22000
+///
+public enum CornerPreferences
+{
+ ///
+ /// Let the system decide when to round window corners.
+ ///
+ Default = 0,
+
+ ///
+ /// Never round window corners.
+ ///
+ DoNotRound = 1,
+
+ ///
+ /// Round the corners, if appropriate.
+ ///
+ Round = 2,
+
+ ///
+ /// Round the corners if appropriate, with a small radius.
+ ///
+ RoundSmall = 3
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/DeviceCaps.cs b/ScreenToGif.Model/Enums/Native/DeviceCaps.cs
new file mode 100644
index 000000000..cdbdddfd7
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/DeviceCaps.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum DeviceCaps : int
+{
+ LogPixelsX = 88,
+ LogPixelsY = 90,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/DibColorModes.cs b/ScreenToGif.Model/Enums/Native/DibColorModes.cs
new file mode 100644
index 000000000..2d9f2a7c5
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/DibColorModes.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum DibColorModes : uint
+{
+ RgbColors = 0,
+ PalColors = 1
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/DisplayDeviceStates.cs b/ScreenToGif.Model/Enums/Native/DisplayDeviceStates.cs
new file mode 100644
index 000000000..b82517154
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/DisplayDeviceStates.cs
@@ -0,0 +1,40 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+[Flags]
+public enum DisplayDeviceStates : int
+{
+ ///
+ /// The device is part of the desktop.
+ ///
+ AttachedToDesktop = 0x1,
+
+ MultiDriver = 0x2,
+
+ ///
+ /// The device is part of the desktop.
+ ///
+ PrimaryDevice = 0x4,
+
+ ///
+ /// Represents a pseudo device used to mirror application drawing for remoting or other purposes.
+ ///
+ MirroringDriver = 0x8,
+
+ ///
+ /// The device is VGA compatible.
+ ///
+ VgaCompatible = 0x10,
+
+ ///
+ /// The device is removable; it cannot be the primary display.
+ ///
+ Removable = 0x20,
+
+ ///
+ /// The device has more display modes than its output devices support.
+ ///
+ ModesPruned = 0x8000000,
+
+ Remote = 0x4000000,
+ Disconnect = 0x2000000
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/DisplayDevices.cs b/ScreenToGif.Model/Enums/Native/DisplayDevices.cs
new file mode 100644
index 000000000..c1dab1e6b
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/DisplayDevices.cs
@@ -0,0 +1,31 @@
+using System.Runtime.InteropServices;
+
+namespace ScreenToGif.Domain.Enums.Native;
+
+[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+public struct DisplayDevices
+{
+ public DisplayDevices(bool? filler) : this()
+ {
+ //Allows automatic initialization of "Size" with "new DisplayDevice(null/true/false)".
+ Size = Marshal.SizeOf(typeof(DisplayDevices));
+ }
+
+ [MarshalAs(UnmanagedType.U4)]
+ public int Size;
+
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string DeviceName;
+
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ public string DeviceString;
+
+ [MarshalAs(UnmanagedType.U4)]
+ public DisplayDeviceStates StateFlags;
+
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ public string DeviceID;
+
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ public string DeviceKey;
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/DpiTypes.cs b/ScreenToGif.Model/Enums/Native/DpiTypes.cs
new file mode 100644
index 000000000..b3aba5963
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/DpiTypes.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// https://msdn.microsoft.com/en-us/library/windows/desktop/dn280511(v=vs.85).aspx
+///
+public enum DpiTypes
+{
+ Effective = 0,
+ Angular = 1,
+ Raw = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/DwmWindowAttributes.cs b/ScreenToGif.Model/Enums/Native/DwmWindowAttributes.cs
new file mode 100644
index 000000000..8d7cc62f6
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/DwmWindowAttributes.cs
@@ -0,0 +1,38 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum DwmWindowAttributes
+{
+ NcRenderingEnabled = 1,
+ NcRenderingPolicy,
+ TransitionsForcedisabled,
+ AllowNcPaint,
+ CaptionButtonBounds,
+ NonclientRtlLayout,
+ ForceIconicRepresentation,
+ Flip3DPolicy,
+ ExtendedFrameBounds,
+ HasIconicBitmap,
+ DisallowPeek,
+ ExcludedFromPeek,
+ Cloak,
+ Cloaked,
+ FreezeRepresentation,
+ PassiveUpdateMode,
+ UseHostBackdropBrush,
+ UseImmersiveDarkModeBefore20H1 = 19, //For Windows 10 versions before 2004.
+ UseImmersiveDarkMode = 20,
+ WindowCornerPreference = 33,
+ BorderColor,
+ CaptionColor,
+ TextColor,
+ VisibleFrameBorderThickness,
+
+ ///
+ /// Retrieves or specifies the system-drawn backdrop material of a window, including behind the non-client area.
+ /// The pvAttribute parameter points to a value of type SystemBackdropTypes.
+ ///
+ SystemBackdropType,
+
+ MicaEffect = 1029,
+ Last
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/GetAncestorFlags.cs b/ScreenToGif.Model/Enums/Native/GetAncestorFlags.cs
new file mode 100644
index 000000000..11bed96f0
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/GetAncestorFlags.cs
@@ -0,0 +1,17 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum GetAncestorFlags
+{
+ ///
+ /// Retrieves the parent window. This does not include the owner, as it does with the GetParent function.
+ ///
+ GetParent = 1,
+ ///
+ /// Retrieves the root window by walking the chain of parent windows.
+ ///
+ GetRoot = 2,
+ ///
+ /// Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.
+ ///
+ GetRootOwner = 3
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/GetWindowTypes.cs b/ScreenToGif.Model/Enums/Native/GetWindowTypes.cs
new file mode 100644
index 000000000..63d400045
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/GetWindowTypes.cs
@@ -0,0 +1,59 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum GetWindowType : uint
+{
+ ///
+ /// The retrieved handle identifies the window of the same type that is highest in the Z order.
+ ///
+ /// If the specified window is a topmost window, the handle identifies a topmost window.
+ /// If the specified window is a top-level window, the handle identifies a top-level window.
+ /// If the specified window is a child window, the handle identifies a sibling window.
+ ///
+ HwndFirst = 0,
+
+ ///
+ /// The retrieved handle identifies the window of the same type that is lowest in the Z order.
+ ///
+ /// If the specified window is a topmost window, the handle identifies a topmost window.
+ /// If the specified window is a top-level window, the handle identifies a top-level window.
+ /// If the specified window is a child window, the handle identifies a sibling window.
+ ///
+ HwdnLast = 1,
+
+ ///
+ /// The retrieved handle identifies the window below the specified window in the Z order.
+ ///
+ /// If the specified window is a topmost window, the handle identifies a topmost window.
+ /// If the specified window is a top-level window, the handle identifies a top-level window.
+ /// If the specified window is a child window, the handle identifies a sibling window.
+ ///
+ HwndNext = 2,
+
+ ///
+ /// The retrieved handle identifies the window above the specified window in the Z order.
+ ///
+ /// If the specified window is a topmost window, the handle identifies a topmost window.
+ /// If the specified window is a top-level window, the handle identifies a top-level window.
+ /// If the specified window is a child window, the handle identifies a sibling window.
+ ///
+ HwndPrev = 3,
+
+ ///
+ /// The retrieved handle identifies the specified window's owner window, if any.
+ ///
+ Owner = 4,
+
+ ///
+ /// The retrieved handle identifies the child window at the top of the Z order,
+ /// if the specified window is a parent window; otherwise, the retrieved handle is NULL.
+ /// The function examines only child windows of the specified window. It does not examine descendant windows.
+ ///
+ Child = 5,
+
+ ///
+ /// The retrieved handle identifies the enabled popup window owned by the specified window (the
+ /// search uses the first such window found using HwndNext); otherwise, if there are no enabled
+ /// popup windows, the retrieved handle is that of the specified window.
+ ///
+ EnabledPopup = 6
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/HitTestTargets.cs b/ScreenToGif.Model/Enums/Native/HitTestTargets.cs
new file mode 100644
index 000000000..23bb19bab
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/HitTestTargets.cs
@@ -0,0 +1,134 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum HitTestTargets : int
+{
+ ///
+ /// In the border of a window that does not have a sizing border.
+ ///
+ Border = 18,
+
+ ///
+ /// In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically).
+ ///
+ Bottom = 15,
+
+ ///
+ /// In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
+ ///
+ BottomLeft = 16,
+
+ ///
+ /// In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
+ ///
+ BottomRight = 17,
+
+ ///
+ /// In a title bar.
+ ///
+ Caption = 2,
+
+ ///
+ /// In a client area.
+ ///
+ Client = 1,
+
+ ///
+ /// In a Close button.
+ ///
+ CloseButton = 20,
+
+ ///
+ /// On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error).
+ ///
+ Error = -2,
+
+ ///
+ /// In a size box (same as HTSIZE).
+ ///
+ GrowBox = 4,
+
+ ///
+ /// In a Help button.
+ ///
+ Help = 21,
+
+ ///
+ /// In a horizontal scroll bar.
+ ///
+ HorizontalScroll = 6,
+
+ ///
+ /// In the left border of a resizable window (the user can click the mouse to resize the window horizontally).
+ ///
+ Left = 10,
+
+ ///
+ /// In a menu.
+ ///
+ Menu = 5,
+
+ ///
+ /// In a Maximize button.
+ ///
+ MaximizeButton = 9,
+
+ ///
+ /// In a Minimize button.
+ ///
+ MinimizeButton = 8,
+
+ ///
+ /// On the screen background or on a dividing line between windows.
+ ///
+ Nowhere = 0,
+
+ ///
+ /// In a Minimize button.
+ ///
+ Reduce = MinimizeButton,
+
+ ///
+ /// In the right border of a resizable window (the user can click the mouse to resize the window horizontally).
+ ///
+ Right = 11,
+
+ ///
+ /// In a size box (same as HTGROWBOX).
+ ///
+ Size = GrowBox,
+
+ ///
+ /// In a window menu or in a Close button in a child window.
+ ///
+ SysMenu = 3,
+
+ ///
+ /// In the upper-horizontal border of a window.
+ ///
+ Top = 12,
+
+ ///
+ /// In the upper-left corner of a window border.
+ ///
+ TopLeft = 13,
+
+ ///
+ /// In the upper-right corner of a window border.
+ ///
+ TopRight = 14,
+
+ ///
+ /// In a window currently covered by another window in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT).
+ ///
+ Transparent = -1,
+
+ ///
+ /// In the vertical scroll bar.
+ ///
+ VerticalScroll = 7,
+
+ ///
+ /// In a Maximize button.
+ ///
+ Zoom = MaximizeButton
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/IconDataMembers.cs b/ScreenToGif.Model/Enums/Native/IconDataMembers.cs
new file mode 100644
index 000000000..b64cb67df
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/IconDataMembers.cs
@@ -0,0 +1,67 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// Indicates which members of a structure
+/// were set, and thus contain valid data or provide additional information
+/// to the ToolTip as to how it should display.
+///
+[Flags]
+public enum IconDataMembers
+{
+ ///
+ /// The message ID is set.
+ ///
+ Message = 0x01,
+
+ ///
+ /// The notification icon is set.
+ ///
+ Icon = 0x02,
+
+ ///
+ /// The tooltip is set.
+ ///
+ Tip = 0x04,
+
+ ///
+ /// State information ( ) is set. This
+ /// applies to both and
+ /// .
+ ///
+ State = 0x08,
+
+ ///
+ /// The balloon ToolTip is set. Accordingly, the following
+ /// members are set: ,
+ /// , ,
+ /// and .
+ ///
+ Info = 0x10,
+
+ // Internal identifier is set. Reserved, thus commented out.
+ //Guid = 0x20,
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later. If the ToolTip
+ /// cannot be displayed immediately, discard it.
+ /// Use this flag for ToolTips that represent real-time information which
+ /// would be meaningless or misleading if displayed at a later time.
+ /// For example, a message that states "Your telephone is ringing."
+ /// This modifies and must be combined with the flag.
+ ///
+ Realtime = 0x40,
+
+ ///
+ /// Windows Vista (Shell32.dll version 6.0.6) and later.
+ /// Use the standard ToolTip. Normally, when uVersion is set
+ /// to NOTIFYICON_VERSION_4, the standard ToolTip is replaced
+ /// by the application-drawn pop-up user interface (UI).
+ /// If the application wants to show the standard tooltip
+ /// in that case, regardless of whether the on-hover UI is showing,
+ /// it can specify NIF_SHOWTIP to indicate the standard tooltip
+ /// should still be shown.
+ /// Note that the NIF_SHOWTIP flag is effective until the next call
+ /// to Shell_NotifyIcon.
+ ///
+ UseLegacyToolTips = 0x80
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/IconStates.cs b/ScreenToGif.Model/Enums/Native/IconStates.cs
new file mode 100644
index 000000000..b8e1f259d
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/IconStates.cs
@@ -0,0 +1,17 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// The visual state of the icon.
+///
+public enum IconStates
+{
+ ///
+ /// The icon is visible.
+ ///
+ Visible = 0x00,
+
+ ///
+ /// Hide the icon.
+ ///
+ Hidden = 0x01
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/LocalMemoryFlags.cs b/ScreenToGif.Model/Enums/Native/LocalMemoryFlags.cs
new file mode 100644
index 000000000..0518c9cc6
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/LocalMemoryFlags.cs
@@ -0,0 +1,19 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+[Flags]
+public enum LocalMemoryFlags
+{
+ LMEM_FIXED = 0x0000,
+ LMEM_MOVEABLE = 0x0002,
+ LMEM_NOCOMPACT = 0x0010,
+ LMEM_NODISCARD = 0x0020,
+ LMEM_ZEROINIT = 0x0040,
+ LMEM_MODIFY = 0x0080,
+ LMEM_DISCARDABLE = 0x0F00,
+ LMEM_VALID_FLAGS = 0x0F72,
+ LMEM_INVALID_HANDLE = 0x8000,
+ LHND = (LMEM_MOVEABLE | LMEM_ZEROINIT),
+ LPTR = (LMEM_FIXED | LMEM_ZEROINIT),
+ NONZEROLHND = (LMEM_MOVEABLE),
+ NONZEROLPTR = (LMEM_FIXED)
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/MapTypes.cs b/ScreenToGif.Model/Enums/Native/MapTypes.cs
new file mode 100644
index 000000000..d53d9ba91
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/MapTypes.cs
@@ -0,0 +1,9 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum MapTypes : uint
+{
+ MapvkVkToVsc = 0x0,
+ MapvkVscToVk = 0x1,
+ MapvkVkToChar = 0x2,
+ MapvkVscToVkEx = 0x3,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/MenuFunctions.cs b/ScreenToGif.Model/Enums/Native/MenuFunctions.cs
new file mode 100644
index 000000000..efc7e587b
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/MenuFunctions.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+[Flags]
+public enum MenuFunctions
+{
+ ByCommand = 0x00000000,
+ ByPosition = 0x00000400,
+ Enabled = 0x00000000,
+ Grayed = 0x00000001,
+ Disabled = 0x00000002
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/NativeMouseEvents.cs b/ScreenToGif.Model/Enums/Native/NativeMouseEvents.cs
new file mode 100644
index 000000000..efbc76bac
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/NativeMouseEvents.cs
@@ -0,0 +1,39 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum NativeMouseEvents
+{
+ MouseMove = 0x200,
+ MouseDragStart = 0x00AE,
+ MouseDragEnd = 0x00AF,
+
+ LeftButtonDown = 0x201,
+ LeftButtonUp = 0x202,
+ LeftButtonDoubleClick = 0x203,
+ OutsideLeftButtonDown = 0x00A1,
+ OutsideLeftButtonUp = 0x00A2,
+ OutsideLeftButtonDoubleClick = 0x00A3,
+
+ RightButtonDown = 0x204,
+ RightButtonUp = 0x205,
+ RightButtonDoubleClick = 0x206,
+ OutsideRightButtonDown = 0x00A4,
+ OutsideRightButtonUp = 0x00A5,
+ OutsideRightButtonDoubleClick = 0x00A6,
+
+ MiddleButtonDown = 0x207,
+ MiddleButtonUp = 0x208,
+ MiddleButtonDoubleClick = 0x209,
+ OutsideMiddleButtonDown = 0x00A7,
+ OutsideMiddleButtonUp = 0x00A8,
+ OutsideMiddleButtonDoubleClick = 0x00A9,
+
+ MouseWheel = 0x020A,
+ MouseWheelHorizontal = 0x020E,
+
+ ExtraButtonDown = 0x020B,
+ ExtraButtonUp = 0x020C,
+ ExtraButtonDoubleClick = 0x020D,
+ OutsideExtraButtonDown = 0x00AB,
+ OutsideExtraButtonUp = 0x00AC,
+ OutsideExtraButtonDoubleClick = 0x00AD
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/NotifyCommands.cs b/ScreenToGif.Model/Enums/Native/NotifyCommands.cs
new file mode 100644
index 000000000..6da9fee13
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/NotifyCommands.cs
@@ -0,0 +1,38 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// The main operations performed on the function.
+///
+public enum NotifyCommands
+{
+ ///
+ /// The taskbar icon is being created.
+ ///
+ Add = 0x00,
+
+ ///
+ /// The settings of the taskbar icon are being updated.
+ ///
+ Modify = 0x01,
+
+ ///
+ /// The taskbar icon is deleted.
+ ///
+ Delete = 0x02,
+
+ ///
+ /// Focus is returned to the taskbar icon.
+ ///
+ SetFocus = 0x03,
+
+ ///
+ /// Shell32.dll version 5.0 and later only. Instructs the taskbar
+ /// to behave according to the version number specified in the
+ /// uVersion member of the structure pointed to by lpdata.
+ /// This message allows you to specify whether you want the version
+ /// 5.0 behavior found on Microsoft Windows 2000 systems, or the
+ /// behavior found on earlier Shell versions. The default value for
+ /// uVersion is zero.
+ ///
+ SetVersion = 0x04
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/NotifyIconVersions.cs b/ScreenToGif.Model/Enums/Native/NotifyIconVersions.cs
new file mode 100644
index 000000000..78b34b3e6
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/NotifyIconVersions.cs
@@ -0,0 +1,25 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// The notify icon version that is used. The higher
+/// the version, the more capabilities are available.
+///
+public enum NotifyIconVersions
+{
+ ///
+ /// Default behavior (legacy Win95).
+ /// Expects a size of 488.
+ ///
+ Win95 = 0x0,
+
+ ///
+ /// Behavior representing Win2000 an higher.
+ /// Expects a size of 504.
+ ///
+ Win2000 = 0x3,
+
+ ///
+ /// Extended tooltip support, which is available for Vista and later.
+ ///
+ Vista = 0x4
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/ProcessDpiAwareness.cs b/ScreenToGif.Model/Enums/Native/ProcessDpiAwareness.cs
new file mode 100644
index 000000000..866e89cf1
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/ProcessDpiAwareness.cs
@@ -0,0 +1,8 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum ProcessDpiAwareness
+{
+ ProcessDpiUnaware = 0,
+ ProcessSystemDpiAware = 1,
+ ProcessPerMonitorDpiAware = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/SetWindowPosFlags.cs b/ScreenToGif.Model/Enums/Native/SetWindowPosFlags.cs
new file mode 100644
index 000000000..1ec71c2c1
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/SetWindowPosFlags.cs
@@ -0,0 +1,87 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+[Flags]
+public enum SetWindowPosFlags : uint
+{
+ ///
+ /// If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window.
+ /// This prevents the calling thread from blocking its execution while other threads process the request.
+ ///
+ AsyncWindowPositioning = 0x4000,
+
+ ///
+ /// Prevents generation of the WM_SYNCPAINT message.
+ ///
+ DeferErase = 0x2000,
+
+ ///
+ /// Draws a frame (defined in the window's class description) around the window.
+ ///
+ DrawFrame = 0x0020,
+
+ ///
+ /// Applies new frame styles set using the SetWindowLong function.
+ /// Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed.
+ /// If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
+ ///
+ FrameChanged = 0x0020,
+
+ ///
+ /// Hides the window.
+ ///
+ HideWindow = 0x0080,
+
+ ///
+ /// Does not activate the window.
+ /// If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
+ ///
+ NoActivate = 0x0010,
+
+ ///
+ /// Discards the entire contents of the client area.
+ /// If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
+ ///
+ NoCopyBits = 0x0100,
+
+ ///
+ /// Retains the current position (ignores X and Y parameters).
+ ///
+ NoMove = 0x0002,
+
+ ///
+ /// Does not change the owner window's position in the Z order.
+ ///
+ NoOwnerZOrder = 0x0200,
+
+ ///
+ /// Does not redraw changes. If this flag is set, no repainting of any kind occurs.
+ /// This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved.
+ /// When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
+ ///
+ NoRedraw = 0x0008,
+
+ ///
+ /// Same as the NoOwnerZOrder flag.
+ ///
+ NoReposition = 0x0200,
+
+ ///
+ /// Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
+ ///
+ NoSendChanging = 0x0400,
+
+ ///
+ /// Retains the current size (ignores the cx and cy parameters).
+ ///
+ NoSize = 0x0001,
+
+ ///
+ /// Retains the current Z order (ignores the hWndInsertAfter parameter).
+ ///
+ NoZOrder = 0x0004,
+
+ ///
+ /// Displays the window.
+ ///
+ ShowWindow = 0x0040
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/ShellExecuteMasks.cs b/ScreenToGif.Model/Enums/Native/ShellExecuteMasks.cs
new file mode 100644
index 000000000..12323d8e1
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/ShellExecuteMasks.cs
@@ -0,0 +1,26 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+[Flags]
+public enum ShellExecuteMasks : uint
+{
+ Default = 0x00000000,
+ ClassName = 0x00000001,
+ ClassKey = 0x00000003,
+ IdList = 0x00000004,
+ InvokeIdList = 0x0000000c, //InvokeIdList(0xC) implies IdList(0x04)
+ HotKey = 0x00000020,
+ NoCloseProcess = 0x00000040,
+ ConnectNetDrv = 0x00000080,
+ NoAsync = 0x00000100,
+ FlagDdeWait = NoAsync,
+ DeEnvSubst = 0x00000200,
+ FlagNoUi = 0x00000400,
+ Unicode = 0x00004000,
+ NoConsole = 0x00008000,
+ Asyncok = 0x00100000,
+ HMonitor = 0x00200000,
+ NoZoneChecks = 0x00800000,
+ NoQueryClassStore = 0x01000000,
+ WaitForInputIdle = 0x02000000,
+ FlagLogUsage = 0x04000000,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/ShowWindowCommands.cs b/ScreenToGif.Model/Enums/Native/ShowWindowCommands.cs
new file mode 100644
index 000000000..9fc9e1866
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/ShowWindowCommands.cs
@@ -0,0 +1,85 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum ShowWindowCommands
+{
+ ///
+ /// Hides the window and activates another window.
+ ///
+ Hide = 0,
+
+ ///
+ /// Activates and displays a window. If the window is minimized or
+ /// maximized, the system restores it to its original size and position.
+ /// An application should specify this flag when displaying the window
+ /// for the first time.
+ ///
+ Normal = 1,
+ ///
+ /// Activates the window and displays it as a minimized window.
+ ///
+ ShowMinimized = 2,
+
+ ///
+ /// Maximizes the specified window.
+ ///
+ Maximize = 3,
+
+ ///
+ /// Activates the window and displays it as a maximized window.
+ ///
+ ShowMaximized = 3,
+
+ ///
+ /// Displays a window in its most recent size and position. This value
+ /// is similar to , except
+ /// the window is not activated.
+ ///
+ ShowNoActivate = 4,
+
+ ///
+ /// Activates the window and displays it in its current size and position.
+ ///
+ Show = 5,
+
+ ///
+ /// Minimizes the specified window and activates the next top-level
+ /// window in the Z order.
+ ///
+ Minimize = 6,
+
+ ///
+ /// Displays the window as a minimized window. This value is similar to
+ /// , except the
+ /// window is not activated.
+ ///
+ ShowMinNoActive = 7,
+
+ ///
+ /// Displays the window in its current size and position. This value is
+ /// similar to , except the
+ /// window is not activated.
+ ///
+ ShowNa = 8,
+
+ ///
+ /// Activates and displays the window. If the window is minimized or
+ /// maximized, the system restores it to its original size and position.
+ /// An application should specify this flag when restoring a minimized window.
+ ///
+ Restore = 9,
+
+ ///
+ /// Sets the show state based on the SW_* value specified in the
+ /// STARTUPINFO structure passed to the CreateProcess function by the
+ /// program that started the application.
+ ///
+ ShowDefault = 10,
+
+ ///
+ /// Windows 2000/XP: Minimizes a window, even if the thread
+ /// that owns the window is not responding. This flag should only be
+ /// used when minimizing windows from a different thread.
+ ///
+ ForceMinimize = 11
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/SpecialWindowHandles.cs b/ScreenToGif.Model/Enums/Native/SpecialWindowHandles.cs
new file mode 100644
index 000000000..b5e94cf3d
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/SpecialWindowHandles.cs
@@ -0,0 +1,30 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// Special window handles.
+///
+public enum SpecialWindowHandles
+{
+ ///
+ /// Places the window at the top of the Z order.
+ ///
+ Top = 0,
+
+ ///
+ /// Places the window at the bottom of the Z order.
+ /// If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
+ ///
+ Bottom = 1,
+
+ ///
+ /// Places the window above all non-topmost windows.
+ /// The window maintains its topmost position even when it is deactivated.
+ ///
+ TopMost = -1,
+
+ ///
+ /// Places the window above all non-topmost windows (that is, behind all topmost windows).
+ /// This flag has no effect if the window is already a non-topmost window.
+ ///
+ NoTopMost = -2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/SysCommands.cs b/ScreenToGif.Model/Enums/Native/SysCommands.cs
new file mode 100644
index 000000000..c30c972ab
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/SysCommands.cs
@@ -0,0 +1,26 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum SysCommands : uint
+{
+ Size = 0xF000,
+ Move = 0xF010,
+ Minimize = 0xF020,
+ Maximize = 0xF030,
+ NextWindow = 0xF040,
+ PreviousWindow = 0xF050,
+ Close = 0xF060,
+ VScroll = 0xF070,
+ HScroll = 0xF080,
+ MouseMenu = 0xF090,
+ KeyMenu = 0xF100,
+ Arrange = 0xF110,
+ Restore = 0xF120,
+ TaskList = 0xF130,
+ ScreenSave = 0xF140,
+ HotKey = 0xF150,
+ Default = 0xF160,
+ MonitorPower = 0xF170,
+ ContextHelp = 0xF180,
+ Separator = 0xF00F,
+ IsSecure = 0x0001,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/TimeResults.cs b/ScreenToGif.Model/Enums/Native/TimeResults.cs
new file mode 100644
index 000000000..3b92bdb2e
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/TimeResults.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum TimerResults : uint
+{
+ NoError = 0,
+ NoCanDo = 97
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/WindowAttributes.cs b/ScreenToGif.Model/Enums/Native/WindowAttributes.cs
new file mode 100644
index 000000000..91b8e9a89
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/WindowAttributes.cs
@@ -0,0 +1,40 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum WindowAttributes
+{
+ ///
+ /// Sets a new address for the window procedure.
+ /// You cannot change this attribute if the window does not belong to the same process as the calling thread.
+ ///
+ GwlWndproc = -4,
+
+ ///
+ /// Sets a new application instance handle.
+ ///
+ GwlHinstance = -6,
+
+ ///
+ /// Changes the owner of a top-level window.
+ ///
+ GwlHwndparent = -8,
+
+ ///
+ /// Sets a new window style.
+ ///
+ GwlStyle = -16,
+
+ ///
+ /// Sets a new extended window style.
+ ///
+ GwlExstyle = -20,
+
+ ///
+ /// Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
+ ///
+ GwlUserdata = -21,
+
+ ///
+ /// Sets a new identifier of the child window. The window cannot be a top-level window.
+ ///
+ GwlId = -12
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/WindowStyles.cs b/ScreenToGif.Model/Enums/Native/WindowStyles.cs
new file mode 100644
index 000000000..2345e48d6
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/WindowStyles.cs
@@ -0,0 +1,28 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum WindowStyles : uint
+{
+ Overlapped = 0,
+ Popup = 0x80000000,
+ Child = 0x40000000,
+ Minimize = 0x20000000,
+ Visible = 0x10000000,
+ Disabled = 0x8000000,
+ Clipsiblings = 0x4000000,
+ Clipchildren = 0x2000000,
+ Maximize = 0x1000000,
+ Caption = 0xC00000, //WS_BORDER or WS_DLGFRAME
+ Border = 0x800000,
+ Dlgframe = 0x400000,
+ Vscroll = 0x200000,
+ Hscroll = 0x100000,
+ Sysmenu = 0x80000,
+ ThickFrame = 0x40000,
+ Group = 0x20000,
+ Tabstop = 0x10000,
+ MinimizeBox = 0x20000,
+ MaximizeBox = 0x10000,
+ Tiled = Overlapped,
+ Iconic = Minimize,
+ Sizebox = ThickFrame,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/WindowStylesEx.cs b/ScreenToGif.Model/Enums/Native/WindowStylesEx.cs
new file mode 100644
index 000000000..525f0828f
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/WindowStylesEx.cs
@@ -0,0 +1,34 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+///
+/// Extended Window Styles.
+///
+public enum WindowStylesEx : uint
+{
+ DlgModalFrame = 0x0001,
+ NoParentNotify = 0x0004,
+ TopMost = 0x0008,
+ AcceptFiles = 0x0010,
+ Transparent = 0x0020,
+ MdiChild = 0x0040,
+ ToolWindow = 0x0080,
+ WindowEdge = 0x0100,
+ ClientEdge = 0x0200,
+ ContextHelp = 0x0400,
+ Right = 0x1000,
+ Left = 0x0000,
+ RtlReading = 0x2000,
+ LtrReading = 0x0000,
+ LeftScrollbar = 0x4000,
+ RightScrollbar = 0x0000,
+ ControlParent = 0x10000,
+ StaticEdge = 0x20000,
+ AppWindow = 0x40000,
+ OverlappedWindow = (WindowEdge | ClientEdge),
+ PaletteWindow = (WindowEdge | ToolWindow | TopMost),
+ Layered = 0x00080000,
+ NoInheritLayout = 0x00100000, // Disable inheritance of mirroring by children
+ LayoutRtl = 0x00400000, // Right to left mirroring
+ Composited = 0x02000000,
+ NoActivate = 0x08000000,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Native/WindowsMessages.cs b/ScreenToGif.Model/Enums/Native/WindowsMessages.cs
new file mode 100644
index 000000000..5976867f4
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Native/WindowsMessages.cs
@@ -0,0 +1,219 @@
+namespace ScreenToGif.Domain.Enums.Native;
+
+public enum WindowsMessages
+{
+ Activate = 0x0006,
+ ActivateApp = 0x001C,
+ AfxFirst = 0x0360,
+ AfxLast = 0x037F,
+ App = 0x8000,
+ AskCbFormatName = 0x030C,
+ CancelJournal = 0x004B,
+ CancelMode = 0x001F,
+ CaptureChanged = 0x0215,
+ ChangeCbChain = 0x030D,
+ ChangeUiState = 0x0127,
+ Char = 0x0102,
+ CharToItem = 0x002F,
+ ChildActivate = 0x0022,
+ Clear = 0x0303,
+ Close = 0x0010,
+ ClipboardUpdate = 0x031D,
+ Command = 0x0111,
+ Compacting = 0x0041,
+ CompareItem = 0x0039,
+ ContextMenu = 0x007B,
+ Copy = 0x0301,
+ CopyData = 0x004A,
+ Create = 0x0001,
+ CtlColorBtn = 0x0135,
+ CtlColorDlg = 0x0136,
+ CtlColorEdit = 0x0133,
+ CtlColorListBox = 0x0134,
+ CtlColorMsgBox = 0x0132,
+ CtlColorScrollbar = 0x0137,
+ CtlColorStatic = 0x0138,
+ Cut = 0x0300,
+ DeadChar = 0x0103,
+ DeleteItem = 0x002D,
+ Destroy = 0x0002,
+ DestroyClipboard = 0x0307,
+ DeviceChange = 0x0219,
+ DevModeChange = 0x001B,
+ DisplayChange = 0x007E,
+ DrawClipboard = 0x0308,
+ DrawItem = 0x002B,
+ DropFiles = 0x0233,
+ Enable = 0x000A,
+ EndSession = 0x0016,
+ EnterIdle = 0x0121,
+ EnterMenuLoop = 0x0211,
+ EnterSizeMove = 0x0231,
+ EraseBackground = 0x0014,
+ ExitMenuLoop = 0x0212,
+ ExitSizeMove = 0x0232,
+ FontChange = 0x001D,
+ GetDialogCode = 0x0087,
+ GetFont = 0x0031,
+ GetHotkey = 0x0033,
+ GetIcon = 0x007F,
+ GetMinMaxInfo = 0x0024,
+ GetObject = 0x003D,
+ GetText = 0x000D,
+ GetTextLenght = 0x000E,
+ HandheldFirst = 0x0358,
+ HandheldLast = 0x035F,
+ Help = 0x0053,
+ Hotkey = 0x0312,
+ HorizontalScroll = 0x0114,
+ HorizontalScrollClipboard = 0x030E,
+ IconEraseBackground = 0x0027,
+ ImeChar = 0x0286,
+ ImeComposition = 0x010F,
+ ImeCompositionFull = 0x0284,
+ ImeControl = 0x0283,
+ ImeEndComposition = 0x010E,
+ ImeKeyDown = 0x0290,
+ ImeKeyLast = 0x010F,
+ ImeKeyUp = 0x0291,
+ ImeNotify = 0x0282,
+ ImeRequest = 0x0288,
+ ImeSelect = 0x0285,
+ ImeSetContent = 0x0281,
+ ImeStartComposition = 0x010D,
+ InitDialog = 0x0110,
+ InitMenu = 0x0116,
+ InitMenuPopup = 0x0117,
+ InputLanguageChange = 0x0051,
+ InputLanguageChangeRequest = 0x0050,
+ KeyDown = 0x0100,
+ KeyFirst = 0x0100,
+ KeyLast = 0x0108,
+ KeyUp = 0x0101,
+ KillFocus = 0x0008,
+ LeftDoubleClick = 0x0203,
+ LeftButtonDown = 0x0201,
+ LeftButtonUp = 0x0202,
+ MiddleDoubleClick = 0x0209,
+ MiddleButtonDown = 0x0207,
+ MiddleButtonUp = 0x0208,
+ MdiActivate = 0x0222,
+ MdiCascade = 0x0227,
+ MdiCreate = 0x0220,
+ MdiDestroy = 0x0221,
+ MdiGetActive = 0x0229,
+ MdiIconmArrange = 0x0228,
+ MdiMaximize = 0x0225,
+ MdiNext = 0x0224,
+ MdiRefreshMenu = 0x0234,
+ MdiRestore = 0x0223,
+ MdiSetMenu = 0x0230,
+ MdiTile = 0x0226,
+ MeasureItem = 0x002C,
+ MenuChar = 0x0120,
+ MenuCommand = 0x0126,
+ MenuDrag = 0x0123,
+ MenuGetObject = 0x0124,
+ MenuRightButtonUp = 0x0122,
+ MenuSelect = 0x011F,
+ MouseActivate = 0x0021,
+ MouseFirst = 0x0200,
+ MouseHover = 0x02A1,
+ MouseLast = 0x020D,
+ MouseLeave = 0x02A3,
+ MouseMove = 0x0200,
+ MouseWheel = 0x020A,
+ MouseHorizontalWheel = 0x020E,
+ Move = 0x0003,
+ Moving = 0x0216,
+ NonClientActivate = 0x0086,
+ NonClientCalculateSize = 0x0083,
+ NonClientCreate = 0x0081,
+ NonClientDestroy = 0x0082,
+ NonClientHitTest = 0x0084,
+ NonClientLeftButtonDoubleClick = 0x00A3,
+ NonClientLeftButtonDown = 0x00A1,
+ NonClientLeftButtonUp = 0x00A2,
+ NonClientMiddleButtonDoubleClick = 0x00A9,
+ NonClientMiddleButtonDown = 0x00A7,
+ NonClientMiddleButtonUp = 0x00A8,
+ NonClientMouseHover = 0x02A0,
+ NonClientMouseLeave = 0x02A2,
+ NonClientMouseMonve = 0x00A0,
+ NonClientPaint = 0x0085,
+ NonClientRightButtonDoubleClick = 0x00A6,
+ NonClientRightButtonDown = 0x00A4,
+ NonClientRightButtonUp = 0x00A5,
+ NonClientXButtonDoubleClick = 0x00AD,
+ NonClientXButtonDown = 0x00AB,
+ NonClientXButtonUp = 0x00AC,
+ NonClientUndocumentedAhDrawCaption = 0x00AE,
+ NonClientUndocumentedAhDrawFrame = 0x00AF,
+ NextDialogControl = 0x0028,
+ NextMenu = 0x0213,
+ Notify = 0x004E,
+ NotifyFormat = 0x0055,
+ Null = 0x0000,
+ Paint = 0x000F,
+ PaintClipboard = 0x0309,
+ PaintIcon = 0x0026,
+ PaletteChanged = 0x0311,
+ PaletteIsChanging = 0x0310,
+ ParentNotify = 0x0210,
+ Paste = 0x0302,
+ PenWinFirst = 0x0380,
+ PenWinLast = 0x038F,
+ Power = 0x0048,
+ PowerBroadcast = 0x0218,
+ Print = 0x0317,
+ PrintClient = 0x0318,
+ QueryDragIcon = 0x0037,
+ QueryEndSession = 0x0011,
+ QueryNewPalette = 0x030F,
+ QueryOpen = 0x0013,
+ QueueSync = 0x0023,
+ Quit = 0x0012,
+ RButtonDoubleClick = 0x0206,
+ RButtonDown = 0x0204,
+ RButtonUp = 0x0205,
+ RenderAllFormats = 0x0306,
+ RenderFormat = 0x0305,
+ SetCursor = 0x0020,
+ SetFocus = 0x0007,
+ SetFont = 0x0030,
+ SetHotKey = 0x0032,
+ SetIcon = 0x0080,
+ SetRedraw = 0x000B,
+ SetText = 0x000C,
+ SettingChange = 0x001A,
+ ShowWindow = 0x0018,
+ Size = 0x0005,
+ SizeClipboard = 0x030B,
+ Sizing = 0x0214,
+ SpoolerStatus = 0x002A,
+ StyleChanged = 0x007D,
+ StyleChanging = 0x007C,
+ SyncPaint = 0x0088,
+ SysChar = 0x0106,
+ SysColorChange = 0x0015,
+ SysCommand = 0x0112,
+ SysDeadChar = 0x0107,
+ SysKeyDown = 0x0104,
+ SysKeyUp = 0x0105,
+ TrainingCard = 0x0052,
+ TimeChange = 0x001E,
+ Timer = 0x0113,
+ Undo = 0x0304,
+ UnInitMenuPopup = 0x0125,
+ User = 0x0400,
+ UserChanged = 0x0054,
+ VKeyToItem = 0x002E,
+ VerticalScroll = 0x0115,
+ VerticalScrollClipboard = 0x030A,
+ WindowPositionChanged = 0x0047,
+ WindowPositionChanging = 0x0046,
+ WinIniChange = 0x001A,
+ XButtonDoubleClick = 0x020D,
+ XButtonDown = 0x020B,
+ XButtonUp = 0x020C,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ObfuscationModes.cs b/ScreenToGif.Model/Enums/ObfuscationModes.cs
new file mode 100644
index 000000000..41f88df21
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ObfuscationModes.cs
@@ -0,0 +1,9 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum ObfuscationModes
+{
+ Pixelation,
+ Blur,
+ Darken,
+ Lighten
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/OverwriteModes.cs b/ScreenToGif.Model/Enums/OverwriteModes.cs
new file mode 100644
index 000000000..8abf4c0b9
--- /dev/null
+++ b/ScreenToGif.Model/Enums/OverwriteModes.cs
@@ -0,0 +1,8 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum OverwriteModes
+{
+ Allow,
+ Warn,
+ Prompt
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/PanelType.cs b/ScreenToGif.Model/Enums/PanelType.cs
new file mode 100644
index 000000000..41113f3a6
--- /dev/null
+++ b/ScreenToGif.Model/Enums/PanelType.cs
@@ -0,0 +1,145 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The types of Panel of the Editor window.
+/// Positive values means that there's no preview overlay.
+///
+public enum PanelTypes
+{
+ ///
+ /// Save As Panel.
+ ///
+ SaveAs = 1,
+
+ ///
+ /// New Animation Panel.
+ ///
+ NewAnimation = 2,
+
+ ///
+ /// Clipboard Panel.
+ ///
+ Clipboard = 3,
+
+ ///
+ /// Resize Panel.
+ ///
+ Resize = 4,
+
+ ///
+ /// Flip/Rotate Panel.
+ ///
+ FlipRotate = 5,
+
+ ///
+ /// Override Delay Panel.
+ ///
+ OverrideDelay = 6,
+
+ ///
+ /// Change Delay Panel.
+ ///
+ IncreaseDecreaseDelay = 7,
+
+ ScaleDelay = 8,
+
+ ///
+ /// Fade Transition Panel.
+ ///
+ Fade = 9,
+
+ ///
+ /// Slide Transition Panel.
+ ///
+ Slide = 10,
+
+ ///
+ /// Reduce Frame Count Panel.
+ ///
+ ReduceFrames = 11,
+
+ ///
+ /// Load Recent Panel.
+ ///
+ LoadRecent = 12,
+
+ ///
+ /// Remove Duplicates Panel.
+ ///
+ RemoveDuplicates = 13,
+
+ ///
+ /// Mouse Events Panel.
+ ///
+ MouseEvents = 14,
+
+ ///
+ /// Smooth Loop Panel.
+ ///
+ SmoothLoop = 15,
+
+ ///
+ /// Crop Panel.
+ ///
+ Crop = -1,
+
+ ///
+ /// Caption Panel.
+ ///
+ Caption = -2,
+
+ ///
+ /// Free Text Panel.
+ ///
+ FreeText = -3,
+
+ ///
+ /// Title Frame Panel.
+ ///
+ TitleFrame = -4,
+
+ ///
+ /// Free Drawing Panel.
+ ///
+ FreeDrawing = -5,
+
+ ///
+ /// Shapes Panel.
+ ///
+ Shapes = -6,
+
+ ///
+ /// Watermark Panel.
+ ///
+ Watermark = -7,
+
+ ///
+ /// Border Panel.
+ ///
+ Border = -8,
+
+ ///
+ /// Cinemagraph Panel.
+ ///
+ Cinemagraph = -9,
+
+ ///
+ /// Progress Panel.
+ ///
+ Progress = -10,
+
+ ///
+ /// Key Strokes Panel.
+ ///
+ KeyStrokes = -11,
+
+ ///
+ /// Obfuscate Panel.
+ ///
+ Obfuscate = -12,
+
+ ///
+ /// Shadow Panel.
+ ///
+ Shadow = -13,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/PartialExportModes.cs b/ScreenToGif.Model/Enums/PartialExportModes.cs
new file mode 100644
index 000000000..b19ff06a3
--- /dev/null
+++ b/ScreenToGif.Model/Enums/PartialExportModes.cs
@@ -0,0 +1,24 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum PartialExportModes
+{
+ ///
+ /// An expression like '4, 5, 9 - 11'.
+ ///
+ FrameExpression,
+
+ ///
+ /// Start and end frame number.
+ ///
+ FrameRange,
+
+ ///
+ /// Start and end times.
+ ///
+ TimeRange,
+
+ ///
+ /// All selected frames in the timeline.
+ ///
+ Selection
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/PasteBehaviors.cs b/ScreenToGif.Model/Enums/PasteBehaviors.cs
new file mode 100644
index 000000000..703505fec
--- /dev/null
+++ b/ScreenToGif.Model/Enums/PasteBehaviors.cs
@@ -0,0 +1,17 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Paste behavior for the editor.
+///
+public enum PasteBehaviors
+{
+ ///
+ /// It will paste before the selected frame.
+ ///
+ BeforeSelected,
+
+ ///
+ /// It will paste after the selected frame.
+ ///
+ AfterSelected
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/PredictionMethods.cs b/ScreenToGif.Model/Enums/PredictionMethods.cs
new file mode 100644
index 000000000..aa6842518
--- /dev/null
+++ b/ScreenToGif.Model/Enums/PredictionMethods.cs
@@ -0,0 +1,14 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Png prediction methods used by FFmpeg.
+///
+public enum PredictionMethods
+{
+ None,
+ Sub,
+ Up,
+ Avg,
+ Paeth,
+ Mixed
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ProgressTypes.cs b/ScreenToGif.Model/Enums/ProgressTypes.cs
new file mode 100644
index 000000000..f7e2fac64
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ProgressTypes.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Type of the progress indicator.
+///
+public enum ProgressTypes
+{
+ Bar,
+ Text
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ProjectByType.cs b/ScreenToGif.Model/Enums/ProjectByType.cs
new file mode 100644
index 000000000..0041a0253
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ProjectByType.cs
@@ -0,0 +1,13 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The types of source of project creation.
+///
+public enum ProjectByType
+{
+ Unknown = 0,
+ ScreenRecorder = 1,
+ WebcamRecorder = 2,
+ BoardRecorder = 3,
+ Editor = 4
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ProxyTypes.cs b/ScreenToGif.Model/Enums/ProxyTypes.cs
new file mode 100644
index 000000000..1e12d36b2
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ProxyTypes.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The proxy method, used for uploading files.
+///
+public enum ProxyTypes
+{
+ Disabled = 0,
+ Manual = 1,
+ System = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/RateUnits.cs b/ScreenToGif.Model/Enums/RateUnits.cs
new file mode 100644
index 000000000..cc35b089f
--- /dev/null
+++ b/ScreenToGif.Model/Enums/RateUnits.cs
@@ -0,0 +1,15 @@
+using System.ComponentModel;
+
+namespace ScreenToGif.Domain.Enums;
+
+public enum RateUnits
+{
+ [Description("B")]
+ Bits,
+
+ [Description("K")]
+ Kilobits,
+
+ [Description("M")]
+ Megabits
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/RecorderStages.cs b/ScreenToGif.Model/Enums/RecorderStages.cs
new file mode 100644
index 000000000..850389e5e
--- /dev/null
+++ b/ScreenToGif.Model/Enums/RecorderStages.cs
@@ -0,0 +1,41 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Stage status of the recording process.
+///
+[Flags]
+public enum RecorderStages
+{
+ ///
+ /// Recording stopped.
+ ///
+ Stopped = 1, //1 << 0, 0b_000001
+
+ ///
+ /// Recording active.
+ ///
+ Recording = 2, //1 << 1, 0b_000010
+
+ ///
+ /// Recording paused.
+ ///
+ Paused = 4, //1 << 2, 0b_000100
+
+ ///
+ /// Pre start countdown active.
+ ///
+ PreStarting = 8, //1 << 3, 0b_001000
+
+ ///
+ /// The recording is being discarded.
+ ///
+ Discarding = 16, //1 << 4, 0b_010000
+
+
+
+ ///
+ /// Single shot mode.
+ ///
+ [Obsolete]
+ Snapping = 32, //1 << 5, 0b_100000 //Remove later.
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ReduceDelayModes.cs b/ScreenToGif.Model/Enums/ReduceDelayModes.cs
new file mode 100644
index 000000000..63e2f2ee2
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ReduceDelayModes.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Specifies the frame delay adjustment mode for the 'Reduce Framerate'.
+///
+public enum ReduceDelayModes
+{
+ DontAdjust = 0,
+ Previous = 1,
+ Evenly = 2
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ResizeDirection.cs b/ScreenToGif.Model/Enums/ResizeDirection.cs
new file mode 100644
index 000000000..eda6c3458
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ResizeDirection.cs
@@ -0,0 +1,16 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The direction in which the window should be resized.
+///
+public enum ResizeDirection
+{
+ Left = 1,
+ Right = 2,
+ Top = 3,
+ TopLeft = 4,
+ TopRight = 5,
+ Bottom = 6,
+ BottomLeft = 7,
+ BottomRight = 8
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/ScalingMethod.cs b/ScreenToGif.Model/Enums/ScalingMethod.cs
new file mode 100644
index 000000000..c7c39362c
--- /dev/null
+++ b/ScreenToGif.Model/Enums/ScalingMethod.cs
@@ -0,0 +1,13 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Scaling quality options for resizing
+/// This enum is a subset of .
+/// It is used to expose this enum to the Editor and choose which options are available
+///
+public enum ScalingMethod
+{
+ Fant = System.Windows.Media.BitmapScalingMode.Fant,
+ Linear = System.Windows.Media.BitmapScalingMode.Linear,
+ NearestNeighbor = System.Windows.Media.BitmapScalingMode.NearestNeighbor
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/SizeUnits.cs b/ScreenToGif.Model/Enums/SizeUnits.cs
new file mode 100644
index 000000000..eed883037
--- /dev/null
+++ b/ScreenToGif.Model/Enums/SizeUnits.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum SizeUnits
+{
+ Pixels,
+ Percent
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/SlideFromType.cs b/ScreenToGif.Model/Enums/SlideFromType.cs
new file mode 100644
index 000000000..26b27b302
--- /dev/null
+++ b/ScreenToGif.Model/Enums/SlideFromType.cs
@@ -0,0 +1,12 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Transition animation.
+///
+public enum SlideFromType
+{
+ Right,
+ Top,
+ Left,
+ Bottom
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/SmoothLoopSelectionModes.cs b/ScreenToGif.Model/Enums/SmoothLoopSelectionModes.cs
new file mode 100644
index 000000000..44d479749
--- /dev/null
+++ b/ScreenToGif.Model/Enums/SmoothLoopSelectionModes.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum SmoothLoopFromModes
+{
+ End = 0,
+ Start = 1
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/StatusReason.cs b/ScreenToGif.Model/Enums/StatusReason.cs
new file mode 100644
index 000000000..356a8c29f
--- /dev/null
+++ b/ScreenToGif.Model/Enums/StatusReason.cs
@@ -0,0 +1,13 @@
+namespace ScreenToGif.Domain.Enums
+{
+ public enum StatusReasons : int
+ {
+ None,
+ EmptyProperty,
+ InvalidState,
+ FileAlreadyExists,
+ MissingFfmpeg,
+ MissingGifski,
+ UploadServiceUnauthorized
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/StatusType.cs b/ScreenToGif.Model/Enums/StatusType.cs
new file mode 100644
index 000000000..0c6e4dd1d
--- /dev/null
+++ b/ScreenToGif.Model/Enums/StatusType.cs
@@ -0,0 +1,10 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum StatusType : int
+{
+ None = 0,
+ Info,
+ Update,
+ Warning,
+ Error
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/SupportedFFmpegVersions.cs b/ScreenToGif.Model/Enums/SupportedFFmpegVersions.cs
new file mode 100644
index 000000000..980b79c46
--- /dev/null
+++ b/ScreenToGif.Model/Enums/SupportedFFmpegVersions.cs
@@ -0,0 +1,9 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum SupportedFFmpegVersions
+{
+ Version7 = -1,
+ Version6 = 0,
+ Version5 = 1,
+ Version4 = 2,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/TaskTypes.cs b/ScreenToGif.Model/Enums/TaskTypes.cs
new file mode 100644
index 000000000..8980c4b2c
--- /dev/null
+++ b/ScreenToGif.Model/Enums/TaskTypes.cs
@@ -0,0 +1,16 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum TaskTypes
+{
+ NotDeclared = 0,
+ MouseEvents = 1,
+ KeyStrokes = 2,
+ Delay = 3,
+ Progress = 4,
+ Border = 5,
+ Shadow = 6,
+ RemoveDuplicates = 7,
+ Watermark = 8,
+ TitleFrame = 9,
+ Resize = 10,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/UploadDestinations.cs b/ScreenToGif.Model/Enums/UploadDestinations.cs
new file mode 100644
index 000000000..1e3f275ad
--- /dev/null
+++ b/ScreenToGif.Model/Enums/UploadDestinations.cs
@@ -0,0 +1,13 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// Upload destination type.
+///
+public enum UploadDestinations
+{
+ NotDefined = 0,
+ Imgur,
+ Yandex = 3,
+ YouTrack,
+ Custom
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/UploadService.cs b/ScreenToGif.Model/Enums/UploadService.cs
new file mode 100644
index 000000000..80c7e2d98
--- /dev/null
+++ b/ScreenToGif.Model/Enums/UploadService.cs
@@ -0,0 +1,12 @@
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// The upload service.
+///
+public enum UploadService
+{
+ None = 0,
+ ImgurAnonymous = 1,
+ Imgur = 2,
+ Yandex = 5,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/VideoCodecPresets.cs b/ScreenToGif.Model/Enums/VideoCodecPresets.cs
new file mode 100644
index 000000000..88d977e41
--- /dev/null
+++ b/ScreenToGif.Model/Enums/VideoCodecPresets.cs
@@ -0,0 +1,41 @@
+using System.Diagnostics.CodeAnalysis;
+
+namespace ScreenToGif.Domain.Enums;
+
+[SuppressMessage("ReSharper", "InconsistentNaming")]
+public enum VideoCodecPresets
+{
+ Auto = -1,
+ NotSelected,
+ None,
+
+ VerySlow,
+ Slower,
+ Slow,
+ Medium,
+ Fast,
+ Faster,
+ VeryFast,
+ SuperFast,
+ UltraFast,
+
+ Quality,
+ Balanced,
+ Speed,
+
+ Default,
+ Lossless,
+ LosslessHP,
+ HP,
+ HQ,
+ BD,
+ LowLatency,
+ LowLatencyHP,
+ LowLatencyHQ,
+
+ Picture, //Digital picture, like portrait, inner shot.
+ Photo, //Outdoor photograph, with natural lighting.
+ Drawing, //Hand or line drawing, with high-contrast details.
+ Icon, //Small-sized colorful images.
+ Text //Text-like.
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/VideoCodecs.cs b/ScreenToGif.Model/Enums/VideoCodecs.cs
new file mode 100644
index 000000000..c27fcbb37
--- /dev/null
+++ b/ScreenToGif.Model/Enums/VideoCodecs.cs
@@ -0,0 +1,53 @@
+using System.ComponentModel;
+
+namespace ScreenToGif.Domain.Enums;
+
+public enum VideoCodecs
+{
+ NotSelected,
+
+ [Description("mpeg2video")]
+ Mpeg2,
+
+ [Description("mpeg4")]
+ Mpeg4,
+
+ [Description("libx264")]
+ X264,
+
+ [Description("h264_amf")]
+ H264Amf,
+
+ [Description("h264_nvenc")]
+ H264Nvenc,
+
+ [Description("h264_qsv")]
+ H264Qsv,
+
+ [Description("libx265")]
+ X265,
+
+ [Description("hevc_amf")]
+ HevcAmf,
+
+ [Description("hevc_nvenc")]
+ HevcNvenc,
+
+ [Description("hevc_qsv")]
+ HevcQsv,
+
+ [Description("libvpx")]
+ Vp8,
+
+ [Description("libvpx-vp9")]
+ Vp9,
+
+ [Description("libaom-av1")]
+ LibAom,
+
+ [Description("libsvtav1")]
+ SvtAv1,
+
+ [Description("librav1e")]
+ Rav1E,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/VideoPixelFormats.cs b/ScreenToGif.Model/Enums/VideoPixelFormats.cs
new file mode 100644
index 000000000..1d4ffc2fa
--- /dev/null
+++ b/ScreenToGif.Model/Enums/VideoPixelFormats.cs
@@ -0,0 +1,62 @@
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+
+namespace ScreenToGif.Domain.Enums;
+
+///
+/// FFmpeg pixel formats.
+/// https://github.com/FFmpeg/FFmpeg/blob/b7b73e83e3d5c78a5fea96a6bcae02e1f0a5c45f/libavutil/pixdesc.c
+///
+[SuppressMessage("ReSharper", "InconsistentNaming")]
+public enum VideoPixelFormats
+{
+ NotSelected,
+ Auto,
+ Bgr0,
+ [Description("bgr4_byte")] Bgr4Byte, //https://stackoverflow.com/questions/8588384/how-to-define-an-enum-with-string-value
+ Bgr8,
+ BgrA,
+ Cuda,
+ D3D11,
+ Dxva2Vld,
+ Gbrp,
+ Gbrp10Le,
+ Gbrp12Le,
+ Gray,
+ Gray10Le,
+ Gray12Le,
+ Gray16Be,
+ MonoB,
+ Nv12,
+ Nv16,
+ Nv20Le,
+ Nv21,
+ P010Le,
+ Pal8,
+ Qsv,
+ Rgb24,
+ Rgb48Be,
+ Rgb8,
+ Rgba64Be,
+ RgbA,
+ [Description("bgr4_byte")] Rgb4Byte,
+ Ya8,
+ Ya16Be,
+ Yuv420p,
+ Yuv420p10Le,
+ Yuv420p12Le,
+ Yuv422p,
+ Yuv422p10Le,
+ Yuv422p12Le,
+ Yuv440p,
+ Yuv444p,
+ Yuv440p10Le,
+ Yuv440p12Le,
+ Yuv444p10Le,
+ Yuv444p12Le,
+ Yuv444p16Le,
+ Yuva420p,
+ Yuvj420p,
+ Yuvj422p,
+ Yuvj444p,
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/VideoSettingsModes.cs b/ScreenToGif.Model/Enums/VideoSettingsModes.cs
new file mode 100644
index 000000000..67f738bd3
--- /dev/null
+++ b/ScreenToGif.Model/Enums/VideoSettingsModes.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum VideoSettingsModes
+{
+ Normal,
+ Advanced
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Enums/Vsyncs.cs b/ScreenToGif.Model/Enums/Vsyncs.cs
new file mode 100644
index 000000000..1d082e0ff
--- /dev/null
+++ b/ScreenToGif.Model/Enums/Vsyncs.cs
@@ -0,0 +1,11 @@
+namespace ScreenToGif.Domain.Enums;
+
+public enum Vsyncs
+{
+ Off,
+ Auto,
+ Passthrough,
+ Cfr,
+ Vfr,
+ Drop
+}
\ No newline at end of file
diff --git a/ScreenToGif/Util/InputHook/CustomKeyEventArgs.cs b/ScreenToGif.Model/Events/CustomKeyEventArgs.cs
similarity index 90%
rename from ScreenToGif/Util/InputHook/CustomKeyEventArgs.cs
rename to ScreenToGif.Model/Events/CustomKeyEventArgs.cs
index e08bfd3d2..05436f01a 100644
--- a/ScreenToGif/Util/InputHook/CustomKeyEventArgs.cs
+++ b/ScreenToGif.Model/Events/CustomKeyEventArgs.cs
@@ -1,7 +1,6 @@
-using System;
using System.Windows.Input;
-namespace ScreenToGif.Util.InputHook
+namespace ScreenToGif.Domain.Events
{
///
/// Custom Key Event Args.
diff --git a/ScreenToGif/Util/InputHook/CustomKeyPressEventArgs.cs b/ScreenToGif.Model/Events/CustomKeyPressEventArgs.cs
similarity index 92%
rename from ScreenToGif/Util/InputHook/CustomKeyPressEventArgs.cs
rename to ScreenToGif.Model/Events/CustomKeyPressEventArgs.cs
index b103ccb78..785b37bfb 100644
--- a/ScreenToGif/Util/InputHook/CustomKeyPressEventArgs.cs
+++ b/ScreenToGif.Model/Events/CustomKeyPressEventArgs.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace ScreenToGif.Util.InputHook
+namespace ScreenToGif.Domain.Events
{
///
/// Custom KeyPress Event Args
diff --git a/ScreenToGif.Model/Events/ManipulatedEventArgs.cs b/ScreenToGif.Model/Events/ManipulatedEventArgs.cs
new file mode 100644
index 000000000..4aa92f6e0
--- /dev/null
+++ b/ScreenToGif.Model/Events/ManipulatedEventArgs.cs
@@ -0,0 +1,40 @@
+using System.Windows;
+
+namespace ScreenToGif.Domain.Events;
+
+public delegate void ManipulatedEventHandler(object sender, ManipulatedEventArgs args);
+
+public class ManipulatedEventArgs : RoutedEventArgs
+{
+ public double AngleDifference { get; private set; }
+
+ public double WidthDifference { get; private set; }
+
+ public double HeightDifference { get; private set; }
+
+ public double TopDifference { get; private set; }
+
+ public double LeftDifference { get; private set; }
+
+ public ManipulatedEventArgs(RoutedEvent routedEvent, double angleDifference, double widthDifference, double heightDifference, double topDifference, double leftDifference) : base(routedEvent)
+ {
+ AngleDifference = angleDifference;
+ WidthDifference = widthDifference;
+ HeightDifference = heightDifference;
+ TopDifference = topDifference;
+ LeftDifference = leftDifference;
+ }
+
+ public ManipulatedEventArgs(RoutedEvent routedEvent, double angleDifference) : base(routedEvent)
+ {
+ AngleDifference = angleDifference;
+ }
+
+ public ManipulatedEventArgs(RoutedEvent routedEvent, double widthDifference, double heightDifference, double topDifference, double leftDifference) : base(routedEvent)
+ {
+ WidthDifference = widthDifference;
+ HeightDifference = heightDifference;
+ TopDifference = topDifference;
+ LeftDifference = leftDifference;
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif/Model/Events/SaveEventArgs.cs b/ScreenToGif.Model/Events/SaveEventArgs.cs
similarity index 82%
rename from ScreenToGif/Model/Events/SaveEventArgs.cs
rename to ScreenToGif.Model/Events/SaveEventArgs.cs
index 970908b18..8f7f2c543 100644
--- a/ScreenToGif/Model/Events/SaveEventArgs.cs
+++ b/ScreenToGif.Model/Events/SaveEventArgs.cs
@@ -1,6 +1,6 @@
using System.Windows;
-namespace ScreenToGif.Model.Events
+namespace ScreenToGif.Domain.Events
{
public class SaveEventArgs : RoutedEventArgs
{
diff --git a/ScreenToGif/Model/Events/ValidatedEventArgs.cs b/ScreenToGif.Model/Events/ValidatedEventArgs.cs
similarity index 90%
rename from ScreenToGif/Model/Events/ValidatedEventArgs.cs
rename to ScreenToGif.Model/Events/ValidatedEventArgs.cs
index e5fde88f5..592406fe7 100644
--- a/ScreenToGif/Model/Events/ValidatedEventArgs.cs
+++ b/ScreenToGif.Model/Events/ValidatedEventArgs.cs
@@ -1,15 +1,14 @@
-using System;
using System.Windows;
-using ScreenToGif.Util;
+using ScreenToGif.Domain.Enums;
-namespace ScreenToGif.Model.Events
+namespace ScreenToGif.Domain.Events
{
public delegate void ValidatedEventHandler(object sender, ValidatedEventArgs e);
public class ValidatedEventArgs : RoutedEventArgs
{
public string MessageKey { get; set; }
-
+
public StatusReasons Reason { get; set; }
public Action Action { get; set; }
diff --git a/ScreenToGif.Model/Exceptions/GraphicsConfigurationException.cs b/ScreenToGif.Model/Exceptions/GraphicsConfigurationException.cs
new file mode 100644
index 000000000..6ea28d0cd
--- /dev/null
+++ b/ScreenToGif.Model/Exceptions/GraphicsConfigurationException.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Exceptions;
+
+public class GraphicsConfigurationException : Exception
+{
+ public GraphicsConfigurationException(string message, Exception exception) : base(message, exception)
+ { }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Exceptions/SettingsPersistenceException.cs b/ScreenToGif.Model/Exceptions/SettingsPersistenceException.cs
new file mode 100644
index 000000000..5ad504e10
--- /dev/null
+++ b/ScreenToGif.Model/Exceptions/SettingsPersistenceException.cs
@@ -0,0 +1,19 @@
+using System.Windows;
+
+namespace ScreenToGif.Domain.Exceptions;
+
+public sealed class SettingsPersistenceException : Exception
+{
+ public ResourceDictionary ResourceDictionary { get; }
+
+ public bool IsLocal { get; }
+
+ public SettingsPersistenceException()
+ { }
+
+ public SettingsPersistenceException(ResourceDictionary resourceDictionary, bool isLocal)
+ {
+ ResourceDictionary = resourceDictionary;
+ IsLocal = isLocal;
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Exceptions/UploadException.cs b/ScreenToGif.Model/Exceptions/UploadException.cs
new file mode 100644
index 000000000..75a6e14c0
--- /dev/null
+++ b/ScreenToGif.Model/Exceptions/UploadException.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace ScreenToGif.Cloud
+{
+ public class UploadException : Exception
+ {
+ public UploadException() : base("Uploading failed")
+ { }
+
+ public UploadException(string message) : base(message)
+ { }
+
+ public UploadException(string message, Exception innerException) : base(message, innerException)
+ { }
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif/Interfaces/IExportPreset.cs b/ScreenToGif.Model/Interfaces/IExportPreset.cs
similarity index 72%
rename from ScreenToGif/Interfaces/IExportPreset.cs
rename to ScreenToGif.Model/Interfaces/IExportPreset.cs
index 18dabf66c..ba7553d07 100644
--- a/ScreenToGif/Interfaces/IExportPreset.cs
+++ b/ScreenToGif.Model/Interfaces/IExportPreset.cs
@@ -1,20 +1,20 @@
-using ScreenToGif.Util;
+using ScreenToGif.Domain.Enums;
-namespace ScreenToGif.Interfaces
+namespace ScreenToGif.Domain.Interfaces
{
public interface IExportPreset : IPreset
{
string TitleKey { get; set; }
string DescriptionKey { get; set; }
- Export Type { get; set; }
+ ExportFormats Type { get; set; }
bool PickLocation { get; set; }
- bool OverwriteOnSave { get; set; }
+ OverwriteModes OverwriteMode { get; set; }
bool ExportAsProjectToo { get; set; }
bool UploadFile { get; set; }
string UploadService { get; set; }
-
+
bool ExportPartially { get; set; }
- PartialExportType PartialExport { get; set; }
+ PartialExportModes PartialExport { get; set; }
string PartialExportFrameExpression { get; set; }
string OutputFolder { get; set; }
diff --git a/ScreenToGif.Model/Interfaces/IFfmpegPreset.cs b/ScreenToGif.Model/Interfaces/IFfmpegPreset.cs
new file mode 100644
index 000000000..8799987b2
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IFfmpegPreset.cs
@@ -0,0 +1,11 @@
+using ScreenToGif.Domain.Enums;
+
+namespace ScreenToGif.Domain.Interfaces
+{
+ public interface IFfmpegPreset
+ {
+ VideoSettingsModes SettingsMode { get; set; }
+
+ string Parameters { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Interfaces/IFrame.cs b/ScreenToGif.Model/Interfaces/IFrame.cs
new file mode 100644
index 000000000..effd62405
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IFrame.cs
@@ -0,0 +1,38 @@
+using ScreenToGif.Domain.Enums;
+using System.Windows;
+using System.Windows.Media;
+
+namespace ScreenToGif.Domain.Interfaces;
+
+public interface IFrame
+{
+ public string Path { get; set; }
+
+ public string Name { get; set; }
+
+ public int Delay { get; set; }
+
+ public int CursorX { get; set; }
+
+ public int CursorY { get; set; }
+
+ public MouseButtons ButtonClicked { get; set; }
+
+ public bool WasClicked { get; set; }
+
+ public int Index { get; set; }
+
+ public Int32Rect Rect { get; set; }
+
+ public Color ColorKey { get; set; }
+
+ public bool HasArea => Rect.HasArea;
+
+ public List KeyList { get; set; }
+
+ public byte[] Data { get; set; }
+
+ public bool FrameSkipped { get; set; }
+
+ public long DataLength { get; set; }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Interfaces/IHistory.cs b/ScreenToGif.Model/Interfaces/IHistory.cs
new file mode 100644
index 000000000..c93189338
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IHistory.cs
@@ -0,0 +1,33 @@
+using System.Windows.Documents;
+using ScreenToGif.Domain.Enums;
+
+namespace ScreenToGif.Domain.Interfaces;
+
+public interface IHistory
+{
+ public UploadDestinations Type { get; set; }
+
+ public string PresetName { get; set; }
+
+ public DateTime? DateInUtc { get; set; }
+
+ public DateTime? DateInLocalTime { get; }
+
+ public int Result { get; set; }
+
+ public bool WasSuccessful { get; }
+
+ public long Size { get; set; }
+
+ public TimeSpan? Duration { get; set; }
+
+ public string Link { get; set; }
+
+ public string DeletionLink { get; set; }
+
+ public string Message { get; set; }
+
+ public FlowDocument Content { get; }
+
+ public string GetLink(IPreset preset);
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Interfaces/IKeyGesture.cs b/ScreenToGif.Model/Interfaces/IKeyGesture.cs
new file mode 100644
index 000000000..de836736b
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IKeyGesture.cs
@@ -0,0 +1,12 @@
+using System.Windows.Input;
+
+namespace ScreenToGif.Domain.Interfaces;
+
+public interface IKeyGesture
+{
+ public ModifierKeys Modifiers { get; set; }
+ public Key Key { get; set; }
+ public bool IsUppercase { get; set; }
+ public bool IsInjected { get; set; }
+ public string DisplayString { get; }
+}
\ No newline at end of file
diff --git a/ScreenToGif/Interfaces/IPanel.cs b/ScreenToGif.Model/Interfaces/IPanel.cs
similarity index 53%
rename from ScreenToGif/Interfaces/IPanel.cs
rename to ScreenToGif.Model/Interfaces/IPanel.cs
index 06829ab72..dbd8b193a 100644
--- a/ScreenToGif/Interfaces/IPanel.cs
+++ b/ScreenToGif.Model/Interfaces/IPanel.cs
@@ -1,6 +1,4 @@
-using System.Threading.Tasks;
-
-namespace ScreenToGif.Interfaces
+namespace ScreenToGif.Domain.Interfaces
{
public interface IPanel
{
diff --git a/ScreenToGif.Model/Interfaces/IPersistent.cs b/ScreenToGif.Model/Interfaces/IPersistent.cs
new file mode 100644
index 000000000..1a2fd70ef
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IPersistent.cs
@@ -0,0 +1,7 @@
+namespace ScreenToGif.Domain.Interfaces
+{
+ public interface IPersistent
+ {
+ void Persist();
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif/Interfaces/IPreset.cs b/ScreenToGif.Model/Interfaces/IPreset.cs
similarity index 64%
rename from ScreenToGif/Interfaces/IPreset.cs
rename to ScreenToGif.Model/Interfaces/IPreset.cs
index dac158e56..4daed4d8a 100644
--- a/ScreenToGif/Interfaces/IPreset.cs
+++ b/ScreenToGif.Model/Interfaces/IPreset.cs
@@ -1,7 +1,6 @@
-using System.Threading.Tasks;
-using ScreenToGif.Model.Events;
+using ScreenToGif.Domain.Events;
-namespace ScreenToGif.Interfaces
+namespace ScreenToGif.Domain.Interfaces
{
public interface IPreset
{
diff --git a/ScreenToGif.Model/Interfaces/IUploadPreset.cs b/ScreenToGif.Model/Interfaces/IUploadPreset.cs
new file mode 100644
index 000000000..5fd0e4f78
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IUploadPreset.cs
@@ -0,0 +1,40 @@
+using System.Collections;
+using System.Windows;
+using ScreenToGif.Domain.Enums;
+
+namespace ScreenToGif.Domain.Interfaces;
+
+public interface IUploadPreset : IPreset
+{
+ public UploadDestinations Type { get; set; }
+
+ public bool IsEnabled { get; set; }
+
+ public string ImageId { get; set; }
+
+ public bool IsAnonymous { get; set; }
+
+ public ArrayList History { get; set; }
+
+ public List AllowedTypes { get; set; }
+
+ public string TypeName { get; }
+
+ public bool HasLimit { get; }
+
+ public bool HasSizeLimit { get; }
+
+ public bool HasDurationLimit { get; }
+
+ public bool HasResolutionLimit { get; }
+
+ public long? SizeLimit { get; }
+
+ public TimeSpan? DurationLimit { get; }
+
+ public Size? ResolutionLimit { get; }
+
+ public string Limit { get; }
+
+ public string Mode { get; }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Interfaces/IUploader.cs b/ScreenToGif.Model/Interfaces/IUploader.cs
new file mode 100644
index 000000000..78143eeb4
--- /dev/null
+++ b/ScreenToGif.Model/Interfaces/IUploader.cs
@@ -0,0 +1,14 @@
+namespace ScreenToGif.Domain.Interfaces;
+
+public interface IUploader
+{
+ ///
+ /// Upload the file to the cloud service.
+ ///
+ /// The upload preset with the configurations necessary for the upload.
+ /// Path of file.
+ ///
+ ///
+ /// The upload details.
+ Task UploadFileAsync(IUploadPreset preset, string path, CancellationToken cancellationToken, IProgress progressCallback = null);
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Models/DetectedRegion.cs b/ScreenToGif.Model/Models/DetectedRegion.cs
new file mode 100644
index 000000000..09b04f3ba
--- /dev/null
+++ b/ScreenToGif.Model/Models/DetectedRegion.cs
@@ -0,0 +1,25 @@
+using System.Windows;
+
+namespace ScreenToGif.Domain.Models;
+
+public class DetectedRegion
+{
+ public IntPtr Handle { get; private set; }
+
+ public Rect Bounds { get; set; }
+
+ public string Name { get; private set; }
+
+ ///
+ /// The Z-Index of the window, higher means that the window will be on top.
+ ///
+ public int Order { get; private set; }
+
+ public DetectedRegion(IntPtr handle, Rect bounds, string name, int order = 0)
+ {
+ Handle = handle;
+ Bounds = bounds;
+ Name = name;
+ Order = order;
+ }
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Models/ExportFrame.cs b/ScreenToGif.Model/Models/ExportFrame.cs
new file mode 100644
index 000000000..1796c7d92
--- /dev/null
+++ b/ScreenToGif.Model/Models/ExportFrame.cs
@@ -0,0 +1,41 @@
+using System.Windows;
+
+namespace ScreenToGif.Domain.Models;
+
+public class ExportFrame
+{
+ ///
+ /// The position of the frame within the list.
+ ///
+ public int Index { get; set; }
+
+ ///
+ /// The position of the frame on the pixel array.
+ ///
+ public long DataPosition { get; set; }
+
+ ///
+ /// The pixel array data length of the frame.
+ ///
+ public long DataLength { get; set; }
+
+ ///
+ /// The delay of the frame.
+ ///
+ public int Delay { get; set; }
+
+ ///
+ /// The Rectangle of the frame.
+ ///
+ public Int32Rect Rect { get; set; }
+
+ ///
+ /// The depth in bits of the frame.
+ ///
+ public int ImageDepth { get; set; }
+
+ ///
+ /// True if the frame has area, width and height > 0.
+ ///
+ public bool HasArea => Rect.HasArea;
+}
\ No newline at end of file
diff --git a/ScreenToGif.Model/Models/ExportProject.cs b/ScreenToGif.Model/Models/ExportProject.cs
new file mode 100644
index 000000000..62a96a326
--- /dev/null
+++ b/ScreenToGif.Model/Models/ExportProject.cs
@@ -0,0 +1,41 @@
+using ScreenToGif.Domain.Interfaces;
+
+namespace ScreenToGif.Domain.Models;
+
+public class ExportProject
+{
+ ///
+ /// True if the project will be passed as files instead of byte array.
+ ///
+ public bool UsesFiles { get; set; }
+
+ ///
+ /// The path of frame chunk.
+ ///
+ public string ChunkPath { get; set; }
+
+ ///
+ /// The path of frame chunk that is used to hold the new frame data when cutting the images.
+ ///
+ public string NewChunkPath { get; set; }
+
+ ///
+ /// Path of the folder where the files are located.
+ ///
+ public string Path { get; set; }
+
+ ///
+ /// List of frames.
+ ///
+ public List Frames { get; set; } = new();
+
+ ///
+ /// List of frames.
+ ///
+ public List