小编Ash*_*iya的帖子

如何在不阻止UI的情况下等待线程完成

我希望我的程序在下面的行之后等待

frmProgressBarObj = PullMSI.ExtractByMSIName("products.txt", false);
Run Code Online (Sandbox Code Playgroud)

如上所述方法是通过StartProcessWithProgress()方法在内部调用线程.我希望在执行代码逻辑-2行之前完成该线程.同时,它不应该停止由frmProgressBar.UpdateProgress()完成的UI更新.我该怎么做呢?

namespace NS1
{
    public partial class frmMain : Form
    {                
        private void button1_Click(object sender, EventArgs e)
        {
            frmProgressBar frmProgressBarObj = PullMSI.ExtractByMSIName("products.txt", false);
            //code logic - 2
            MessageBox.Show("This is executing immediately. 
                             I want to wait until above thread is complete");
        }
    }

    public partial class frmProgressBar : Form
    {

        public void UpdateProgress(String strTextToDisplayOnProgress)
        {
            progressBar1.BeginInvoke(
                   new Action(() => 
                   { 
                       progressBar1.Value++; 
                       lblFileName.Text = strTextToDisplayOnProgress;
                       if (progressBar1.Value == progressBar1.Maximum)
                       {
                           this.Hide(); 
                        } 
                    }));
        }

        public delegate void …
Run Code Online (Sandbox Code Playgroud)

.net c# multithreading task threadpool

12
推荐指数
1
解决办法
3万
查看次数

Terraform 错误“您的查询未返回任何结果”

我有以下 bom-asg.tf 文件。

data "aws_ami" "bom-ami" {
most_recent = true

  filter {
    name   = "tag:ami_name"
    values = ["${var.environment}-bom-ami"]
  }

  owners = ["****"]
}

resource "aws_security_group" "bom-sg" {
  name_prefix = "${var.environment}-bom-asg-sg"
  vpc_id      = "${var.vpc_id}"
  .....
Run Code Online (Sandbox Code Playgroud)

我无法成功执行刷新和计划命令。我收到以下错误。

terraform plan --var-file=environment-parity.tfvars -target=bom-asg.tf --out apply.out
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services terraform

5
推荐指数
1
解决办法
1万
查看次数

混淆是可能的混淆

自从上一周以来,我一直在努力解决这个问题.我混淆了我的应用程序的exe.我们的应用程序是在线Web应用程序的离线工具 客户端将安装此应用程序并连接到Internet,应用程序将下载相关信息并存储在客户端计算机上的xml文件中以供进一步显示.出于安全考虑,我们正在加密这些xml文件.不幸的是,我们在exe内部有一个方法GetCryptXML,它将在客户机上读取加密的settings.xml并在解密后返回它.此setting.xml也包含其他xml的加密密钥.

我面临的问题是,即使在混淆之后,人也可以通过传递混淆的名称来调用GetCryptXML方法.

有什么方法可以解决这个问题吗?

这是我解决问题的想法,但我不确定如何实施.

我的想法:只有通过使用InvokeMember()函数进行反射才能调用我的函数.在可以调用此函数之前,他/她需要使用此函数来加载程序集.

Assembly.LoadFrom("myapplication.exe")
Run Code Online (Sandbox Code Playgroud)

如果myapplication.exe中的代码可以识别哪个应用程序试图加载我,那么我们可以限制它们加载,如果它不是应用程序.我不知道怎么解决.

任何帮助是极大的赞赏.

谢谢.

c# security reflection obfuscation assemblies

2
推荐指数
1
解决办法
3995
查看次数

如何使用linq过滤类列表中的列表?

class A
{
    List<Package> productPackages;
}


static void Main(string[] args)
    {
        List<A> mainProductListing;
    }
Run Code Online (Sandbox Code Playgroud)

如何才能筛选mainProductListing.productPacakge,其中productPackage.fileName="somefile.msi"全光照的Linq?

c# linq ienumerable

2
推荐指数
1
解决办法
4000
查看次数