Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic is strange. #4

Open
FaltoGH opened this issue Feb 20, 2023 · 0 comments
Open

Logic is strange. #4

FaltoGH opened this issue Feb 20, 2023 · 0 comments

Comments

@FaltoGH
Copy link

FaltoGH commented Feb 20, 2023

Hello. I tested your library by using console app.

            BookmarkLink youtube = new BookmarkLink("youtube.com", "YouTube");
            BookmarkLink github = new BookmarkLink("github.com", "GitHub");
            BookmarkLink stackoverflow = new BookmarkLink("stackoverflow.com", "StackOverFlow");
            BookmarkFolder bookmarks = new BookmarkFolder
            {
                youtube, github, stackoverflow
            };
            NetscapeBookmarksWriter writer = new NetscapeBookmarksWriter(bookmarks);
            using (FileStream fs = File.OpenWrite("bookmarks.html"))
            {
                writer.Write(fs);
            }
            bookmarks.Remove(youtube);
            bookmarks.Remove(github);
            bookmarks.Remove(stackoverflow);
            Console.WriteLine(bookmarks.Count);
            using (FileStream fs = File.OpenWrite("bookmarks.html"))
            {
                writer.Write(fs);
            }
            NetscapeBookmarksReader reader = new NetscapeBookmarksReader();
            using(FileStream fs = File.OpenRead("bookmarks.html"))
            {
                bookmarks = reader.Read(fs);
            }
            Console.WriteLine(bookmarks.Count);
output:
0
2

I think second output shall be 3, if the program doesn't overwrite.
And second output shall be 0, if the program does overwrite.

Currently, I delete the file before the save bookmarks to avoid this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant