Skip to content

Commit

Permalink
- Updating naming for Remove Line with text option to be more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
SaviorXTanren committed Sep 8, 2023
1 parent 5435926 commit 025fc61
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions MixItUp.Base/Model/Actions/FileActionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum FileActionTypeEnum
RemoveRandomLineFromFile,
InsertInFileAtSpecificLine,
InsertInFileAtRandomLine,
RemoveSpecificTextFromFile,
RemoveLineWithSpecificTextFromFile,
}

[DataContract]
Expand Down Expand Up @@ -63,7 +63,7 @@ protected override async Task PerformInternal(CommandParametersModel parameters)
if (this.ActionType == FileActionTypeEnum.ReadFromFile ||
this.ActionType == FileActionTypeEnum.ReadSpecificLineFromFile || this.ActionType == FileActionTypeEnum.ReadRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificLineFromFile || this.ActionType == FileActionTypeEnum.RemoveRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile)
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile)
{
if (!ServiceManager.Get<IFileService>().IsURLPath(filePath) && !ServiceManager.Get<IFileService>().FileExists(filePath))
{
Expand All @@ -84,23 +84,23 @@ protected override async Task PerformInternal(CommandParametersModel parameters)

if (this.ActionType == FileActionTypeEnum.SaveToFile || this.ActionType == FileActionTypeEnum.AppendToFile ||
this.ActionType == FileActionTypeEnum.InsertInFileAtSpecificLine || this.ActionType == FileActionTypeEnum.InsertInFileAtRandomLine ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile)
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile)
{
textToWrite = await this.GetTextToSave(parameters);
}

if (this.ActionType == FileActionTypeEnum.ReadFromFile || this.ActionType == FileActionTypeEnum.AppendToFile ||
this.ActionType == FileActionTypeEnum.ReadSpecificLineFromFile || this.ActionType == FileActionTypeEnum.ReadRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificLineFromFile || this.ActionType == FileActionTypeEnum.RemoveRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.InsertInFileAtSpecificLine || this.ActionType == FileActionTypeEnum.InsertInFileAtRandomLine)
{
textToRead = await ServiceManager.Get<IFileService>().ReadFile(filePath);
}

if (this.ActionType == FileActionTypeEnum.ReadSpecificLineFromFile || this.ActionType == FileActionTypeEnum.ReadRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificLineFromFile || this.ActionType == FileActionTypeEnum.RemoveRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.InsertInFileAtSpecificLine || this.ActionType == FileActionTypeEnum.InsertInFileAtRandomLine)
{
if (!string.IsNullOrEmpty(textToRead))
Expand Down Expand Up @@ -128,7 +128,7 @@ protected override async Task PerformInternal(CommandParametersModel parameters)
{
lineIndex = RandomHelper.GenerateRandomNumber(lines.Count);
}
else if (this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile)
else if (this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile)
{
lineIndex = lines.FindIndex(l => l.Equals(textToWrite, this.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase));
}
Expand All @@ -154,7 +154,7 @@ protected override async Task PerformInternal(CommandParametersModel parameters)
}

if (this.ActionType == FileActionTypeEnum.RemoveRandomLineFromFile || this.ActionType == FileActionTypeEnum.RemoveSpecificLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile)
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile)
{
lines.RemoveAt(lineIndex);
}
Expand All @@ -178,15 +178,15 @@ protected override async Task PerformInternal(CommandParametersModel parameters)
}

if (this.ActionType == FileActionTypeEnum.RemoveSpecificLineFromFile || this.ActionType == FileActionTypeEnum.RemoveRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.InsertInFileAtSpecificLine || this.ActionType == FileActionTypeEnum.InsertInFileAtRandomLine)
{
textToWrite = string.Join(Environment.NewLine, lines);
}

if (this.ActionType == FileActionTypeEnum.SaveToFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificLineFromFile || this.ActionType == FileActionTypeEnum.RemoveRandomLineFromFile ||
this.ActionType == FileActionTypeEnum.RemoveSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile ||
this.ActionType == FileActionTypeEnum.InsertInFileAtSpecificLine || this.ActionType == FileActionTypeEnum.InsertInFileAtRandomLine)
{
await ServiceManager.Get<IFileService>().SaveFile(filePath, textToWrite);
Expand Down
18 changes: 9 additions & 9 deletions MixItUp.Base/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions MixItUp.Base/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -9623,8 +9623,8 @@ update({CurrentAmount}, {GoalAmount}, {Width});</value>
<data name="ShellExecute" xml:space="preserve">
<value>Shell Execute</value>
</data>
<data name="RemoveSpecificTextFromFile" xml:space="preserve">
<value>Remove Specific Text From File</value>
<data name="RemoveLineWithSpecificTextFromFile" xml:space="preserve">
<value>Remove Line With Specific Text From File</value>
</data>
<data name="TextToRemove" xml:space="preserve">
<value>Text To Remove</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public bool ShowReadFromFileGrid
}
}

public bool ShowTextToRemoveGrid { get { return this.SelectedActionType == FileActionTypeEnum.RemoveSpecificTextFromFile; } }
public bool ShowTextToRemoveGrid { get { return this.SelectedActionType == FileActionTypeEnum.RemoveLineWithSpecificTextFromFile; } }

public bool ShowLineToWrite { get { return this.SelectedActionType == FileActionTypeEnum.InsertInFileAtSpecificLine; } }

Expand Down

0 comments on commit 025fc61

Please sign in to comment.