feat: Get and Set lines#918
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds methods to get and set multi-line text data from the clipboard by providing convenient array-based APIs. The implementation treats clipboard text as lines that can be split and joined using standard line terminators.
- Adds
GetLines()andGetLinesAsync()methods that retrieve clipboard text and split it into string arrays - Adds
SetLines()andSetLinesAsync()methods that join string arrays and set them as clipboard text - Uses standard line separators (
\r\n,\r,\n) for splitting andEnvironment.NewLinefor joining
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| /// Clears the Clipboard and then adds lines of text data to it. | ||
| /// </summary> | ||
| public static Task SetLinesAsync(string[] lines, Cancellation cancellation = default) | ||
| { |
There was a problem hiding this comment.
The method should validate that the lines parameter is not null to prevent a NullReferenceException when calling string.Join().
| { | |
| { | |
| if (lines == null) | |
| throw new ArgumentNullException(nameof(lines)); |
| /// Clears the Clipboard and then adds lines of text data to it. | ||
| /// </summary> | ||
| public static void SetLines(string[] lines) | ||
| { |
There was a problem hiding this comment.
The method should validate that the lines parameter is not null to prevent a NullReferenceException when calling string.Join().
| { | |
| { | |
| if (lines == null) | |
| throw new ArgumentNullException(nameof(lines)); |
# Conflicts: # src/Directory.Build.props
# Conflicts: # src/TextCopy.sln
Repo bylo prevedeno na TextCopy.slnx, ale build.ps1 stale odkazoval na stary .sln soubor a volal msbuild.exe, ktery na macOS/Linux AppVeyor runnerech neexistuje - vsechny 3 joby proto selhavaly. Zaroven vraceno omylem prejmenovane src/.editorconfig2 zpet na .editorconfig (bylo zpusobeno merge konfliktem). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ee slozkam (#1) Co-authored-by: smutekutek <smutekutek@gmail.com>
AppVeyor bezi na MSBuild 17.8.3 - jeho legacy solution parser neumi novy XML format .slnx (MSB4068: element <Solution> unrecognized). dotnet CLI prikazy (restore/build/pack) maji vlastni slnx-aware solution loader nezavisly na teto starsi verzi MSBuild.
Predchozi fix (dotnet build/restore/pack misto dotnet msbuild -t:) nepomohl - macOS/Ubuntu AppVeyor obrazy maji starsi .NET SDK, jehoz MSBuild neumi zpracovat novy XML format .slnx vubec (MSB4068: element <Solution> unrecognized), bez ohledu na to jestli se vola pres 'dotnet msbuild' nebo 'dotnet build'. Reseni: stavet primo proti TextCopy.csproj a Tests.csproj, cimz se parsovani slnx uplne obejde a zaroven se vynechaji nesouvisejici ukazkove projekty (AndroidApp, BlazorSample, UapApp, iOSApp, TestConsole), ktere uz maji vlastni nezavisle problemy s balicky (NU1009/NU1202).
|
Closing this stale PR - thanks for the great library. Feel free to reopen if of interest. |
No description provided.