refeat: 使用命名空间区分不同的题目

This commit is contained in:
jackfiled 2024-02-19 10:55:50 +08:00
parent c62e7a9706
commit a0ed8ba7da

View File

@ -5,12 +5,11 @@ namespace LeetCodeSharp.Fetcher.Models;
internal class Problem internal class Problem
{ {
private const string Template = """ private const string Template = """
/** // [__PROBLEM_ID__] __PROBLEM_TITLE__
* [__PROBLEM_ID__] __PROBLEM_TITLE__
*/
__EXTRA_USE__ __EXTRA_USE__
namespace LeetCodeSharp.Problems namespace LeetCodeSharp.Problems__PROBLEM_ID__
{ {
// Submission codes start here // Submission codes start here
@ -35,7 +34,7 @@ internal class Problem
public string GetFilename() public string GetFilename()
{ {
return $"p{QuestionId}_{TitleSlug.Replace('-', '_')}.cs"; return $"Solution{QuestionId}.cs";
} }
public string GetFileContent() public string GetFileContent()
@ -56,8 +55,8 @@ internal class Problem
template = Template.Replace("__EXTRA_USE__", string.Empty); template = Template.Replace("__EXTRA_USE__", string.Empty);
} }
return template.Replace("__PROBLEM_ID__", Title) return template.Replace("__PROBLEM_ID__", QuestionId.ToString())
.Replace("__PROBLEM_TITLE__", QuestionId.ToString()) .Replace("__PROBLEM_TITLE__", Title)
.Replace("__PROBLEM_CODE__", code.DefaultCode); .Replace("__PROBLEM_CODE__", code.DefaultCode);
} }