public SearchIndex(SongDatabase db) { m_db = db; using (IWaitDialog dlg = WaitForm.Show("Vytvářím index pro vyhledávání", false)) { LoadSongs("1=1", "1=1"); } }
public static bool Run(SongDatabase db) { ImportForm frm = new ImportForm(db); if (frm.ShowDialog() == DialogResult.OK) { frm.Work(); return true; } return false; }
public SongDatabase CreateDatabase(string dbname) { dbname = dbname.ToLower(); if (!dbname.EndsWith(".db")) dbname += ".db"; if (m_dbs.ContainsKey(dbname)) throw new Exception("Duplicate db name"); SongDatabase db = new SongDatabase(Path.Combine(DbPath, dbname)); m_dbs[dbname] = db; db.WantOpen(); return db; }
public override void DownloadNew(SongDatabase db, int serverid, IWaitDialog dlg) { InetSongDb xmldb = new InetSongDb(); object request = null; using (Stream fr = Read(ref request)) { xmldb.Load(fr); } CloseRead(request); db.DownloadSongsFromServer(xmldb, serverid, dlg); }
public ImportForm(SongDatabase db) { InitializeComponent(); m_db = db; cbxServer.Database = db; foreach (ISongParser type in SongFilters.EnumFilters<ISongParser>()) { m_types.Add(type); imptype.Items.Add(type.Title); } imptype.SelectedIndex = 0; }
public void Refresh() { foreach (string path in Directory.GetFiles(DbPath)) { if (m_dbs.ContainsKey(SongDatabase.ExtractDbName(path))) continue; string file = Path.GetFileName(path); if (Path.GetExtension(file).ToLower() == ".db") { SongDatabase db = new SongDatabase(path); m_dbs[db.Name] = db; } } }
public EditSongForm(SongDatabase db, SongData song) { InitializeComponent(); m_db = db; m_song = song; tbtitle.Text = m_song.Title; tbauthor.Text = m_song.Author; tbgroup.Text = m_song.GroupName; tbtext.Text = (m_song.SongText ?? "").Replace("\r", "").Replace("\n", "\r\n"); tbremark.Text = m_song.Remark; //tblink_1.Text = m_song.Link_1; //tblink_2.Text = m_song.Link_2; songView1.SongText = m_song.OrigText; lbxLinks.Items.Clear(); foreach (var data in m_song.GetData(SongDataType.Link)) { lbxLinks.Items.Add(data.TextData); } cbxServer.Database = m_db; object o = m_db.ExecuteScalar("select server_id from song where id=@id", "id", m_song.LocalID); if (o == DBNull.Value) cbxServer.ServerID = null; else cbxServer.ServerID = Int32.Parse(o.ToString()); }
public SongBook(SongDatabase db, int id) { m_db = db; m_id = id; var vals = m_db.ExecuteOneRow("select name, options from songlist where id=@id", "id", id); m_name = vals[0].ToString(); if (vals[1] != null && vals[1] != DBNull.Value) { XmlDocument doc = new XmlDocument(); doc.LoadXml(vals[1].ToString()); Options.LoadOptions(doc.DocumentElement, this); } PrintTarget = new PdfPrintTarget(); }
void m_dbwrap_ChangedSongDatabase(object sender, EventArgs e) { m_db = m_dbwrap.Database; m_panegrp = null; panel1.Invalidate(); }
public override void UploadChanges(SongDatabase db, int serverid, IWaitDialog dlg) { InetSongDb xmldb = new InetSongDb(); object req1 = null; using (Stream fr = Read(ref req1)) xmldb.Load(fr); CloseRead(req1); object request = null; using (Stream fw = Write(ref request)) { db.PublishSongsChanges(serverid, xmldb, dlg); xmldb.Save(fw); } CloseWrite(request); }
public virtual void UploadWhole(SongDatabase db, int serverid, IWaitDialog dlg) { throw new Exception("The method or operation is not implemented."); }
public override void UploadWhole(SongDatabase db, int serverid, IWaitDialog dlg) { InetSongDb xmldb = new InetSongDb(); object request = null; using (Stream fw = Write(ref request)) { db.PublishAllSongs(serverid, xmldb, dlg); xmldb.Save(fw); } CloseWrite(request); }
public static bool Run(SongDatabase db, SongData song) { EditSongForm win = new EditSongForm(db, song); return win.ShowDialog() == DialogResult.OK; }
private static string GetDbTitle(SongDatabase db) { return db.Name; //return (db.Modified ? "*" : "") + db.Name; }
//private void SelectCurrentSong() //{ // //int index = m_dbwrap.SongBindingSource.Position; // //if (index >= 0) // //{ // // zp8.SongDb.songRow song = m_dbwrap.SongByIndex(index); // // lbgroups.SelectedIndex = lbgroups.Items.IndexOf(song.GroupName); // // lbsongs.SelectedIndex = lbsongs.Items.IndexOf(song.Title); // //} //} void m_dbwrap_ChangedSongDatabase(object sender, EventArgs e) { m_db = m_dbwrap.Database; Reload(); //if (m_db != null) m_db.SongChanged -= m_db_SongChanged; //Reload(); //m_db = db; //if (m_db != null) m_db.SongChanged += m_db_SongChanged; }