コード例 #1
0
 private void OnGUI_Table(Rect rect)
 {
     if (m_FileTree == null)
     {
         var column = PatchFileInfo.totalColumn;
         m_FileTree = EditorTable.CreateTable(column);
         for (int i = 0; i < column; i++)
         {
             m_FileTree.SetColumnHeader(i, PatchFileInfo.GetColumnHeader(i));
         }
         m_FileTree.OnSelectionChanged  = OnSelectedFileList;
         m_FileTree.OnDoubleClickedItem = OnDoubleClickedItem;
         RefreshFileList();
         m_FileTree.Reload();
     }
     m_FileTree.OnGUI(rect);
 }
コード例 #2
0
        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();
        }