Пример #1
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;
        }
Пример #2
0
        /// <summary>
        /// Initializes scene via file read.
        /// </summary>
        /// <param name="br"></param>
        /// <param name="parent"></param>
        public Scene(BinaryReader br, Chapter parent)
        {
            Title = br.ReadString();
            UID = br.ReadUInt32();
            uids.Add(UID);
            AddToChapter(parent);

            Summary = "";
            POV = null;

            Notes = new List<Note>();
            Locked = false;
        }
Пример #3
0
        /// <summary>
        /// Constructor when initializing scene via UI.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="parent"></param>
        public Scene(string title, Chapter parent)
        {
            this.Title = title;
            AddToChapter(parent);

            Summary = "";
            POV = null;

            Notes = new List<Note>();
            Locked = false;

            // Find a unique, permanent FileID for this scene.
            UID = 1;
            while (uids.Contains(UID))
            {
                UID++;
            }
            uids.Add(UID);
        }
Пример #4
0
        /// <summary>
        /// Context menu: Add chapter
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void copAddChapter_Click(object sender, EventArgs e)
        {
            if (InputStrDialog.Show("Add Chapter", "Enter title for chapter:")
                == DialogResult.OK)
            {
                Chapter cp = new Chapter(InputStrDialog.Result, (Book)rightnode.Tag);

                TreeNode node = new TreeNode(cp.Title);
                rightnode.Nodes.Add(node);
                node.Tag = cp;
                SetTreeNodeIcons(node);

                ListViewItem lvi = new ListViewItem(cp.Title);
                lvi.SubItems.Add("");
                sortChapters.AddItem(lvi);
            }

            treeSeries.SelectedNode = selnode;
        }
Пример #5
0
 /// <summary>
 /// Add this scene to a chapter.
 /// </summary>
 /// <param name="chapter"></param>
 public void AddToChapter(Chapter parent)
 {
     parent.Scenes.Add(this);
     ParentChapter = parent;
 }
Пример #6
0
        public static Scene LoadScene(BinaryReader br, Chapter parent)
        {
            // Title and UID read in constructor
            Scene sc = new Scene(br, parent);
            sc.Summary = br.ReadString();
            sc.Notes = Note.LoadListOfNotes();

            int povUID = br.ReadInt32();
            if (povUID == 0)
            {
                sc.POV = null;
            }
            else
            {
                foreach (Character ch in parent.ParentBook.ParentSeries.Characters)
                {
                    if (povUID == ch.UID)
                    {
                        sc.POV = ch;
                        break;
                    }
                }
            }

            return sc;
        }
Пример #7
0
        public static List<Scene> LoadListOfScenes(BinaryReader br, Chapter parent)
        {
            List<Scene> list = new List<Scene>();
            int count = br.ReadInt32();

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

            return list;
        }
Пример #8
0
        /// <summary>
        /// Search recursively through series until series is found. Delete series and its UID.
        /// </summary>
        /// <param name="scene"></param>
        public void DeleteScene(Scene scene, Chapter chapter)
        {
            chapter.Scenes.Remove(scene);

            Scene.deletedUIDS.Add(scene.UID);
        }
Пример #9
0
        public void DeleteChapter(Chapter cp, Book book)
        {
            book.Chapters.Remove(cp);

            foreach (Scene sc in cp.Scenes)
            {
                Scene.deletedUIDS.Add(sc.UID);
            }
        }