public static Boolean removeItem(IEnumerable <string> file_names) { using (var db = GetDBConnection()) { // ループでDELETEするとBEGIN,COMMIT内でも異常に遅いので、適当なカラムを無効な値に設定してフラグにして一気に削除する。 db.Exec("BEGIN;"); using (var stmt = db.Prepare("UPDATE list SET file_size = -1 WHERE " + LibraryDBColumnTextMinimum.file_name + " = ?;")) { foreach (var file_name in file_names) { stmt.Bind(1, file_name); stmt.Evaluate(null); } } db.Exec("DELETE FROM list WHERE file_size = -1;"); db.Exec("COMMIT;"); } AppCore.DatabaseUpdated(); return(true); }
public static void SetRating(string[] filenames, int rate) { AppCore.CoreEnqueue(() => { using (var db = GetDBConnection()) { db.Exec("BEGIN;"); using (var stmt = db.Prepare("UPDATE list SET " + LibraryDBColumnTextMinimum.rating + " = ? WHERE " + LibraryDBColumnTextMinimum.file_name + " = ? ;")) { foreach (var file_name in filenames) { stmt.Bind(1, rate.ToString()); stmt.Bind(2, file_name); stmt.Evaluate(null); stmt.Reset(); AppCore.InvalidatePlaylistCache(file_name); } } db.Exec("COMMIT;"); } _PlaylistUpdated(null); }); }
public static void PrevTrack() { Logger.Log("prev Track"); AppCore.CoreEnqueue(() => { int i = (icache > 0 ? icache : Current.IndexInPlaylist); if (i == -1) { icache = 0; } else { if (Current.Position > 5) // 現在位置が5秒以内なら現在のトラックの頭に { icache = i; } else { icache = (i - 1 < 0) ? PlaylistRowCount - 1 : i - 1; } } AppCore.PlayPlaylistItem(icache); }); }
static void Main() { _mutex = new System.Threading.Mutex(false, APP_NAME); if (_mutex.WaitOne(1000, false) == false) { // クライアントチャンネルの生成 IpcClientChannel cchannel = new IpcClientChannel(); // チャンネルを登録 ChannelServices.RegisterChannel(cchannel, true); // リモートオブジェクトを取得 RemoteObject = Activator.GetObject(typeof(IpcRemoteObject), "ipc://" + APP_NAME + "/" + APP_IF) as IpcRemoteObject; RemoteObject.Activate(); ChannelServices.UnregisterChannel(cchannel); return; } // サーバーチャンネルの生成 IpcServerChannel channel = new IpcServerChannel(APP_NAME); // チャンネルを登録 ChannelServices.RegisterChannel(channel, true); // リモートオブジェクトを生成して公開 RemoteObject = new IpcRemoteObject(); RemotingServices.Marshal(RemoteObject, APP_IF, typeof(IpcRemoteObject)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if DEBUG var w = System.IO.File.CreateText(DateTime.Now.ToString().Replace("/", "").Replace(":", "-") + ".log"); Logger.LogClient += new Logger.LogEventHandler(log => { lock (w) { w.Write(log.ToString() + Environment.NewLine); w.Flush(); } }); #endif try { Logger.Debug("Start Application"); Logger.Debug("Environment.OSVersion = " + Environment.OSVersion); Logger.Debug("Environment.Is64BitOperatingSystem = " + Environment.Is64BitOperatingSystem); Logger.Debug("Environment.Is64BitProcess = " + Environment.Is64BitProcess); Logger.Debug("Environment.Version = " + Environment.Version); var mainform = AppCore.Init(); Logger.Debug("Application core initialized."); if (mainform != null) { Logger.Debug("MainForm is " + mainform.GetType().ToString()); Application.Run(mainform); } else { Logger.Debug("MainForm is null"); Application.Run(); } } catch (Exception e) { Logger.Error(e); } }
public void Activate() { AppCore.ActivateUI(); }
/// <summary> /// プレイリストのindex行目の内容を取得する.ライブラリのカラム全ての内容を配列で返す. /// </summary> /// <param name="rowid">取得する行番号</param> /// <returns></returns> public static object[] GetPlaylistRow(int rowid) { // rowidのチェックはCore内で行うので省略 return(AppCore.GetPlaylistRow(rowid)); }
/// <summary> /// プレイリストを生成する /// </summary> /// <param name="query">SQL文または検索語</param> /// <param name="playOnCreate">プレイリスト生成後再生を開始</param> public static void CreatePlaylist(String query, bool playOnCreate = false) { AppCore.CreatePlaylist(query, playOnCreate); }
public static void Reload(Column[] extraColumns) { AppCore.Reload(extraColumns); }
public static int IndexInPlaylist(string file_name) { return(AppCore.IndexInPlaylist(file_name)); }
public static void QueueClear() { AppCore.QueuePlaylistItem(AppCore.QUEUE_CLEAR); }
/// <summary> /// 出力チャンネルのFFTデータを取得する. /// </summary> /// <param name="buffer">出力先</param> /// <param name="fftopt">FFTオプション.ポイント数他</param> /// <returns></returns> public static uint FFTData(float[] buffer, FFTNum fftopt) { return(AppCore.FFTData(buffer, fftopt)); }