예제 #1
0
        /// <summary>
        /// 扫描图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void scan_btn_Click(object sender, EventArgs e)
        {
            if (filesPath_tb.Text.Length <= 0)
            {
                MessageBox.Show("路径不能为空");
                return;
            }

            fileinfos.Clear();
            List <String> pathNames = getFiles(filesPath_tb.Text);

            for (int i = 0; i < pathNames.Count; i++)
            {
                String      path = pathNames[i];
                ResFileInfo info = new ResFileInfo();
                info.filePath    = path;
                info.fileName    = getFileName(path);
                info.fileSize    = Utils.GetFileSize(path);
                info.isLegal     = isNameLegal(getFileName(path));
                info.newFilePath = "";
                info.newFileName = "";
                fileinfos.Add(info);
            }
            setDataGrid(fileinfos);
        }
예제 #2
0
        /// <summary>
        /// 另存为
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void save_newpath_btn_Click(object sender, EventArgs e)
        {
            if (filesPath_tb.Text.Length <= 0)
            {
                MessageBox.Show("路径不能为空");
                return;
            }

            if (newFilesPath_tb.Text.Length <= 0)
            {
                MessageBox.Show("新路径不能为空");
                return;
            }
            String newFileDir = newFilesPath_tb.Text + "\\" + filesPath_tb.Text.Substring(filesPath_tb.Text.LastIndexOf("\\") + 1);

            if (!Directory.Exists(newFileDir))
            {
                Directory.CreateDirectory(newFileDir);
            }
            for (int i = 0; i < fileinfos.Count; i++)
            {
                ResFileInfo info = fileinfos[i];
                //文件名转换
                string newName = replaceName(info.fileName);//.Replace("-","_").Replace("—", "_").Replace(" ","").Replace(" ", "").Replace("-", "_").ToLower();
                //新文件保存路径
                string newFilePath = newFileDir + "\\" + newName;
                info.newFilePath = newFilePath;
                info.newFileName = newName;
                File.Copy(info.filePath, newFilePath, true);
                info.newfileSize = Utils.GetFileSize(newFilePath);
            }
            setDataGrid(fileinfos);
        }
예제 #3
0
        /// <summary>
        /// 获取packedAssets之外的资源
        /// </summary>
        /// <param name="searchPath"></param>
        /// <param name="searchPattern"></param>
        /// <param name="option"></param>
        /// <returns></returns>
        protected static List <string> GetFilesWithoutPacked(string searchPath, string searchPattern, SearchOption option)
        {
            var files      = ResFileInfo.GetFilesWithoutDirectores(searchPath, searchPattern, option);
            var filesCount = files.Count;
            var removeAll  = files.RemoveAll((string file) =>
            {
                //TODO
                return(packedAssets.Contains(file));
            });

            Debug.LogError(string.Format("RemoveAll {0} size: {1}", removeAll, filesCount));

            return(files);
        }
예제 #4
0
        public static List <AssetBundleBuild> GetBuilds()
        {
            packedAssets.Clear();
            builds.Clear();
            //allDependencies.Clear();
            builds.Add(BuildManifest());//添加配置文件

            string packagePatternPath = BuildDefaultPath.GetBuildPattrenAssetPath();

            if (!File.Exists(packagePatternPath))//获取打包方式
            {
                new BuildPackPattern();
            }

            if (!LoadEachPatterns())
            {
                return(null);
            }

            foreach (var item in patterns)
            {
                if (item.searchPath == "")
                {
                    Debug.LogErrorFormat("assetName:{0}   searchPath is null ! Check !!!", item.assetFolderName);
                    continue;
                }

                if (item.searchPattern == "")
                {
                    Debug.LogErrorFormat("assetName:{0}   searchPattern is null ! Check !!!", item.assetFolderName);
                    continue;
                }

                CollectDependencies(ResFileInfo.GetFilesWithoutDirectores(item.searchPath, item.searchPattern,
                                                                          item.option)); //收集资源依赖
            }


            foreach (var item in patterns)
            {
                item.Build(); //获取打包信息
            }

            BuildAtlas();//编辑图集资源

            UnityEditor.EditorUtility.ClearProgressBar();

            return(builds);
        }
예제 #5
0
        private void filesDataGrid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int row = e.RowIndex;
            int col = e.ColumnIndex;

            if (col == 0)
            {
                ResFileInfo info = fileinfos[row];
                if (!File.Exists(info.filePath))
                {
                    return;
                }
                System.Diagnostics.Process.Start(info.filePath);
            }
        }