Exemplo n.º 1
0
        private void LoadDefaults()
        {
            Language = Configuration.CodeGeneration.GetLanguage();
            RootPath = Configuration.CodeGeneration.GetOutputPath();
            RootFile = Configuration.CodeGeneration.GetOutputFile();

            RootPath = RootPath.Replace("\\.\\", "\\");

            CodeGenerationFileType[] types =
            {
                CodeGenerationFileType.AttributeConstants,
                CodeGenerationFileType.Entities,
                CodeGenerationFileType.OptionSets,
                CodeGenerationFileType.Requests,
                CodeGenerationFileType.Responses,
                CodeGenerationFileType.ServiceContext
            };

            foreach (var type in types)
            {
                var    options = Configuration.CodeGeneration.GetOutputOptions(type);
                string file    = options.GetComputedFile(RootPath);
                string path    = Path.GetDirectoryName(file);

                OutputFiles.Add(type, file);
                OutputPaths.Add(type, path);
            }
        }
Exemplo n.º 2
0
        public override bool Execute()
        {
            bool success = false;

            try
            {
                Log.LogMessage("Stitch Task");
                var json = File.ReadAllText(JsonConfig).Replace("$(ProjectDir)", RootPath.Replace("\\", "\\\\")).Replace("$(OutDir)", DestinationPath.Replace("\\", "\\\\"));
                Log.LogMessage($"Stitch Task with following Config: {json}");
                Stitcher.Stitch.UsingJsonConfig(json).Sew();
                success = true;
            }
            catch (Exception ex)
            {
                Log.LogError(ex.ToString());
            }
            finally
            {
                Log.LogMessage("End Stitch Task");
            }
            return(success);
        }
Exemplo n.º 3
0
            void before_all()
            {
                var path = RootPath.Replace(@"\bin\Debug", "").Replace(@"\bin\Release", "");

                AppDomain.CurrentDomain.SetData("DataDirectory", path);

                db = new TestContext();

                db.Entities.AddRange(new[]
                {
                    new Entity {
                        Value = 123.45m
                    },
                    new Entity {
                        Value = 67.89m
                    },
                    new Entity {
                        Value = 3.14m
                    }
                });
                db.SaveChanges();
            }
Exemplo n.º 4
0
        internal void RenameRootFolder(RecoveryFileState state)
        {
            if (!RecoveryFolderStructure.PathIsNetworkPath(_rootPath))
            {
                string[] shardPath = null;

                shardPath = RootPath.Split(new string[] { RecoveryFolderStructure.SHARD_BACKUP_FOLDER }, StringSplitOptions.RemoveEmptyEntries);


                switch (state)
                {
                case RecoveryFileState.Cancelled:
                    string destination = string.Empty;
                    if (RootPath.EndsWith(RecoveryFolderStructure.INPROGRESS))
                    {
                        string[] name = RootPath.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries);

                        destination = name[0] + RecoveryFolderStructure.CANCELLED;

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

                        destination = RootPath.Replace(RecoveryFolderStructure.INPROGRESS, RecoveryFolderStructure.CANCELLED);
                        Directory.Move(RootPath, destination);
                        RootPath = destination;
                    }
                    break;

                case RecoveryFileState.Completed:
                    string[] folderName = RootPath.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries);
                    destination = folderName[0] + RecoveryFolderStructure.COMPLETED;


                    if (!Directory.Exists(destination))
                    {
                        Directory.CreateDirectory(destination);
                    }
                    destination = RootPath.Replace(RecoveryFolderStructure.INPROGRESS, RecoveryFolderStructure.COMPLETED);
                    Directory.Move(RootPath, destination);

                    RootPath = destination;
                    break;

                case RecoveryFileState.Failed:
                    string[] rootName = RootPath.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries);
                    destination = rootName[0] + RecoveryFolderStructure.FAILED;

                    if (!Directory.Exists(destination))
                    {
                        Directory.CreateDirectory(destination);
                    }
                    destination = RootPath.Replace(RecoveryFolderStructure.INPROGRESS, RecoveryFolderStructure.FAILED);
                    Directory.Move(RootPath, destination);
                    RootPath = destination;
                    break;
                }
                if (new DirectoryInfo(shardPath[0]).GetDirectories().Count() == 0)
                {
                    Directory.Delete(shardPath[0]);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 导出的初始化
        /// </summary>
        void Init()
        {
            //计算DLC的跟目录
            RootPath = DLCAssetMgr.GetDLCRootPath(Name);
            //计算出绝对路径(拷贝文件使用)
            AbsRootPath = Path.Combine(BaseConstMgr.Path_Project, RootPath.Replace("Assets/", ""));
            //计算出目标路径
            TargetPath = Path.Combine(BaseConstMgr.Path_StreamingAssets, Name);

            //计算语言包路径
            if (DLCConfig.IsEditorMode)
            {
                LanguagePath = Path.Combine(RootPath, BaseConstMgr.Dir_Language);
            }
            else
            {
                LanguagePath = Path.Combine(TargetPath, BaseConstMgr.Dir_Language);
            }
            //计算lua路径
            if (DLCConfig.IsEditorMode)
            {
                LuaPath = Path.Combine(RootPath, BaseConstMgr.Dir_Lua);
            }
            else
            {
                LuaPath = Path.Combine(TargetPath, BaseConstMgr.Dir_Lua);
            }

            #region func
            EnsureDirectories();
            GenerateCopyPath();
            GeneralPath();
            //确保DLC相关路径存在
            void EnsureDirectories()
            {
                if (DLCConfig.IsEditorMode)
                {
                    BaseFileUtils.EnsureDirectory(AbsRootPath);
                    foreach (var item in Data)
                    {
                        BaseFileUtils.EnsureDirectory(Path.Combine(AbsRootPath, item.SearchPath));
                    }
                    foreach (var item in CopyDirectory)
                    {
                        BaseFileUtils.EnsureDirectory(Path.Combine(AbsRootPath, item));
                    }
                }
            }

            //建立拷贝路径
            void GenerateCopyPath()
            {
                AbsCopyDirectory.Clear();
                if (CopyDirectory != null)
                {
                    for (int i = 0; i < CopyDirectory.Count; ++i)
                    {
                        AbsCopyDirectory.Add(Path.Combine(AbsRootPath, CopyDirectory[i]));
                    }
                }
            }

            //建立打包路径
            void GeneralPath()
            {
                foreach (var item in Data)
                {
                    var vals  = item.SearchPath.Replace('\\', '/');
                    var temps = vals.Split('/');
                    if (temps == null || temps.Length == 0)
                    {
                        CLog.Error("路径错误:{0}", item.SearchPath);
                    }
                    item.FinalDirectory = temps[temps.Length - 1];
                    if (item.FinalDirectory == null)
                    {
                        CLog.Error("错误");
                    }

                    string tempRootPath = RootPath;
                    if (!item.CustomRootPath.IsInvStr())
                    {
                        tempRootPath = item.CustomRootPath;
                    }
                    item.FullSearchPath = tempRootPath + "/" + item.SearchPath;
                }
            }

            #endregion
        }
Exemplo n.º 6
0
 public string UpdatedVersionPath(int buildNumber)
 {
     return(RootPath.Replace(Constants.UpgradeBuildNumber.ToString(), buildNumber.ToString()));
 }