Пример #1
0
        private static void logStartupState(Configuration config)
        {
            // begin logging session with a form feed
            Log.Logger.Information("\r\n\f");
            Log.Logger.Information("Begin. {@DebugInfo}", new
            {
                AppName = EntryAssembly.GetName().Name,
                Version = BuildVersion.ToString(),
#if DEBUG
                Mode = "Debug",
#else
                Mode = "Release",
#endif

                LogLevel_Verbose_Enabled     = Log.Logger.IsVerboseEnabled(),
                LogLevel_Debug_Enabled       = Log.Logger.IsDebugEnabled(),
                LogLevel_Information_Enabled = Log.Logger.IsInformationEnabled(),
                LogLevel_Warning_Enabled     = Log.Logger.IsWarningEnabled(),
                LogLevel_Error_Enabled       = Log.Logger.IsErrorEnabled(),
                LogLevel_Fatal_Enabled       = Log.Logger.IsFatalEnabled(),

                config.LibationFiles,
                AudibleFileStorage.BooksDirectory,

                config.InProgress,

                AudibleFileStorage.DownloadsInProgressDirectory,
                DownloadsInProgressFiles = Directory.EnumerateFiles(AudibleFileStorage.DownloadsInProgressDirectory).Count(),

                AudibleFileStorage.DecryptInProgressDirectory,
                DecryptInProgressFiles = Directory.EnumerateFiles(AudibleFileStorage.DecryptInProgressDirectory).Count(),
            });
        }
Пример #2
0
        /// <summary>
        /// 准备构建
        /// </summary>
        public void PreAssetBuild()
        {
            Debug.Log("------------------------------OnPreAssetBuild------------------------------");

            // 检测构建平台是否合法
            if (BuildTarget == BuildTarget.NoTarget)
            {
                throw new Exception("[BuildPatch] 请选择目标平台");
            }

            // 检测构建版本是否合法
            if (EditorUtilities.IsNumber(BuildVersion.ToString()) == false)
            {
                throw new Exception($"[BuildPatch] 版本号格式非法:{BuildVersion}");
            }
            if (BuildVersion < 0)
            {
                throw new Exception("[BuildPatch] 请先设置版本号");
            }

            // 检测输出目录是否为空
            if (string.IsNullOrEmpty(OutputDirectory))
            {
                throw new Exception("[BuildPatch] 输出目录不能为空");
            }

            // 检测补丁包是否已经存在
            //string packageDirectory = GetPackageDirectory();
            //if (Directory.Exists(packageDirectory))
            //	throw new Exception($"[BuildPatch] 补丁包已经存在:{packageDirectory}");

            // 如果是强制重建
            if (IsForceRebuild)
            {
                // 删除平台总目录
                string platformDirectory = $"{_outputRoot}/{BuildTarget}";
                if (Directory.Exists(platformDirectory))
                {
                    Directory.Delete(platformDirectory, true);
                    Log($"删除平台总目录:{platformDirectory}");
                }
            }

            // 如果输出目录不存在
            if (Directory.Exists(OutputDirectory) == false)
            {
                Directory.CreateDirectory(OutputDirectory);
                Log($"创建输出目录:{OutputDirectory}");
            }

            // AssetBundle打包信息输出目录不存在
            var assetbundlebuildinfofolderpath = Application.dataPath + ResourceConstData.AssetBundleBuildInfoAssetRelativePath;

            Debug.Log($"AssetBudnle打包信息输出目录:{assetbundlebuildinfofolderpath}");
            if (!Directory.Exists(assetbundlebuildinfofolderpath))
            {
                Directory.CreateDirectory(assetbundlebuildinfofolderpath);
                Log($"创建打包信息Asset输出目录:{assetbundlebuildinfofolderpath}");
            }
        }
Пример #3
0
    /// <summary>
    /// 准备构建
    /// </summary>
    public void PreAssetBuild()
    {
        Debug.Log("------------------------------OnPreAssetBuild------------------------------");

        // 检测构建平台是否合法
        if (BuildTarget == BuildTarget.NoTarget)
        {
            throw new Exception("[BuildPackage] 请选择目标平台");
        }

        // 检测构建版本是否合法
        if (EditorTools.IsNumber(BuildVersion.ToString()) == false)
        {
            throw new Exception($"[BuildPackage] 版本号格式非法:{BuildVersion}");
        }
        if (BuildVersion < 0)
        {
            throw new Exception("[BuildPackage] 请先设置版本号");
        }

        // 检测打包目录是否为空
        if (string.IsNullOrEmpty(PackPath))
        {
            throw new Exception("[BuildPackage] 打包目录不能为空");
        }

        // 检测输出目录是否为空
        if (string.IsNullOrEmpty(OutputPath))
        {
            throw new Exception("[BuildPackage] 输出目录不能为空");
        }

        // 检测补丁包是否已经存在
        string packagePath = GetPackagePath();

        if (Directory.Exists(packagePath))
        {
            throw new Exception($"[BuildPackage] 补丁包已经存在:{packagePath}");
        }

        // 如果是强制重建
        if (IsForceRebuild)
        {
            // 删除总目录
            string parentPath = $"{_outputRoot}/{BuildTarget}";
            if (Directory.Exists(parentPath))
            {
                Directory.Delete(parentPath, true);
                ShowBuildLog($"删除平台总目录:{parentPath}");
            }
        }

        // 如果输出目录不存在
        if (Directory.Exists(OutputPath) == false)
        {
            Directory.CreateDirectory(OutputPath);
            ShowBuildLog($"创建输出目录:{OutputPath}");
        }
    }
