private void HandleMsg_Patch_GetFileList() { if (string.IsNullOrEmpty(m_CurrentFolderPath)) { m_CurrentFolderPath = PatchFolder; if (!Directory.Exists(m_CurrentFolderPath)) { m_CurrentFolderPath = RemoteDebugUtil.GetParentPath(PatchFolder); } } if (!Directory.Exists(m_CurrentFolderPath)) { Debug.LogError("not exist folder:" + m_CurrentFolderPath); return; } m_Client.Send(string.Format("{0}#{1}$", (int)RemoteDebugMsg.Patch_RemoteCurrentFolder, m_CurrentFolderPath )); var parent = RemoteDebugUtil.GetParentPath(m_CurrentFolderPath); m_Client.Send(string.Format("{0}#{1}|{2}|{3}|{4}$", (int)RemoteDebugMsg.Patch_RemoteFiles, 0, "..", 0, RemoteDebugUtil.GetFileLastWriteTime(parent) )); foreach (var path in Directory.GetDirectories(m_CurrentFolderPath)) { var folder = Path.GetFileName(path); if (!IsSearchFileName(folder)) { continue; } m_Client.Send(string.Format("{0}#{1}|{2}|{3}|{4}$", (int)RemoteDebugMsg.Patch_RemoteFiles, 1, folder, 0, RemoteDebugUtil.GetFileLastWriteTime(path) )); } foreach (var path in Directory.GetFiles(m_CurrentFolderPath)) { var fileName = Path.GetFileName(path); if (!IsSearchFileName(fileName)) { continue; } var fi = new FileInfo(path); m_Client.Send(string.Format("{0}#{1}|{2}|{3}|{4}$", (int)RemoteDebugMsg.Patch_RemoteFiles, 2, fileName, fi.Length, fi.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss") )); } }
private void OnGUI_Menu(Rect rect) { var btnGap = 1; var btnWid = 53; var index = 0; if (GUI.Button(new Rect(rect.x + (index++) * (btnWid + btnGap), rect.y, btnWid, rect.height), Styles.btnBack)) { if (!m_IsUploaded) { RemoteDebugWindow.Instance.ShowNotification(new GUIContent("Operation not allowed: uploading ... ")); return; } m_LocalPath = RemoteDebugUtil.GetParentPath(m_LocalPath); RefreshFileList(); } if (GUI.Button(new Rect(rect.x + (index++) * (btnWid + btnGap), rect.y, btnWid, rect.height), Styles.btnUpload)) { if (m_WaitingUploadFileInfos.Count <= 0) { RemoteDebugWindow.Instance.ShowNotification(new GUIContent("no selected files.")); } else { var files = string.Join("\n", m_WaitingUploadFileInfos); if (EditorUtility.DisplayDialog("Upload selected files", "Upload all selected files?\n" + files, "Sure", "Cancel")) { UploadStart(); UploadNextFile(); } } } if (GUI.Button(new Rect(rect.x + (index++) * (btnWid + btnGap), rect.y, btnWid, rect.height), Styles.btnCancel)) { foreach (var info in m_FileList) { info.itemSelected = false; } m_FileTree.Repaint(); } var filter = new GUIContent(Styles.iconFilter, "Filter Files:\n" + string.Join("|", m_FilterFiles)); GUI.Button(new Rect(rect.x + rect.width - 25, rect.y, 25, rect.height), filter); }
private void HandleMsg_Patch_RemoteBack() { m_CurrentFolderPath = RemoteDebugUtil.GetParentPath(m_CurrentFolderPath); HandleMsg_Patch_GetFileList(); }
private void RefreshFileList() { if (m_FileTree == null) { return; } if (!Directory.Exists(m_LocalPath)) { Debug.LogError("lcoalPath not exist:" + m_LocalPath); return; } m_FileList.Clear(); m_FileTotalSize = 0; m_FileTotalCount = 0; var back = new PatchFileInfo(); var parent = RemoteDebugUtil.GetParentPath(m_LocalPath); back.name = ".."; back.assetPath = parent; back.size = 0; back.type = 0; back.datetime = new FileInfo(parent).LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"); back.assetIcon = RemoteDebugStyles.iconFolder; m_FileList.Add(back); foreach (var path in Directory.GetDirectories(m_LocalPath)) { var folder = Path.GetFileName(path); if (IsFilter(path) || IsFilterFolder(folder) || !IsSearchFileName(folder)) { continue; } var fi = new FileInfo(path); var info = new PatchFileInfo(); info.name = folder; info.assetPath = path; info.size = 0; info.type = 1; info.datetime = fi.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"); info.assetIcon = RemoteDebugStyles.iconFolder; m_FileList.Add(info); m_FileTotalCount++; } foreach (var path in Directory.GetFiles(m_LocalPath)) { if (IsFilter(path)) { continue; } var fileName = Path.GetFileName(path); if (!IsSearchFileName(fileName)) { continue; } var fi = new FileInfo(path); var info = new PatchFileInfo(); info.name = fileName; info.assetPath = path; info.size = (int)fi.Length; info.type = 2; info.datetime = fi.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"); info.assetIcon = RemoteDebugStyles.iconFile; m_FileList.Add(info); m_FileTotalSize += info.size; m_FileTotalCount++; } m_FileTree.UpdateInfoList(m_FileList); Repaint(); }