コード例 #1
0
        private void Check(VersionXML xml, string rootPath)
        {
            pmax  = Directory.GetFiles(Path.Combine(rootPath, "Base"), "*", SearchOption.AllDirectories).Length;
            pmax += Directory.GetFiles(Path.Combine(rootPath, "Other"), "*", SearchOption.AllDirectories).Length;
            pmax += Directory.GetFiles(Path.Combine(rootPath, "Change"), "*", SearchOption.AllDirectories).Length;
            var D = new DirectoryInfo(rootPath);

            foreach (var item in D.GetDirectories())
            {
                RunDoShowCheckInfo("进入目录:" + item.FullName + "\n");
                if (item.Name == "Change")
                {
                    foreach (var item1 in item.GetDirectories())
                    {
                        var v = new XMLFileList();
                        GetFiles(v, item1, "\\Change\\" + item1.Name);
                        v.Folder = item1.Name;
                        xml.x_FileList.x_change.Add(v);
                    }
                }
                else if (item.Name == "Base")
                {
                    GetFiles(xml.x_FileList.x_base, item, item.Name + "\\");
                    xml.x_FileList.x_base.Folder = "Base";
                }
                else if (item.Name == "Other")
                {
                    GetFiles(xml.x_FileList.x_other, item, item.Name + "\\");
                    xml.x_FileList.x_base.Folder = "Other";
                }
            }
        }
コード例 #2
0
 public override void LoadConfig()
 {
     try
     {
         versionXML = Utility.XMLDeserialize <VersionXML>(GlobalData.config.config_Add.configPath);
         AnalysisConfigData();
     }
     catch
     {
     }
 }
コード例 #3
0
 /// <summary>
 /// 获取配置文件信息
 /// </summary>
 void GetConfigInfo()
 {
     try
     {
         versionXML = Utility.Decode <VersionXML>(p2con_tbx.Text);
         GlobalData.config.config_Add.configPath = p2con_tbx.Text;
         AnalysisConfigData();
     }
     catch
     {
         p2con_tbx.Text    = "";
         p2ftpadd_tbx.Text = "";
         MessageBox.Show("所选文件不能被识别");
     }
 }
コード例 #4
0
 /// <summary>
 /// 执行一次,不能多次调用
 /// </summary>
 public override void OnLoad()
 {
     if (isOnLoad)
     {
         return;
     }
     isOnLoad   = true;
     versionXML = new VersionXML();
     OnClickAddBtn();
     OnClickDefaultBtn();
     OnClickSelectConfigBtn();
     OnClickSelectProgramBtn();
     OnClickSelectRootDirectory();
     OnClickStart();
     LoadConfig();
     SetDoShowCheckInfo(DoShowCheckInfo);
     SetDoShowProgressBar(DoShowProgressBar);
     SetShowPercent(DoShowPercent);
 }
コード例 #5
0
 /// <summary>
 /// 点击开始
 /// </summary>
 /// <param name="b"></param>
 private void OnClickStart()
 {
     star_btn.Click += (z, d) =>
     {
         if (isChecking)
         {
             return;
         }
         if (!Ready())
         {
             return;
         }
         SaveConfig();
         Thread t = new Thread(() =>
         {
             versionXML = new VersionXML();
             Check(versionXML, GlobalData.config.config_Create.rootDirectory);
             SaveFiles();
         });
         t.Start();
     };
 }
