Exemplo n.º 1
0
        protected override bool OnRun(CreateParams prms)
        {
            this.SendOutputInfo("Copy Intel CCF sample files");
            string srcPath = Path.Combine(Option.SamplesFolder, "Third_Party", "ccfSample");
            string str1    = Path.Combine(prms.Directory, prms.ProjName, "ccfSample");

            CreateHelper.CopyFolder(srcPath, str1, this.Monitor);
            bool flag = false;

            try
            {
                int num = prms.EngineInfo.VersionText.IndexOf('3');
                if (Convert.ToInt32(prms.EngineInfo.VersionText.Substring(num + 2, 1)) >= 2)
                {
                    flag = true;
                }
            }
            catch
            {
                flag = false;
            }
            if (flag)
            {
                string str2 = Path.Combine(str1, "EarthWarrior3D-CSDK", "cocos2d");
                if (!Directory.Exists(str2))
                {
                    Directory.CreateDirectory(str2);
                }
                CreateHelper.CopyFolder(prms.EngineInfo.RootPath, str2, this.Monitor);
            }
            return(true);
        }
Exemplo n.º 2
0
 internal static bool CopyFolder(string srcPath, string dstPath, CocosCreateMonitor monitor)
 {
     try
     {
         if (monitor.IsCancelled)
         {
             return(false);
         }
         if (!Directory.Exists(dstPath))
         {
             Directory.CreateDirectory(dstPath);
         }
         string[] files = Directory.GetFiles(srcPath);
         if (files.Length > 0)
         {
             foreach (string str in files)
             {
                 string destFileName = Path.Combine(dstPath, Path.GetFileName(str));
                 File.Copy(str, destFileName, true);
             }
         }
         foreach (string directory in Directory.GetDirectories(srcPath))
         {
             if (monitor.IsCancelled)
             {
                 return(false);
             }
             string dstPath1 = Path.Combine(dstPath, Path.GetFileName(directory));
             if (!CreateHelper.CopyFolder(directory, dstPath1, monitor))
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         if (monitor != null)
         {
             monitor.SendInfo("Failed to copy file");
         }
         LogConfig.Logger.Error((object)("复制文件失败:\r\n" + ex.ToString()));
         return(false);
     }
 }
Exemplo n.º 3
0
        protected override bool OnRun(CreateParams prms)
        {
            if (this.Monitor.IsCancelled)
            {
                return(false);
            }
            string str1 = Path.Combine(prms.Directory, prms.ProjName);

            this.InitParams(prms);
            if (Directory.Exists(this.dst_project_path))
            {
                this.SendOutputInfo(string.Format("{0} is already exist", (object)this.dst_project_path));
                return(false);
            }
            Directory.CreateDirectory(str1);
            this.SendOutputInfo(string.Format("Based on {0}\r\nRunning command: new\r\nCopying cocos2d-x files... ", (object)prms.EngineInfo.VersionText));
            List <string> stringList1 = new List <string>();
            List <string> stringList2 = new List <string>();
            string        str2        = Path.Combine(this.src_cocos2dx_lib, "cocos2dx");
            string        str3        = Path.Combine(str1, "cocos2dx");

            stringList1.Add(str2);
            stringList2.Add(str3);
            string str4 = Path.Combine(this.src_cocos2dx_lib, "CocosDenshion");
            string str5 = Path.Combine(str1, "CocosDenshion");

            stringList1.Add(str4);
            stringList2.Add(str5);
            string str6 = Path.Combine(this.src_cocos2dx_lib, "extensions");
            string str7 = Path.Combine(str1, "extensions");

            stringList1.Add(str6);
            stringList2.Add(str7);
            string str8 = Path.Combine(this.src_cocos2dx_lib, "external");
            string str9 = Path.Combine(str1, "external");

            stringList1.Add(str8);
            stringList2.Add(str9);
            if (this.language == "lua" || this.language == "js")
            {
                string str10 = Path.Combine(this.src_cocos2dx_lib, "scripting");
                string str11 = Path.Combine(str1, "scripting");
                stringList1.Add(str10);
                stringList2.Add(str11);
            }
            stringList1.Add(this.src_project_path);
            stringList2.Add(this.dst_project_path);
            for (int index = 0; index < stringList1.Count; ++index)
            {
                if (this.Monitor.IsCancelled || !CreateHelper.CopyFolder(stringList1[index], stringList2[index], this.Monitor))
                {
                    return(false);
                }
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(string.Format("Replace the project name from 'HelloCpp' to '{0}'", (object)prms.ProjName));
            stringBuilder.Append(string.Format("\r\nReplace the project package name from 'org.cocos2dx.hellocpp' to '{0}'", (object)prms.PkgName));
            this.SendOutputInfo(stringBuilder.ToString());
            for (int index = 0; index < this.platforms_list.Length; ++index)
            {
                this.ProcessPlatformProjects(this.platforms_list[index]);
            }
            return(true);
        }