Пример #1
0
        private static async Task <IBuild?> DeserializeFolderAsync(string path, BuildFolder folder)
        {
            var            fullPath = Path.Combine(path, SerializationConstants.BuildFolderFileName);
            XmlBuildFolder?xmlFolder;

            if (File.Exists(fullPath))
            {
                xmlFolder = await DeserializeAsync <XmlBuildFolder>(fullPath);
            }
            else
            {
                xmlFolder = null;
                Log.Info($"Build folder file {fullPath} does not exist. Contained builds will be ordered arbitrarily.");
            }
            if (xmlFolder != null && CheckVersion(xmlFolder.Version))
            {
                folder.IsExpanded = xmlFolder.IsExpanded;
                await DeserializeBuildsAsync(path, folder, xmlFolder.Builds);
            }
            else
            {
                await DeserializeBuildsAsync(path, folder, Enumerable.Empty <string>());
            }
            return(folder);
        }
Пример #2
0
        private IBuild ConvertXmlBuild(XmlPathOfBuilding xmlBuild)
        {
            var items = ConvertItems(xmlBuild.Items.Items);
            var gems  = ConvertSkills(xmlBuild.Skills.Skills).ToList();
            var specs = xmlBuild.Tree.Specs;

            if (specs.IsEmpty())
            {
                return(ConvertXmlBuild(xmlBuild, new XmlPathOfBuildingTreeSpec {
                    Url = Constants.DefaultTree
                }, items, gems));
            }
            else if (specs.Count == 1)
            {
                return(ConvertXmlBuild(xmlBuild, specs.Single(), items, gems));
            }
            else
            {
                var hasDifferentTreeVersions = specs.Select(s => s.TreeVersion).Distinct().Count() > 1;
                var folder = new BuildFolder {
                    Name = "PoB Import"
                };
                foreach (var spec in specs)
                {
                    folder.Builds.Add(ConvertXmlBuild(xmlBuild, spec, items, gems, hasDifferentTreeVersions));
                }
                return(folder);
            }
        }
Пример #3
0
        private void AddSelectedFolder()
        {
            Object[] selectedAsset = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
            string   dirPath       = string.Empty;

            foreach (Object o in selectedAsset)
            {
                string path = AssetDatabase.GetAssetPath(o);
                if (Directory.Exists(path) && (string.IsNullOrEmpty(dirPath) || dirPath.Length > path.Length))
                {
                    dirPath = path;
                }
            }

            if (!string.IsNullOrEmpty(dirPath))
            {
                if (m_UserData.m_BuildFolderList == null)
                {
                    m_UserData.m_BuildFolderList = new List <BuildFolder>();
                }
                if (m_UserData.m_BuildFolderList.FindIndex(bf => bf.Path == dirPath) < 0)
                {
                    var buildFolder = new BuildFolder();
                    buildFolder.Path = dirPath;
                    m_UserData.m_BuildFolderList.Add(buildFolder);
                }
            }
        }
Пример #4
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));
        }
Пример #5
0
        private static async Task DeserializeBuildsAsync(string buildFolderPath, BuildFolder folder, IEnumerable <string> buildNames)
        {
            var buildTasks = new List <Task <IBuild?> >();

            foreach (var directoryPath in Directory.EnumerateDirectories(buildFolderPath))
            {
                var fileName = Path.GetFileName(directoryPath);
                var build    = new BuildFolder {
                    Name = SerializationUtils.DecodeFileName(fileName)
                };
                buildTasks.Add(DeserializeFolderAsync(directoryPath, build));
            }
            foreach (var filePath in Directory.EnumerateFiles(buildFolderPath))
            {
                if (Path.GetExtension(filePath) != SerializationConstants.BuildFileExtension)
                {
                    continue;
                }
                buildTasks.Add(DeserializeBuildAsync(filePath));
            }

            var builds = new Dictionary <string, IBuild>();

            foreach (var buildTask in buildTasks)
            {
                var build = await buildTask;
                if (build != null)
                {
                    builds[build.Name] = build;
                }
            }

            // Add the builds ordered by buildNames
            foreach (var buildName in buildNames)
            {
                if (builds.ContainsKey(buildName))
                {
                    folder.Builds.Add(builds[buildName]);
                    builds.Remove(buildName);
                }
            }
            // Add builds not in buildNames last
            foreach (var build in builds.Values)
            {
                folder.Builds.Add(build);
            }
        }