コード例 #6
0
ファイル: BuildScript.cs プロジェクト: seunghak123/Flaredream
    //[MenuItem(kBuildAssetBundlesMenu)]
    public static void BuildAssetBundles(BuildTarget buildTarget, List <string> buildingAssets = null)
    {
        Debug.Log("Start Build Assetbundles");

        //ProjectBuilder.SetBuildVersion_fromEnvVariable();
        // Choose the output path according to the build target.
        string outputPath = Path.Combine(kAssetBundlesOutputPath, BaseLoader.GetPlatformFolderForAssetBundles(buildTarget));

        if (!Directory.Exists(outputPath))
        {
            Directory.CreateDirectory(outputPath);
        }

        string[]        existingFilesPath = Directory.GetFiles(outputPath);
        List <FileInfo> existingFiles     = new List <FileInfo>();

        if (existingFilesPath != null)
        {
            for (int i = 0; i < existingFilesPath.Length; ++i)
            {
                FileInfo eachFile = new FileInfo(existingFilesPath[i]);
                existingFiles.Add(eachFile);
            }
        }


        //total assets
        string[] bundles = AssetDatabase.GetAllAssetBundleNames();

        AssetBundleManifest totalManifest;

        //BuildPipeline.BuildAssetBundles (outputPath, 0, EditorUserBuildSettings.activeBuildTarget);
        if (buildingAssets == null || buildingAssets.Count <= 0)
        {
            totalManifest =
                BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, buildTarget);   // hash값 유지?
        }
        else if (bundles != null)
        {
            List <AssetBundleBuild> tempListBundles = new List <AssetBundleBuild>();

            for (int i = 0; i < buildingAssets.Count; ++i)
            {
                bool isRightAssetName = false;
                for (int j = 0; j < bundles.Length; ++j)
                {
                    if (bundles[j].Equals(buildingAssets[i]) == true)
                    {
                        isRightAssetName = true;
                        break;
                    }
                }

                if (isRightAssetName == true)
                {
                    AssetBundleBuild newStructInfo = new AssetBundleBuild();
                    newStructInfo.assetBundleName = buildingAssets[i];
                    newStructInfo.assetNames      = AssetDatabase.GetAssetPathsFromAssetBundle(buildingAssets[i]);

                    tempListBundles.Add(newStructInfo);
                }
            }

            AssetBundleBuild[] arrBundles = tempListBundles.ToArray();
            totalManifest =
                BuildPipeline.BuildAssetBundles(outputPath, arrBundles, BuildAssetBundleOptions.None, buildTarget);
        }
        else
        {
            Debug.LogError("There is no assetbundle to build");
            return;
        }

        string deviceManifestPath = Path.Combine(outputPath, buildTarget.ToString());
        uint   deviceCRC          = 0;

        BuildPipeline.GetCRCForAssetBundle(deviceManifestPath, out deviceCRC);
        FileInfo totalManiFile = new FileInfo(deviceManifestPath);

        //total manifest
        stAssetInfo totalAssetManifest = new stAssetInfo();

        totalAssetManifest.Name     = buildTarget.ToString();
        totalAssetManifest.CRC      = deviceCRC;
        totalAssetManifest.FileSize = totalManiFile.Length;
        //each assets
        string[] BuiltBundles = totalManifest.GetAllAssetBundles();

        List <stAssetInfo> listAssetInfo = new List <stAssetInfo>();

        listAssetInfo.Add(totalAssetManifest);

        if (BuiltBundles == null)
        {
            Debug.LogError("bundles is null");
            return;
        }

        int invalidCount = 0;

        for (int i = 0; i < BuiltBundles.Length; ++i)
        {
            //어셋 파일 존재 검증
            string targetPath = Path.Combine(outputPath, BuiltBundles[i]);
            if (File.Exists(targetPath) == false)
            {
                invalidCount++;
                Debug.LogError(BuiltBundles[i] + " is not exist");
            }
        }

        if (invalidCount > 0)
        {
            return;
        }

        string buildTargetBundle   = buildTarget.ToString();
        string buildTargetManifest = buildTargetBundle + ".manifest";

        IEnumerable <FileInfo> deleteTarget = existingFiles.Where(
            (fileInfo) =>
        {
            if (fileInfo.Name.Equals(buildTargetBundle) || fileInfo.Name.Equals(buildTargetManifest) || fileInfo.Name.Equals("patch.xml"))
            {
                return(false);
            }

            IEnumerable <string> foundBundles = from bundleName in bundles
                                                where (fileInfo.Name.Equals(bundleName) || fileInfo.Name.Equals(StringUtils.Append(bundleName, ".manifest")))
                                                select bundleName;

            if (foundBundles.Count() > 0)
            {
                return(false);
            }

            return(true);
        }
            );

        Debug.Log("Start Delete non-asset files");
        foreach (FileInfo deleteFile in deleteTarget)
        {
            Debug.Log("Deleting " + deleteFile.Name + " ......");
            deleteFile.Delete();
        }

        for (int i = 0; i < bundles.Length; ++i)
        {
            stAssetInfo newInfo = new stAssetInfo();

            string bundleName = bundles[i];

            string targetPath = Path.Combine(outputPath, bundleName);
            uint   crc        = 0;
            if (BuildPipeline.GetCRCForAssetBundle(targetPath, out crc) == true)
            {
                FileInfo assetFile = new FileInfo(targetPath);

                newInfo.Name     = bundleName;
                newInfo.CRC      = crc;
                newInfo.FileSize = assetFile.Length;

                listAssetInfo.Add(newInfo);
            }
        }

        VersionXML.MakeVersionFile(deviceCRC, outputPath, listAssetInfo);

        Debug.Log("End Build Assetbundles");
    }