C
C#3y ago
Pdawg

❔ Delete lines from a text file in UWP

Hey! I need help deleting certain lines from a text file in UWP. Here is my current code:
StorageFile manifestFile = await DownloadsFolder.CreateFileAsync("manifest.json", CreationCollisionOption.GenerateUniqueName);
await FileIO.WriteTextAsync(manifestFile, json);
var lines = await FileIO.ReadLinesAsync(manifestFile);
lines.RemoveAt(2);
await FileIO.WriteLinesAsync(manifestFile, lines);
StorageFile manifestFile = await DownloadsFolder.CreateFileAsync("manifest.json", CreationCollisionOption.GenerateUniqueName);
await FileIO.WriteTextAsync(manifestFile, json);
var lines = await FileIO.ReadLinesAsync(manifestFile);
lines.RemoveAt(2);
await FileIO.WriteLinesAsync(manifestFile, lines);
This code doesn't work and the line isn't removed, but no exception or anything is thrown. I really don't know how to fix this, I've been trying to and nothing works. Just remember, this is UWP and I don't have access to every file in the filesystem. I only have access to the StorageFile I created. Debugging isn't helping much, it things my list of strings is a ComObject, but it's just a JSON file that should be split into a list.
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server