Exemplo n.º 1
0
        public static Book LoadBook(BinaryReader br, Series parent)
        {
            Book bk = new Book(br.ReadString(), parent);
            bk.Summary = br.ReadString();
            bk.UID = br.ReadInt32();

            bk.Notes = Note.LoadListOfNotes();
            bk.Chapters = Chapter.LoadListOfChapters(br, bk);

            return bk;
        }
Exemplo n.º 2
0
        public Chapter(string title, Book parent)
        {
            this.Title = title;
            AddToBook(parent);

            Summary = "";
            MajorConflict = "";
            MinorConflict = "";
            Scenes = new List<Scene>();
            Notes = new List<Note>();
        }
Exemplo n.º 3
0
        public static List<Chapter> LoadListOfChapters(BinaryReader br, Book parent)
        {
            List<Chapter> list = new List<Chapter>();
            int count = br.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                list.Add(LoadChapter(br, parent));
            }

            return list;
        }
Exemplo n.º 4
0
        public static Chapter LoadChapter(BinaryReader br, Book parent)
        {
            Chapter cp = new Chapter(br.ReadString(), parent); // Title

            cp.Summary = br.ReadString();
            cp.Notes = Note.LoadListOfNotes();
            cp.MajorConflict = br.ReadString();
            cp.MinorConflict = br.ReadString();
            cp.Scenes = Scene.LoadListOfScenes(br, cp);

            return cp;
        }
Exemplo n.º 5
0
        private void copAddBook_Click(object sender, EventArgs e)
        {
            if (InputStrDialog.Show(
                "Add Book", "Enter title of book") == DialogResult.OK)
            {
                Book bk = new Book(InputStrDialog.Result, series);

                TreeNode node = new TreeNode(bk.Title);
                SuperNode.Nodes.Add(node);
                node.Tag = bk;
                SetTreeNodeIcons(node);

                ListViewItem lvi = new ListViewItem(bk.Title);
                lvi.SubItems.Add("");
                sortBooks.AddItem(lvi);

                cmdBookFilter.Items.Add(bk);

                SuperNode.Expand();
            }

            treeSeries.SelectedNode = selnode;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Populate the list of chapters given the currently selected book.
        /// </summary>
        /// <param name="bk"></param>
        private void PopulateChapterList(Book bk)
        {
            // This flag is set to true if the book containing
            // the scene is selected.
            bool foundOriginalParent = false;

            lstChapters.Items.Clear();

            foreach (Chapter cp in bk.Chapters)
            {
                lstChapters.Items.Add(cp);
                if (item is Scene && cp == ((Scene)item).ParentChapter)
                {
                    lstChapters.SelectedItem = cp;
                    foundOriginalParent = true;
                }
            }

            // Only select first Chapter if item is a Scene.
            // Otherwise, -1 = nothing in Chapter list select.
            if (!foundOriginalParent && lstChapters.Items.Count > 0)
                lstChapters.SelectedIndex = (item is Scene ? 0 : -1);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Add this chapter to a book.
 /// </summary>
 /// <param name="book"></param>
 public void AddToBook(Book parent)
 {
     parent.Chapters.Add(this);
     ParentBook = parent;
 }
Exemplo n.º 8
0
        public void DeleteChapter(Chapter cp, Book book)
        {
            book.Chapters.Remove(cp);

            foreach (Scene sc in cp.Scenes)
            {
                Scene.deletedUIDS.Add(sc.UID);
            }
        }
Exemplo n.º 9
0
        public void DeleteBook(Book book)
        {
            Books.Remove(book);

            // Delete scene files contained in book at next save
            foreach (Chapter cp in book.Chapters)
            {
                foreach (Scene sc in cp.Scenes)
                {
                    Scene.deletedUIDS.Add(sc.UID);
                }
            }

            // Remove book appearances from characters
            foreach (Character character in Characters)
            {
                character.Appearances.Remove(book.UID);
            }
        }