/* * [基本属性] * URL:String; 指定媒体位置,本机或网络地址 * uiMode:String; 播放器界面模式,可为 full,mini,none,invisible * playState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪 * enableContextMenu:Boolean; 启用/禁用右键菜单 * fullScreen:boolean; 是否全屏显示 * [controls] wmp.controls //播放器基本控制 * controls.play; 播放 * controls.pause; 暂停 * controls.stop; 停止 * controls.currentPosition:double; 当前进度 * controls.currentPositionString:string; 当前进度,字符串格式。如“00:23” * controls.fastForward; 快进 * controls.fastReverse; 快退 * controls.next; 下一曲 * controls.previous; 上一曲 * [settings] wmp.settings //播放器基本设置 * settings.volume:integer; 音量,0-100 * settings.autoStart:Boolean; 是否自动播放 * settings.mute:Boolean; 是否静音 * settings.playCount:integer; 播放次数 * [currentMedia] wmp.currentMedia //当前媒体属性 * currentMedia.duration:double; 媒体总长度 * currentMedia.durationString:string; 媒体总长度,字符串格式。如“03:24” * currentMedia.getItemInfo(const string); 获取当前媒体信息"Title"=媒体标题,"Author"=艺术家,"Copyright"=版权信息,"Description"=媒体内容描述,"Duration"=持续时间(秒),"FileSize"=文件大小,"FileType"=文件类型,"sourceURL"=原始地址 * currentMedia.setItemInfo(const string); 通过属性名设置媒体信息 * currentMedia.name:string; 同 currentMedia.getItemInfo("Title") * [currentPlaylist] wmp.currentPlaylist //当前播放列表属性 * currentPlaylist.count:integer; 当前播放列表所包含媒体数 * currentPlaylist.Item[integer]; 获取或设置指定项目媒体信息,其子属性同wmp.currentMedia * AxWindowsMediaPlayer控件的属性 * MediaPlayer1.Play 播放 * MediaPlayer1.Stop 停止 * MediaPlayer1.Pause 暂停 * MediaPlayer1.PlayCount 文件播放次数 * MediaPlayer1.AutoRewind 是否循环播放 * MediaPlayer1.Balance 声道 * MediaPlayer1.Volume 音量 * MediaPlayer1.Mute 静音 * MediaPlayer1.EnableContextMenu 是否允许在控件上点击鼠标右键时弹出快捷菜单 * MediaPlayer1.AnimationAtStart 是否在播放前先播放动画 * MediaPlayer1.ShowControls 是否显示控件工具栏 * MediaPlayer1.ShowAudioControls 是否显示声音控制按钮 * MediaPlayer1.ShowDisplay 是否显示数据文件的相关信息 * MediaPlayer1.ShowGotoBar 是否显示Goto栏 * MediaPlayer1.ShowPositionControls 是否显示位置调节按钮 * MediaPlayer1.ShowStatusBar 是否显示状态栏 * MediaPlayer1.ShowTracker 是否显示进度条 * MediaPlayer1.FastForward 快进 * MediaPlayer1.FastReverse 快退 * MediaPlayer1.Rate 快进/快退速率 * MediaPlayer1.AllowChangeDisplaySize 是否允许自由设置播放图象大小 * MediaPlayer1.DisplaySize 设置播放图象大小 * 1-MpDefaultSize 原始大小 * 2-MpHalfSize 原始大小的一半 * 3-MpDoubleSize 原始大小的两倍 * 4-MpFullScreen 全屏 * 5-MpOneSixteenthScreen 屏幕大小的1/16 * 6-MpOneFourthScreen 屏幕大小的1/4 * 7-MpOneHalfScreen 屏幕大小的1/2 * MediaPlayer1.ClickToPlay 是否允许单击播放窗口启动Media Player * */ private void CloseMedia() { try { this.MediaStop(); if (ShowApp.NowMediaIsShow) { ShowApp.NowMediaIsShow = false; MediaTempleteItem mtItem = PlayApp.ExecutePlayList.CurrentTempleteItem as MediaTempleteItem; mtItem.ExecuteStop(); } while (this.pnlShowMedia.Visible) { try { this.pnlShowMedia.Visible = false; } catch { } if (this.pnlShowMedia.Visible) { System.Threading.Thread.Sleep(10); } } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "CloseMedia", ex); } }
private void tmrImage_Tick(object sender, EventArgs e) { this.tmrImage.Stop(); try { if (PlayApp.ExecutePlayList.PlayListState == PlayListStateType.Stop) { CloseImage(); return; } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "tmrImage_Tick", ex); } try { this.ThreadShowImage(); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "tmrImage_Tick", ex); } finally { this.tmrImage.Start(); } }
private void MainForm_Load(object sender, EventArgs e) { try { if (IniFileInfo.ShowExample) { if (PlayApp.PlayListArray.Count == 0) { PlayApp.DebugLoadPlayListInfo(); //PlayApp.ThreadLoadPlayListTimeCurrent = PlayApp.ThreadLoadPlayListTime - 2; } } Thread tmpThread = new Thread(this.ThreadLoadPlayListVoid); tmpThread.IsBackground = true; tmpThread.Start(); this.tmrPlayList.Start(); #if !DEBUG MaxShowThis(false); #endif //商标 - 在最下层 this.ShowTrademarkForm(); //字幕 - 在第二层 this.ShowMessageForm(); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "MainForm_Load", ex); } }
public static string HttpPost(string url, string body) { try { Encoding encoding = Encoding.UTF8; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.Accept = "text/html,application/xhtml+xml,*/*"; request.ContentType = "application/json"; byte[] buffer = encoding.GetBytes(body); request.ContentLength = buffer.Length; request.GetRequestStream().Write(buffer, 0, buffer.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) { return(reader.ReadToEnd()); } } catch (Exception ex) { LogApp.OutputErrorLog("WebApiInfo", "HttpPost", ex); LogApp.OutputErrorLog("WebApiInfo", "HttpPost", url); return(string.Empty); } }
public static string UniqueMachineId() { try { StringBuilder builder = new StringBuilder(); String query = "SELECT * FROM Win32_BIOS"; ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); // This should only find one foreach (ManagementObject item in searcher.Get()) { Object obj = item["Manufacturer"]; builder.Append(Convert.ToString(obj)); builder.Append(':'); obj = item["SerialNumber"]; builder.Append(Convert.ToString(obj)); } return(builder.ToString()); } catch (Exception ex) { LogApp.OutputErrorLog("WebApiInfo", "UniqueMachineId", ex); return(string.Empty); } }
/// <summary> /// 刷新下载进度信息 /// </summary> public static void DownloadMessageRefresh() { try { if (ShowApp.DownLoadDrawMessage == null || ShowApp.DownLoadDrawMessage.DrawStyleList.Count == 0) { string messageString = "<span style=\"font-family: MS PGothic; font-size: 18px; \" ><b>ファイルダウンロード中。</b></span>"; MessageTempleteItem mtItem = new MessageTempleteItem(messageString, MessagePositionType.Bottom, 0, 0); ShowApp.DownLoadDrawMessage = new DrawMessage(VariableInfo.messageFormInstance.Width, VariableInfo.messageFormInstance.Height, mtItem); ShowApp.DownLoadDrawMessage.AddDrawMessage(mtItem.MessageList[0], mtItem.MessageStyleList[0]); } else { string messageString = string.Format("<span style=\"font-family: MS PGothic; font-size: 18px; \" ><b>ファイルダウンロード中。({0}/{1})</b></span>", ShowApp.DownLoadIndexNumber, ShowApp.DownLoadTotalNumber); MessageTempleteItem mtItem = new MessageTempleteItem(messageString, MessagePositionType.Bottom, 0, 0); ShowApp.DownLoadDrawMessage.SetDrawMessageStyle(mtItem.MessageList[0], mtItem.MessageStyleList[0], 0); } } catch (Exception ex) { LogApp.OutputErrorLog("PlayApp", "DownloadMessageRefresh", ex); } }
private void ThreadShowImageVoid() { if (showImageFlag == false) { showImageFlag = true; try { ImageTempleteItem itItem = PlayApp.ExecutePlayList.CurrentTempleteItem as ImageTempleteItem; if (itItem.CurrentIsChanged()) { LogApp.OutputProcessLog("MainForm", "ThreadShowImageVoid", string.Format("{0} - {1} - {2}", itItem.CurrentIndex, itItem.CurrentShowStyleIndex, DateTime.Now.ToLongTimeString())); itItem.ShowCurrent(picImage); } if (itItem.TempleteState == TempleteStateType.Stop) { itItem.ExecuteStop(); CloseImage(); return; } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "ThreadShowImageVoid", ex); } finally { showImageFlag = false; } } }
public static string DownloadFile(string url, string id) { try { string file = Utility.GetFullFileName(VariableInfo.FilesPath, Path.GetFileName(url)); string tempFile = string.Format("{0}.temp", file); if (File.Exists(file) == false) { if (File.Exists(tempFile)) { try { File.Delete(tempFile); } catch { } } WebClient client = new WebClient(); client.DownloadFile(url, tempFile); File.Move(tempFile, file); } return(file); } catch (Exception ex) { PlayApp.CurrentPlayListNeedDownloadFile = true; LogApp.OutputErrorLog("WebApiInfo", "DownloadFile", ex); LogApp.OutputErrorLog("WebApiInfo", "DownloadFile", url); return(string.Empty); } }
public void tmrShow_Tick(object sender, EventArgs e) { try { this.tmrShow.Stop(); if (PlayApp.ExecutePlayList != null) { if (PlayApp.ExecutePlayList.PlayListState == PlayListStateType.Stop) { CloseMessage(); return; } } ThreadShow(); ImageApp.MyDrawMessage(this.messageControls[0]); } catch (Exception ex) { LogApp.OutputErrorLog("MessageForm", "tmrMessage_Tick", ex); } finally { this.tmrShow.Start(); } }
private void ThreadShowTrademarkVoid() { if (showTrademarkFlag) { return; } try { showTrademarkFlag = true; if (PlayApp.ExecutePlayList != null) { foreach (TrademarkTempleteItem ttItem in PlayApp.ExecutePlayList.TrademarkTempleteItemList) { if (ttItem.TempleteState != TempleteStateType.Stop) { if (ttItem.TempleteState == TempleteStateType.Wait) { ttItem.ExecuteStart(); } ttItem.ShowCurrent(this); break; } } } } catch (Exception ex) { LogApp.OutputErrorLog("TrademarkForm", "ThreadShowTrademarkVoid", ex); } finally { showTrademarkFlag = false; } }
private void CloseImage() { try { if (ShowApp.NowImageIsShow) { ShowApp.NowImageIsShow = false; this.tmrImage.Stop(); if (this.picImage.Image != null) { this.picImage.Image.Dispose(); } } while (this.pnlShowImage.Visible) { try { this.pnlShowImage.Visible = false; } catch { } if (this.pnlShowImage.Visible) { System.Threading.Thread.Sleep(10); } } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "CloseImage", ex); } }
public void tmrShow_Tick(object sender, EventArgs e) { try { this.tmrShow.Stop(); if (PlayApp.ExecutePlayList != null) { if (PlayApp.ExecutePlayList.PlayListState == PlayListStateType.Stop) { CloseTrademark(); return; } } ThreadShow(); ImageApp.MyDrawTrademark(this.trademarkControls); } catch (Exception ex) { LogApp.OutputErrorLog("TrademarkForm", "tmrTrademark_Tick", ex); } finally { this.tmrShow.Start(); } }
private void CloseMessage() { try { ShowApp.NowMessageIsShow = false; ShowApp.DrawMessageList.Clear(); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "CloseMessage", ex); } }
private void CloseTrademark() { try { ShowApp.NowTrademarkIsShow = false; ShowApp.DrawTrademarkList.Clear(); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "CloseTrademark", ex); } }
private void ThreadLoadPlayListVoid() { try { if (PlayApp.NowLoadPlayList == false) { PlayApp.LoadPlayListInfo(); } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "ThreadLoadPlayListVoid", ex); } }
private void TrademarkForm_SizeChanged(object sender, EventArgs e) { try { foreach (DrawTrademark dtItem in ShowApp.DrawTrademarkList) { dtItem.SetParentSize(this.Width, this.Height); } } catch (Exception ex) { LogApp.OutputErrorLog("TrademarkForm", "TrademarkForm_SizeChanged", ex); } }
public static void DownloadMessageDispose() { try { if (ShowApp.DownLoadDrawMessage != null && ShowApp.DownLoadDrawMessage.DrawStyleList.Count > 0) { ShowApp.DownLoadDrawMessage = null; } } catch (Exception ex) { LogApp.OutputErrorLog("PlayApp", "DownloadMessageDispose", ex); } }
/// <summary> /// 画图片 /// </summary> /// <param name="g"></param> /// <param name="bmp"></param> private void MyDrawMessage(Control drawingBoard) { Graphics g = null; Graphics gBmpBack = null; try { int newW = drawingBoard.Width; int newH = drawingBoard.Height; int srcW = drawingBoard.Width; int srcH = drawingBoard.Height; ShowApp.MessageBackBitmap = new Bitmap(drawingBoard.Width, drawingBoard.Height); gBmpBack = Graphics.FromImage(ShowApp.MessageBackBitmap); gBmpBack.Clear(ImageApp.BackClearColor); if (number == 0) { gBmpBack.DrawString("AAAAABBBBBBCCCCCCDDDDD", new Font("MS PGothic", 18), new SolidBrush(Color.Red), 30, 60); } else if (number == 1) { gBmpBack.DrawString("11111111122222222223333333335", new Font("MS PGothic", 18), new SolidBrush(Color.Green), 30, 60); } // g = drawingBoard.CreateGraphics(); //g.DrawImage(PlayApp.MessageBackBitmap, 0, 0); drawingBoard.BackgroundImage = ShowApp.MessageBackBitmap; } catch (Exception ex) { LogApp.OutputErrorLog("ImageApp", "MyDrawMessage", ex); } finally { ShowApp.DrawMessageFlag = false; if (null != g) { g.Dispose(); } if (null != gBmpBack) { gBmpBack.Dispose(); } } }
static void Main(string[] args) { try { // 多重起動防止処理 Mutex mutex = new Mutex(false, Application.ProductName); if (args.Length == 0) { if (!mutex.WaitOne(0, false)) { GC.KeepAlive(mutex); mutex.Close(); return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //共通変数が初期化 VariableInfo.InitVariableInfo(); // 設定ファイルのオープン if (File.Exists(VariableInfo.IniFile) == false) { IniFileInfo.CreateDefaultIniFile(VariableInfo.IniFile); } // 設定読み込み IniFileInfo.GetIniInfo(VariableInfo.IniFile); DictionaryInfo.InitMultilingualDictionaryForClient(); //LoginForm loginFormInstance = new LoginForm(); //Application.Run(loginFormInstance); //return; // メイン画面起動 MainForm mainFormInstance = new MainForm(); Application.Run(mainFormInstance); mutex.ReleaseMutex(); } catch (Exception ex) { LogApp.OutputErrorLog("Program", "Main", ex); } }
private void tmrMedia_Tick(object sender, EventArgs e) { try { this.tmrMedia.Stop(); this.ThreadShowMedia(); this.tmrMedia.Start(); } catch (Exception ex) { this.tmrMedia.Start(); LogApp.OutputErrorLog("MainForm", "tmrMedia_Tick", ex); } }
public bool IsInExecuteTime() { try { bool isInExecuteTime = true; isInExecuteTime = playerSettings.IsInExecuteTime(); return(isInExecuteTime); } catch (Exception ex) { LogApp.OutputErrorLog("PlayerInfo", "InExecuteTime", ex); return(false); } }
private void MessageForm_SizeChanged(object sender, EventArgs e) { try { foreach (DrawMessage dmItem in ShowApp.DrawMessageList) { dmItem.SetParentSize(this.Width, this.Height); } if (ShowApp.DownLoadDrawMessage != null && ShowApp.DownLoadDrawMessage.DrawStyleList.Count > 0) { ShowApp.DownLoadDrawMessage.SetParentSize(this.Width, this.Height); } } catch (Exception ex) { LogApp.OutputErrorLog("MessageForm", "MessageForm_SizeChanged", ex); } }
private void AxVLCPlayer_OnStopEvent(object sender, EventArgs e) { try { this.showMediaFlag = true; MediaTempleteItem mtItem = PlayApp.ExecutePlayList.CurrentTempleteItem as MediaTempleteItem; mtItem.ExecuteStop(); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "AxVLCPlayer_OnStopEvent", ex); } finally { this.showMediaFlag = false; } }
/// <summary> /// 共通変数が初期化 /// </summary> public static void InitVariableInfo() { try { clientPath = Application.StartupPath; #if DEBUG iniFile = clientPath + "\\" + Constants.INI_NAME; if (File.Exists(iniFile) == false) { clientPath = Utility.GetFullFileName(new DirectoryInfo(Application.StartupPath).Parent.FullName, "Release"); } #endif iniFile = clientPath + "\\" + Constants.INI_NAME; jsonFile = clientPath + "\\" + Constants.JSON_NAME; tempPath = Utility.GetFullFileName(clientPath, "Temp"); filesPath = Utility.GetFullFileName(clientPath, "Files"); if (Directory.Exists(tempPath) == false) { Directory.CreateDirectory(tempPath); } if (Directory.Exists(filesPath) == false) { Directory.CreateDirectory(filesPath); } string logsPath = Utility.GetFullFileName(clientPath, LogApp.LOG_FILE_DIRECTORY); if (Directory.Exists(logsPath) == false) { Directory.CreateDirectory(logsPath); } } catch (Exception ex) { LogApp.OutputErrorLog("VariableInfo", "InitVariableInfo", ex); } }
private void MediaStop() { try { if (IniFileInfo.MediaDevice == MediaDeivceType.WMP) { this.axWMP.Ctlcontrols.stop(); } else if (IniFileInfo.MediaDevice == MediaDeivceType.VLC) { this.axVLCPlayer.Stop(); } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "MediaStop", ex); } }
private void ShowTrademarkForm() { try { if (VariableInfo.trademarkFormInstance == null || VariableInfo.trademarkFormInstance.IsDisposed) { VariableInfo.trademarkFormInstance = new TrademarkForm(); } VariableInfo.ReSizeForm(this, VariableInfo.trademarkFormInstance); VariableInfo.trademarkFormInstance.SetMainForm(this); VariableInfo.trademarkFormInstance.Show(); VariableInfo.trademarkFormInstance.ThreadShow(); VariableInfo.trademarkFormInstance.tmrShow_Tick(null, null); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "ShowTrademarkForm", ex); } }
private void tmrTemplete_Tick(object sender, EventArgs e) { try { this.tmrTemplete.Stop(); this.ThreadExecuteTemplete(); this.SetNowVisible(); System.Threading.Thread.Sleep(100); } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "tmrTemplete_Tick", ex); } finally { this.tmrTemplete.Start(); } }
private void ThreadShowMediaVoid() { if (showMediaFlag == false) { showMediaFlag = true; try { if (MediaIsReady()) { MediaTempleteItem mtItem = PlayApp.ExecutePlayList.CurrentTempleteItem as MediaTempleteItem; if (mtItem.CurrentIsChanged()) { if (IniFileInfo.MediaDevice == MediaDeivceType.WMP) { mtItem.ShowCurrent(this.axWMP, WMPLib.WMPPlayState.wmppsPlaying, 0); } else if (IniFileInfo.MediaDevice == MediaDeivceType.VLC) { mtItem.ShowCurrent(this.axVLCPlayer, this.pnlShowMedia.Handle); } } if (mtItem.ReadaheadOverTime(IniFileInfo.MediaReadaheadTime)) { this.CloseMedia(); } } } catch (Exception ex) { LogApp.OutputErrorLog("MainForm", "ThreadShowMediaVoid", ex); } finally { showMediaFlag = false; } } }
public static string HttpGet(string url) { try { Encoding encoding = Encoding.UTF8; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; request.Accept = "text/html,application/xhtml+xml,*/*"; request.ContentType = "application/json"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) { return(reader.ReadToEnd()); } } catch (Exception ex) { LogApp.OutputErrorLog("WebApiInfo", "HttpGet", ex); LogApp.OutputErrorLog("WebApiInfo", "HttpGet", url); return(string.Empty); } }
public static void ReSizeForm(Form main, Form layer) { try { if (layer != null && layer.IsDisposed == false) { if (main.FormBorderStyle == layer.FormBorderStyle) { layer.Size = main.Size; layer.Location = main.Location; } else { layer.Size = new Size(main.Size.Width - 16, main.Size.Height - 38); layer.Location = new Point(main.Location.X + 8, main.Location.Y + 30); } layer.WindowState = main.WindowState; } } catch (Exception ex) { LogApp.OutputErrorLog("VariableInfo", "ReSizeForm", ex); } }