private void _Add(Sql sql) { if (this.Id == -1) { this.Id = sql.GetNextId("event"); } else { this.Remove(sql); } TextConv instance = TextConv.GetInstance(); sql.Text = "insert into event values(\r\n {0}, {1}, {2}, \r\n {3}, {4}, {5},\r\n '{6}', '{7}', '{8}', {9}, {10},\r\n {11}, '{12}');".Formatex(new object[] { this.Id, this.Fsid, this.Eid, this.Start.Ticks, this.End.Ticks, this.Duration, Sql.SqlEncode(instance.Convert(this.Title)), Sql.SqlEncode(instance.Convert(this.Desc)), Sql.SqlEncode(instance.Convert(this.LongDesc)), this.Genre, 0, this.Week, this.GenreText }); sql.Execute(); }
/* * public void Remove(Sql sql) * { * sql.Text = "delete from event where id = " + Id; * sql.Execute(); * } */ //オブジェクトをDBへ登録 public void Add(Sql sql) { //idが-1のときはidを取得 if (Id == -1) { Id = sql.GetNextId("event"); } var conv = TextConv.GetInstance(); sql.Text = @"insert into event values( {0}, {1}, {2}, {3}, {4}, {5}, '{6}', '{7}', '{8}', {9}, {10}, {11}, '{12}');".Formatex( Id, Fsid, Eid, Start.Ticks, End.Ticks, Duration, Sql.SqlEncode(conv.Convert(Title)), Sql.SqlEncode(conv.Convert(Desc)), Sql.SqlEncode(conv.Convert(LongDesc)), Genre, SubGenre, Week, GenreText ); sql.Execute(); }
public static TextConv GetInstance() { if (singleObj == null) { singleObj = new TextConv(); } return(singleObj); }
private static void LoadDef() { Log.Write("初期化中..."); Util.CopyUserFile(); MainDef.GetInstance().Check(); GenreConv.GetInstance(); TextConv.GetInstance(); EpgWait.GetInstance(); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); WebServer ws = null; var ticket = new Ticket("/tvmaid/mutex/main"); try { if (ticket.GetOwner(60 * 1000) == false) { ticket = null; throw new AppException("時間内に二重起動が解消されませんでした。"); } Log.Write(AppVer); LoadDef(); //先に読み込んでおく GenreConv.GetInstance(); TextConv.GetInstance(); if (args.Length == 1 && args[0] == "-tunerupdate") { UpdateTuner(); } TaskList.StartNew(() => { RecTimer.GetInstance().Start(); }); ws = new WebServer(); TaskList.StartNew(() => { ws.Start(); }); TunerMon.GetInstance(); Application.Run(new Tasktray()); } catch (Exception e) { MessageBox.Show("このエラーは回復できないため、アプリケーションは終了します。[詳細]" + e.Message, Logo); } finally { if (ws != null) { ws.Dispose(); } RecTimer.GetInstance().Dispose(); if (StateDef != null) { StateDef.Save(); } //スレッド終了待ち int i = 0; while (TaskList.GetInstance().IsFinish() == false) { System.Threading.Thread.Sleep(100); i++; if (i > 300) { break; } } if (ticket != null) { ticket.Dispose(); } } }