Skip to content

Commit b75c338

Browse files
committed
Migrated setting file from appdata to mydocuments
1 parent bd6a80c commit b75c338

File tree

7 files changed

+176
-9
lines changed

7 files changed

+176
-9
lines changed

build/nsis/setup.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!define PRODUCT_NAME "GenshinWoodmen"
2-
!define PRODUCT_VERSION "1.7.0.0"
2+
!define PRODUCT_VERSION "1.7.1.0"
33
!define PRODUCT_PUBLISHER "GenshinMatrix"
44
!define PRODUCT_WEB_SITE "https://github.com/genshin-matrix"
55
!define PRODUCT_LEGAL "Licensed under MIT"

src/.editorconfig

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
2+
[*.{cs,vb}]
3+
#### Naming styles ####
4+
5+
# Diagnostic rules
6+
7+
dotnet_diagnostic.IDE0007.severity = silent
8+
dotnet_diagnostic.IDE0008.severity = silent
9+
10+
# Naming rules
11+
12+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
13+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
14+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
15+
16+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
17+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
18+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
19+
20+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
21+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
22+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
23+
24+
# Symbol specifications
25+
26+
dotnet_naming_symbols.interface.applicable_kinds = interface
27+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
28+
dotnet_naming_symbols.interface.required_modifiers =
29+
30+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
31+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
32+
dotnet_naming_symbols.types.required_modifiers =
33+
34+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
35+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
36+
dotnet_naming_symbols.non_field_members.required_modifiers =
37+
38+
# Naming styles
39+
40+
dotnet_naming_style.begins_with_i.required_prefix = I
41+
dotnet_naming_style.begins_with_i.required_suffix =
42+
dotnet_naming_style.begins_with_i.word_separator =
43+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
44+
45+
dotnet_naming_style.pascal_case.required_prefix =
46+
dotnet_naming_style.pascal_case.required_suffix =
47+
dotnet_naming_style.pascal_case.word_separator =
48+
dotnet_naming_style.pascal_case.capitalization = pascal_case
49+
50+
dotnet_naming_style.pascal_case.required_prefix =
51+
dotnet_naming_style.pascal_case.required_suffix =
52+
dotnet_naming_style.pascal_case.word_separator =
53+
dotnet_naming_style.pascal_case.capitalization = pascal_case
54+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
55+
tab_width = 4
56+
indent_size = 4
57+
end_of_line = crlf
58+
dotnet_style_coalesce_expression = true:suggestion
59+
dotnet_style_null_propagation = true:suggestion
60+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
61+
dotnet_style_prefer_auto_properties = true:silent
62+
dotnet_style_object_initializer = true:suggestion
63+
dotnet_style_collection_initializer = true:suggestion
64+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
65+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
66+
dotnet_style_prefer_conditional_expression_over_return = true:silent
67+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
68+
dotnet_style_explicit_tuple_names = true:suggestion
69+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
70+
dotnet_style_prefer_simplified_interpolation = true:suggestion
71+
dotnet_style_prefer_compound_assignment = true:warning
72+
dotnet_style_namespace_match_folder = true:suggestion
73+
dotnet_style_readonly_field = true:warning
74+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
75+
dotnet_style_predefined_type_for_member_access = true:suggestion
76+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
77+
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
78+
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
79+
dotnet_code_quality_unused_parameters = all:suggestion
80+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
81+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
82+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
83+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
84+
dotnet_style_qualification_for_field = false:suggestion
85+
dotnet_style_qualification_for_property = false:suggestion
86+
dotnet_style_qualification_for_method = false:suggestion
87+
dotnet_style_qualification_for_event = false:suggestion
88+
89+
[*.cs]
90+
csharp_indent_labels = one_less_than_current
91+
csharp_using_directive_placement = outside_namespace:silent
92+
csharp_prefer_simple_using_statement = true:warning
93+
csharp_prefer_braces = true:suggestion
94+
csharp_style_namespace_declarations = file_scoped:warning
95+
csharp_style_prefer_method_group_conversion = true:silent
96+
csharp_style_prefer_top_level_statements = true:silent
97+
csharp_style_expression_bodied_methods = when_on_single_line:silent
98+
csharp_style_expression_bodied_constructors = false:suggestion
99+
csharp_style_expression_bodied_operators = false:silent
100+
csharp_style_expression_bodied_properties = true:warning
101+
csharp_style_expression_bodied_indexers = true:silent
102+
csharp_style_expression_bodied_accessors = true:warning
103+
csharp_style_expression_bodied_lambdas = true:silent
104+
csharp_style_expression_bodied_local_functions = false:silent
105+
csharp_style_throw_expression = true:suggestion
106+
csharp_prefer_simple_default_expression = true:suggestion
107+
csharp_style_prefer_null_check_over_type_check = true:suggestion
108+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
109+
csharp_style_prefer_index_operator = true:suggestion
110+
csharp_style_prefer_range_operator = true:suggestion
111+
csharp_style_prefer_tuple_swap = true:suggestion
112+
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
113+
csharp_style_inlined_variable_declaration = false:suggestion
114+
csharp_style_prefer_utf8_string_literals = true:suggestion
115+
csharp_style_deconstructed_variable_declaration = true:suggestion
116+
csharp_style_unused_value_assignment_preference = discard_variable:warning
117+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
118+
csharp_prefer_static_local_function = true:suggestion
119+
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
120+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
121+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
122+
csharp_style_conditional_delegate_call = true:suggestion
123+
csharp_style_prefer_switch_expression = true:suggestion
124+
csharp_style_prefer_pattern_matching = true:silent
125+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
126+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
127+
csharp_style_prefer_not_pattern = true:suggestion
128+
csharp_style_prefer_extended_property_pattern = true:suggestion
129+
csharp_style_var_for_built_in_types = true:silent
130+
csharp_style_var_when_type_is_apparent = true:silent
131+
csharp_style_var_elsewhere = true:silent
132+
csharp_space_around_binary_operators = before_and_after

