Exemplo n.º 1
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     if (!String.IsNullOrEmpty(SearchCode))
     {
         string[] s = SearchCode.Split(' ');
         if (s.Length > 0)
         {
             txt_Code.Text = s[0];
         }
         if (s.Length > 1)
         {
             txt_Specification.Text = s[1];
         }
     }
     LoadData();
     if (DataSource != null && DataSource.Rows.Count > 0)
     {
         gridView1.Focus();
     }
     else
     {
         txt_Code.Focus();
     }
 }
        public void AddOrder(String ccode, String cname, String pname, String qty)
        {
            //Select Customer
            SearchCustomer.Click();
            Thread.Sleep(3000);
            SearchCode.SendKeys(ccode);
            SearchName.SendKeys(cname);
            RunSearch.Click();
            Thread.Sleep(3000);
            SelectCustomer.Click();
            Thread.Sleep(5000);

            //Select Product
            SearchProduct.Click();
            Thread.Sleep(3000);
            SearchPName.SendKeys(pname);
            RunPSearch.Click();
            Thread.Sleep(3000);
            SelectProduct.Click();
            Thread.Sleep(3000);

            //Finish the follow flow
            AddQty.SendKeys(qty);
            AddBtn.Click();
            Thread.Sleep(3000);
            CompleteBtn.Click();
        }
        private async Task IndexProjectAsync(
            SearchCode repoInfo,
            ConcurrentDictionary <PackageReference, HashSet <RepoInfo> > graph,
            IScanProgress scanProgress)
        {
            var projectContent = await _client.Repository.Content.GetAllContents(repoInfo.Repository.Id, repoInfo.Path);

            var repo      = RepoInfo.Parse(repoInfo.Repository.Name, repoInfo.HtmlUrl);
            var nugetRefs = _projectFileParser.Parse(projectContent[0].Content);

            Console.WriteLine($"Repo name {repoInfo.Repository.Name} file name {repoInfo.Name}");

            foreach (var nugetRef in nugetRefs)
            {
                if (!graph.TryGetValue(nugetRef, out var repoInfos))
                {
                    repoInfos = new HashSet <RepoInfo>();
                }

                repoInfos.Add(repo);
                graph[nugetRef] = repoInfos;
            }

            scanProgress.UpdateProjectProgress();
        }
Exemplo n.º 4
0
        private string GetBlob(SearchCode item)
        {
            CheckRateLimit();

            var blob = _gitHubClient.Git.Blob.Get(item.Repository.Owner.Login, item.Repository.Name, item.Sha).Result;

            return(Encoding.UTF8.GetString(Convert.FromBase64String(blob.Content)).Trim('\uFEFF')); // Trim BOM
        }
Exemplo n.º 5
0
 RepositoryCodeSearch Transform(SearchCode item)
 => new RepositoryCodeSearch
 {
     Id       = item.Repository.Id,
     Owner    = item.Repository.Owner.Login,
     Name     = item.Repository.Name,
     HtmlUrl  = item.Repository.HtmlUrl,
     Archived = item.Repository.Archived,
     Stars    = item.Repository.StargazersCount,
 };
Exemplo n.º 6
0
        private static string ParseNuSpecs(string content, SearchCode item)
        {
            XDocument xdoc = null;

            try
            {
                xdoc = XDocument.Parse(content);
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("Failed to parse nuspec at {0} because of {1}", item.Path, ex);
                return(null);
            }

            return(xdoc.Descendants(XName.Get("id")).FirstOrDefault()?.Value);
        }
Exemplo n.º 7
0
 public SearchResult(SearchCode searchCode)
     : this(searchCode.Repository.Owner.Login, searchCode.Repository.Name, searchCode.Path)
 {
 }
Exemplo n.º 8
0
 public CoreConsumer(string command, SearchCode searchCode, RepositoryContent repositoryContent)
     : base(command, searchCode, repositoryContent)
 {
 }
Exemplo n.º 9
0
        private static IEnumerable <DependencyInfo> ParsePackageDependencies(string content, SearchCode item)
        {
            XDocument xdoc = null;

            try
            {
                xdoc = XDocument.Parse(content);
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("Failed to parse packages.config at {0} because of {1}", item.Path, ex);
                yield break;
            }

            foreach (var package in xdoc.Descendants(XName.Get("package")))
            {
                var packageId       = package.Attributes(XName.Get("id")).FirstOrDefault()?.Value;
                var version         = package.Attributes(XName.Get("version")).FirstOrDefault()?.Value;
                var allowedVersions = package.Attributes(XName.Get("allowedVersions")).FirstOrDefault()?.Value;

                yield return(new DependencyInfo(item.Repository.FullName, packageId, version, allowedVersions, item.Path));
            }
        }
Exemplo n.º 10
0
 private bool ProtectedFile(SearchCode arg)
 {
     return(arg.Path.StartsWith("."));
 }
Exemplo n.º 11
0
        private async Task <RepositoryContent> getFileContents(SearchCode searchCode)
        {
            var res = await _github.Repository.Content.GetAllContentsByRef(searchCode.Repository.Id, searchCode.Path, "master");

            return(res.Single());
        }
Exemplo n.º 12
0
 public Dependency(string command, SearchCode searchCode, RepositoryContent repositoryContent)
 {
     _command          = command;
     SearchCode        = searchCode;
     RepositoryContent = repositoryContent;
 }