Пример #6
0
        private static async Task <BuildFolder> DeserializeFolderAsync(string path, string fileName)
        {
            var folder = new BuildFolder {
                Name = SerializationUtils.DecodeFileName(fileName)
            };
            var xmlFolder = await DeserializeAsync <XmlBuildFolder>(Path.Combine(path, SerializationConstants.BuildFolderFileName));

            if (xmlFolder != null && CheckVersion(xmlFolder.Version))
            {
                folder.IsExpanded = xmlFolder.IsExpanded;
                await DeserializeBuildsAsync(path, folder, xmlFolder.Builds);
            }
            else
            {
                await DeserializeBuildsAsync(path, folder, Enumerable.Empty <string>());
            }
            return(folder);
        }
Пример #7
0
        public Default()
        {
            Defaults.FrameworkVersion = FrameworkVersion.NET3_5;

            dirBase    = new BuildFolder(Environment.CurrentDirectory);
            dirCompile = dirBase.SubFolder("compile");
            dirTools   = dirBase.SubFolder("tools");
            dirInstall = new BuildFolder(@"C:\Program Files (x86)\CruiseControl.NET\server");

            assemblyFluentBuild      = dirTools.SubFolder("FluentBuild").File("fluentbuild.dll");
            assemblyThoughtworksCore = dirTools.SubFolder("CruiseControl").File("ThoughtWorks.CruiseControl.Core.dll");
            assemblyNetReflector     = dirTools.SubFolder("CruiseControl").File("NetReflector.dll");
            assemblyCompiledPlugin   = dirCompile.File("ccnet.fluentbuild.plugin.dll");

            AddTask(Clean);
            AddTask(Uninstall);
            AddTask(Compile);
            AddTask(Install);
        }
Пример #8
0
 private static extern string Internal_GetBuildFolder(BuildFolder folder, PlatformType platform);
Пример #9
0
 /// <summary>
 /// Returns a path to a specific folder used in the build process. See entries of BuildFolder enum for explanations
 /// of individual folder types.
 /// </summary>
 /// <param name="folder">Type of folder to retrieve the path for.</param>
 /// <param name="platform">Platform to retrieve the path for.</param>
 /// <returns>Path for the requested folder. This can be absolute or relative, see <see cref="BuildFolder"/> enum
 ///          for details.</returns>
 private static string GetBuildFolder(BuildFolder folder, PlatformType platform)
 {
     return(Internal_GetBuildFolder(folder, platform));
 }
        private static void TreeTraverse(Action <IBuild, BuildFolder> action, IBuild current, BuildFolder parent)
        {
            action(current, parent);
            var folder = current as BuildFolder;

            folder?.Builds.ForEach(b => TreeTraverse(action, b, folder));
        }
 private static void TreeTraverse(Action<IBuild, BuildFolder> action, IBuild current, BuildFolder parent)
 {
     action(current, parent);
     var folder = current as BuildFolder;
     folder?.Builds.ForEach(b => TreeTraverse(action, b, folder));
 }
 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);
     SerializationUtils.XmlSerializeToFile(xmlFolder, Path.Combine(path, BuildFolderFileName));
 }
Пример #13
0
 private static extern string Internal_GetBuildFolder(BuildFolder folder, PlatformType platform);
Пример #14
0
 /// <summary>
 /// Returns a path to a specific folder used in the build process. See entries of BuildFolder enum for explanations 
 /// of individual folder types.
 /// </summary>
 /// <param name="folder">Type of folder to retrieve the path for.</param>
 /// <param name="platform">Platform to retrieve the path for.</param>
 /// <returns>Path for the requested folder. This can be absolute or relative, see <see cref="BuildFolder"/> enum
 ///          for details.</returns>
 private static string GetBuildFolder(BuildFolder folder, PlatformType platform)
 {
     return Internal_GetBuildFolder(folder, platform);
 }