src/GenshinWoodmen.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenshinWoodmen", "GenshinWoodmen\GenshinWoodmen.csproj", "{62009BA9-C624-464C-8A47-2556BE498D68}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{816401F9-553A-4F38-9044-6A741F362375}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
EndProjectSection
912
EndProject
1013
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "GenshinWoodmenSetup", "GenshinWoodmenSetup\GenshinWoodmenSetup.wapproj", "{0B2465A9-2DC4-41C6-9FD5-AF357969B85C}"
1114
EndProject

src/GenshinWoodmen/.editorconfig

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/GenshinWoodmen/Core/SpecialPathProvider.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.IO;
34

45
namespace GenshinWoodmen.Core;
@@ -9,7 +10,13 @@ internal class SpecialPathProvider
910

1011
public static string GetPath(string baseName)
1112
{
12-
string appUserPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
13+
MigrateLegacy(baseName); // Remove this line since 2023.12.08
14+
return GetPathInternal(baseName);
15+
}
16+
17+
internal static string GetPathInternal(string baseName)
18+
{
19+
string appUserPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
1320
string configPath = Path.Combine(Path.Combine(appUserPath, Pack.Alias), baseName);
1421

1522
if (!Directory.Exists(new FileInfo(configPath).DirectoryName))
@@ -23,4 +30,34 @@ public static string GetTempPath(string baseName)
2330
{
2431
return Path.Combine(TempPath + Pack.Alias, baseName);
2532
}
33+
34+
#region Legacy
35+
[Description("Legacy")]
36+
private static string GetPathLegacy(string baseName)
37+
{
38+
string appUserPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
39+
string configPath = Path.Combine(Path.Combine(appUserPath, Pack.Alias), baseName);
40+
41+
return configPath;
42+
}
43+
44+
[Description("Legacy")]
45+
private static void MigrateLegacy(string baseName)
46+
{
47+
try
48+
{
49+
string path = GetPathInternal(baseName);
50+
string pathLegacy = GetPathLegacy(baseName);
51+
52+
if (!File.Exists(path) && File.Exists(pathLegacy))
53+
{
54+
File.Copy(pathLegacy, path);
55+
}
56+
}
57+
catch
58+
{
59+
Logger.Warn($"[SpecialPathProvider] Migrate Legacy file `{baseName}` failed.");
60+
}
61+
}
62+
#endregion
2663
}

src/GenshinWoodmen/Properties/PublishProfiles/FolderProfile.pubxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
1111
<_TargetId>Folder</_TargetId>
1212
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
1313
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
14-
<SelfContained>true</SelfContained>
14+
<SelfContained>false</SelfContained>
1515
<PublishSingleFile>true</PublishSingleFile>
1616
<PublishReadyToRun>false</PublishReadyToRun>
17-
<PublishTrimmed>false</PublishTrimmed>
1817
</PropertyGroup>
1918
</Project>

src/GenshinWoodmenSetup/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Identity
1010
Name="c17bc862-e10e-4618-b717-e47dd2bf65c8"
1111
Publisher="CN=ema"
12-
Version="1.7.0.0" />
12+
Version="1.7.1.0" />
1313

1414
<Properties>
1515
<DisplayName>GenshinWoodmen</DisplayName>

0 commit comments

Comments
 (0)