public void OnBtnDownload() { if (!NetworkClient.Inst().IsConnected()) { MessageBox.Show("Network Error:", "Network Disconnected.", null); return; } ICD.CMD_SongFile msg = new ICD.CMD_SongFile(); msg.song = SongInfo; msg.FillHeader(ICD.ICDDefines.CMD_Download); NetworkClient.Inst().SendMsgToServer(msg); StartCoroutine(ShowProgressBar()); NetworkClient.Inst().mOnRecv.AddListener(OnRecvDownload); }
public void OnBtnUpload() { if (!NetworkClient.Inst().IsConnected()) { MessageBox.Show("Network Error:", "Network Disconnected.", null); return; } ICD.CMD_SongFile msg = new ICD.CMD_SongFile(); msg.song = SongInfo; byte[] stream = File.ReadAllBytes(SongInfo.FilePath + SongInfo.FileNameNoExt + ".mp3"); msg.stream.AddRange(stream); msg.FillHeader(ICD.ICDDefines.CMD_Upload); NetworkClient.Inst().SendMsgToServer(msg); NetworkClient.Inst().mOnRecv.AddListener(OnRecvUpload); }