Example #1
0
        public void AddPassage(Passage p)
        {
            p.id = pid;
            pid++;
            var amount = passages.Count;

            if (amount == 0)
            {
                passages.Add(p);
            }
            else
            {
                foreach (Passage passage in passages)
                {
                    if (passage.id == p.id)
                    {
                        return;
                    }
                    else if (amount == 1)
                    {
                        passages.Add(p);
                        break;
                    }
                    amount--;
                }
            }
        }
Example #2
0
 private void btnAddPassage_Click(object sender, EventArgs e)
 {
     if (p != null)
     {
         var passage = new Passage();
         p.AddPassage(passage);
         if (cmbType.SelectedIndex == 0)
         {
             PopulateList("Passages");
         }
         else
         {
             cmbType.SelectedIndex = 0;
         }
     }
     else
     {
         MessageBox.Show("There is no active project.");
     }
 }
Example #3
0
        public void Load(string file)
        {
            this.file = file;
            path      = file.Substring(0, file.LastIndexOf("\\"));
            using (FileStream fs = new FileStream(file, FileMode.Open))
            {
                using (GZipStream zip = new GZipStream(fs, CompressionMode.Decompress))
                {
                    using (BinaryReader br = new BinaryReader(zip))
                    {
                        Reset();
                        var count = br.ReadInt32();
                        for (var i = 0; i < count; i++)
                        {
                            var p = new Passage();
                            p.id       = br.ReadInt32();
                            p.title    = br.ReadString();
                            p.htmlText = br.ReadString();
                            p.text     = br.ReadString();
                            passages.Add(p);
                        }
                        count = br.ReadInt32();
                        for (var i = 0; i < count; i++)
                        {
                            var e = new GameEvent();
                            e.id    = br.ReadInt32();
                            e.title = br.ReadString();
                            e.code  = br.ReadString();
                            events.Add(e);
                        }

                        pid = br.ReadInt32();
                        eid = br.ReadInt32();

                        br.Close();

                        MessageBox.Show("Load successful.");
                    }
                }
            }
        }