Exemple #1
0
        /// <summary>
        /// Fetch a file that is an artifact. Cache it locally in a temp area.
        /// No need to re-fetch if we have it already.
        /// </summary>
        /// <param name="url"></param>
        /// <param name="fetchLatest"></param>
        /// <returns></returns>
        public static async Task <FileInfo> GetBuildArtifiact(string url)
        {
            // Fetch access to the server
            var jenksInfo = new JInfo(url);

            // Next, determine the job information for this guy
            var artifactInfo = await jenksInfo.GetArtifactInfo();

            // Build the file path where we will store it. If it is already there,
            // then we are done!
            var location = new FileInfo($"{Path.GetTempPath()}\\PlotLingo\\{artifactInfo.JobName}\\{artifactInfo.BuildNumber}-{artifactInfo.ArtifactName}");

            if (location.Exists)
            {
                return(location);
            }

            // If isn't there, then download it.
            await jenksInfo.Download(artifactInfo, location);

            location.Refresh();
            if (!location.Exists)
            {
                throw new InvalidOperationException($"Unable to download the Jenkins build artifact at the URL {url}.");
            }
            return(location);
        }
        private void SetParentClassCode(ClassInfoTreeNode parent, string inputString)
        {
            JInfo parentInfo = parent.JInfo;

            if (parentInfo is JArrayInfo)
            {
                if (((JArrayInfo)parentInfo).GenericType != SharpType.Object)
                {
                    ((JArrayInfo)parentInfo).GenericType = inputString;
                    ((JArrayInfo)parentInfo).SetType();
                }

                parent.Text = parentInfo.ToString();
                ClassCodeGenerator.GenerateClassCode((JClassInfo)((ClassInfoTreeNode)parent.Parent).JInfo, _declareOption, _formatString);
                parent.ClassCode = ((JClassInfo)((ClassInfoTreeNode)parent.Parent).JInfo).ClassCode;
            }
            else
            {
                ClassCodeGenerator.GenerateClassCode((JClassInfo)parentInfo, _declareOption, _formatString);
                parent.ClassCode = ((JClassInfo)parentInfo).ClassCode;
            }
        }
 public ClassInfoTreeNode(JInfo jJInfo) : base()
 {
     JInfo = jJInfo;
     Text  = jJInfo.ToString();
 }