Skip to content

Commit 856c47d

Browse files
committed
refactor
1 parent 745ecd9 commit 856c47d

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

Plugins/CSharpCompilerSettings/Core.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ public static string ModifyResponseFile(CscSettingsAsset setting, string assembl
152152
}
153153

154154
// Ruleset.
155-
var rulesets = new[] {"Assets/Default.ruleset"}
155+
var rulesets = new[] { "Assets/Default.ruleset" }
156156
.Concat(string.IsNullOrEmpty(asmdefDir)
157-
? new[] {"Assets/" + assemblyName + ".ruleset"}
157+
? new[] { "Assets/" + assemblyName + ".ruleset" }
158158
: Directory.GetFiles(asmdefDir, "*.ruleset"))
159159
.Where(File.Exists);
160160

Plugins/CSharpCompilerSettings/CscSettingsAsset.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ public override string ToString()
7777
[Serializable]
7878
public struct AssemblyFilter
7979
{
80-
[Tooltip("Include predefined assemblies (Assembly-CSharp-firstpass.dll, Assembly-CSharp-Editor-firstpass.dll, Assembly-CSharp.dll and Assembly-CSharp-Editor.dll)")] [SerializeField]
80+
[Tooltip("Include predefined assemblies (Assembly-CSharp-firstpass.dll, Assembly-CSharp-Editor-firstpass.dll, Assembly-CSharp.dll and Assembly-CSharp-Editor.dll)")]
81+
[SerializeField]
8182
private bool m_PredefinedAssemblies;
8283

83-
[Tooltip("Assemblies filter. Prefix '!' to exclude. (e.g. 'Assets/', '!Packages/')")] [SerializeField]
84+
[Tooltip("Assemblies filter. Prefix '!' to exclude. (e.g. 'Assets/', '!Packages/')")]
85+
[SerializeField]
8486
private string[] m_IncludedAssemblies;
8587

8688
public AssemblyFilter(bool predefinedAssemblies, string[] includedAssemblies)
@@ -107,11 +109,10 @@ internal class CscSettingsAsset : ScriptableObject, ISerializationCallbackReceiv
107109
[SerializeField] private bool m_EnableLogging = false;
108110
[SerializeField] private Nullable m_Nullable = Nullable.Disable;
109111
[SerializeField] private NugetPackage m_CompilerPackage = new NugetPackage("Microsoft.Net.Compilers", "3.5.0", NugetPackage.CategoryType.Compiler);
110-
[SerializeField] private AssemblyFilter m_CompilerFilter = new AssemblyFilter(true, new[] {"Assets/", "!Assets/Standard Assets/", "!Packages/"});
112+
[SerializeField] private AssemblyFilter m_CompilerFilter = new AssemblyFilter(true, new[] { "Assets/", "!Assets/Standard Assets/", "!Packages/" });
111113
[SerializeField] private NugetPackage[] m_AnalyzerPackages = new NugetPackage[0];
112-
[SerializeField] private AssemblyFilter m_AnalyzerFilter = new AssemblyFilter(true, new[] {"Assets/", "!Assets/Standard Assets/", "!Packages/"});
114+
[SerializeField] private AssemblyFilter m_AnalyzerFilter = new AssemblyFilter(true, new[] { "Assets/", "!Assets/Standard Assets/", "!Packages/" });
113115
[SerializeField] private string[] m_SymbolModifier = new string[0];
114-
115116
[SerializeField] [Obsolete] private bool m_UseDefaultCompiler = true;
116117
[SerializeField] [Obsolete] private string m_PackageName = "Microsoft.Net.Compilers";
117118
[SerializeField] [Obsolete] private string m_PackageVersion = "3.5.0";
@@ -128,18 +129,13 @@ private static CscSettingsAsset CreateFromProjectSettings()
128129
}
129130

130131
public bool IsProjectSetting { get; private set; }
131-
132132
private static CscSettingsAsset s_Instance;
133133
public static CscSettingsAsset instance => s_Instance ? s_Instance : s_Instance = CreateFromProjectSettings();
134134
public NugetPackage CompilerPackage => m_CompilerPackage;
135135
public Nullable Nullable => m_Nullable;
136136
public NugetPackage[] AnalyzerPackages => m_AnalyzerPackages;
137137
public bool EnableDebugLog => m_EnableLogging;
138-
139-
public bool UseDefaultCompiler
140-
{
141-
get { return m_CompilerType == CompilerType.BuiltIn || !m_CompilerPackage.IsValid; }
142-
}
138+
public bool UseDefaultCompiler => m_CompilerType == CompilerType.BuiltIn || !m_CompilerPackage.IsValid;
143139

144140
public string LanguageVersion
145141
{

Plugins/CSharpCompilerSettings/Utils.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ public static string[] GetDownloadCommand(string url, string downloadPath, Runti
172172
switch (platform)
173173
{
174174
case RuntimePlatform.WindowsEditor:
175-
return new []{"PowerShell.exe", string.Format("curl -O {0} {1}", downloadPath, url)};
175+
return new[] { "PowerShell.exe", string.Format("curl -O {0} {1}", downloadPath, url) };
176176
case RuntimePlatform.OSXEditor:
177-
return new []{"curl", string.Format("-o {0} -L {1}", downloadPath, url)};
177+
return new[] { "curl", string.Format("-o {0} -L {1}", downloadPath, url) };
178178
case RuntimePlatform.LinuxEditor:
179-
return new []{"wget", string.Format("-O {0} {1}", downloadPath, url)};
179+
return new[] { "wget", string.Format("-O {0} {1}", downloadPath, url) };
180180

181181
default:
182182
throw new NotSupportedException($"{Application.platform} is not supported");
@@ -198,18 +198,18 @@ public static string[] GetExtractArchiveCommand(string archivePath, string extra
198198
{
199199
case RuntimePlatform.WindowsEditor:
200200
Directory.CreateDirectory(Path.GetDirectoryName(extractTo));
201-
return new[] {PathCombine(contentsPath, "Tools", "7z.exe"), string.Format("x {0} -o{1}", archivePath, extractTo)};
201+
return new[] { PathCombine(contentsPath, "Tools", "7z.exe"), string.Format("x {0} -o{1}", archivePath, extractTo) };
202202
case RuntimePlatform.OSXEditor:
203203
case RuntimePlatform.LinuxEditor:
204204
if (archivePath.EndsWith("tar.gz"))
205205
{
206206
Directory.CreateDirectory(extractTo);
207-
return new[] {"tar", string.Format("-pzxf {0} -C {1}", archivePath, extractTo)};
207+
return new[] { "tar", string.Format("-pzxf {0} -C {1}", archivePath, extractTo) };
208208
}
209209
else
210210
{
211211
Directory.CreateDirectory(Path.GetDirectoryName(extractTo));
212-
return new[] {PathCombine(contentsPath, "Tools", "7za"), string.Format("x {0} -o{1}", archivePath, extractTo)};
212+
return new[] { PathCombine(contentsPath, "Tools", "7za"), string.Format("x {0} -o{1}", archivePath, extractTo) };
213213
}
214214
default:
215215
throw new NotSupportedException($"{Application.platform} is not supported");

0 commit comments

Comments
 (0)