Пример #4
0
    public void ToString_ExpectedBehavior()
    {
        // Arrange
        var buildVersion = new BuildVersion(Assembly.GetExecutingAssembly());

        // Act
        var result = buildVersion.ToString();

        // Assert
        Assert.IsNotNull(result);
    }
Пример #5
0
        private static void SerializeFolder(string path, BuildFolder folder)
        {
            var xmlFolder = new XmlBuildFolder
            {
                Version    = BuildVersion.ToString(),
                IsExpanded = folder.IsExpanded,
                Builds     = folder.Builds.Select(b => b.Name).ToList()
            };

            Directory.CreateDirectory(path);
            XmlSerializationUtils.SerializeToFile(xmlFolder, Path.Combine(path, BuildFolderFileName));
        }
 private static XmlBuild ToXmlBuild(PoEBuild build)
 {
     return(new XmlBuild
     {
         AccountName = build.AccountName,
         AdditionalData = build.AdditionalData.ToString(),
         Bandits = build.Bandits,
         CharacterName = build.CharacterName,
         CheckedNodeIds = build.CheckedNodeIds.ToList(),
         CrossedNodeIds = build.CrossedNodeIds.ToList(),
         CustomGroups = build.CustomGroups.ToList(),
         ItemData = build.ItemData,
         LastUpdated = build.LastUpdated,
         League = build.League,
         Level = build.Level,
         Name = build.Name,
         Note = build.Note,
         TreeUrl = build.TreeUrl,
         Version = BuildVersion.ToString()
     });
 }
        private static void SerializeBuild(string path, PoEBuild build)
        {
            var xmlBuild = new XmlBuild
            {
                AccountName    = build.AccountName,
                AdditionalData = build.AdditionalData.ToString(),
                Bandits        = build.Bandits,
                CharacterName  = build.CharacterName,
                CheckedNodeIds = build.CheckedNodeIds.ToList(),
                CrossedNodeIds = build.CrossedNodeIds.ToList(),
                CustomGroups   = build.CustomGroups.ToList(),
                ItemData       = build.ItemData,
                LastUpdated    = build.LastUpdated,
                League         = build.League,
                Level          = build.Level,
                Name           = build.Name,
                Note           = build.Note,
                TreeUrl        = build.TreeUrl,
                Version        = BuildVersion.ToString()
            };

            SerializationUtils.XmlSerialize(xmlBuild, path + BuildFileExtension);
            build.KeepChanges();
        }
        /// <summary>
        /// Serializes the given build.
        /// </summary>
        /// <remarks>
        /// Folders have to be serialized right after being changed to update parent information in time.
        ///
        /// The folder builds are moved to has to be serialized before their old folder.
        /// </remarks>
        public void SerializeBuild(IBuild build)
        {
            string oldName;

            _names.TryGetValue(build, out oldName);
            var name = build.Name;

            _names[build] = name;

            var path    = PathFor(build, true);
            var oldPath = path.Remove(path.Length - SerializationUtils.EncodeFileName(name).Length)
                          + SerializationUtils.EncodeFileName(oldName);
            var poeBuild = build as PoEBuild;

            if (poeBuild != null)
            {
                SerializeBuild(path, poeBuild);
                if (oldName != null && oldName != name)
                {
                    File.Delete(oldPath + BuildFileExtension);
                }
            }
            else
            {
                if (oldName != null && oldName != name)
                {
                    Directory.Move(oldPath, path);
                }
                var folder = (BuildFolder)build;

                // Move builds that are in folder.Builds but have _parents set to another folder
                // from their old folder to this one.
                foreach (var b in folder.Builds)
                {
                    BuildFolder parent;
                    _parents.TryGetValue(b, out parent);
                    if (_markedForDeletion.ContainsKey(b) || (parent != null && parent != folder))
                    {
                        var    isBuild   = b is PoEBuild;
                        var    extension = isBuild ? BuildFileExtension : "";
                        string old;
                        if (_markedForDeletion.ContainsKey(b))
                        {
                            old = _markedForDeletion[b];
                            _markedForDeletion.Remove(b);
                        }
                        else
                        {
                            old = PathFor(b, true) + extension;
                        }

                        var newPath = Path.Combine(path,
                                                   SerializationUtils.EncodeFileName(_names[b]) + extension);
                        if (old == newPath)
                        {
                            continue;
                        }
                        if (isBuild)
                        {
                            File.Move(old, newPath);
                        }
                        else
                        {
                            Directory.Move(old, newPath);
                        }
                    }
                }

                // Mark builds that have folder as _parents entry but are no longer in folder.Builds.
                // These will either be moved when their new folder is saved or deleted when Delete is called.
                // Skip unsaved builds (those are not contained in _names)
                foreach (var parentsEntry in _parents)
                {
                    var b = parentsEntry.Key;
                    if (parentsEntry.Value != folder ||
                        !_names.ContainsKey(b) ||
                        folder.Builds.Contains(b))
                    {
                        continue;
                    }
                    var extension = b is PoEBuild ? BuildFileExtension : "";
                    _markedForDeletion[b] = PathFor(b, true) + extension;
                }

                var xmlFolder = new XmlBuildFolder
                {
                    Version    = BuildVersion.ToString(),
                    IsExpanded = folder.IsExpanded,
                    Builds     = folder.Builds.Select(b => b.Name).ToList()
                };
                Directory.CreateDirectory(path);
                SerializationUtils.XmlSerialize(xmlFolder, Path.Combine(path, BuildFolderFileName));
            }

            // Just recreate these. Easier than handling all edge cases.
            InitParents();
        }