예제 #1
0
        public ActionResult <string> GetAllFiles()
        {
            //Get All Files in blockchain
            FileContract.Test();

            //Validate filehash and get tampered Files

            return("string contract");
        }
예제 #2
0
 public void Progress(int percent, FileContract file)
 {
     CheckForIllegalCrossThreadCalls = false;
     lblDownload.Visible             = true;
     progressBar.Visible             = true;
     progressBar.Value = percent;
     lblProgress.Text  = string.Format("{0} % complete", percent);
     lblDownload.Text  = string.Format("Downloading {0}...", file.Name);
     File.WriteAllBytes(@"D:\Windows-Client\" + file.Name.Substring(file.Name.IndexOf(@"ClickOnce\") + 10, file.Name.Length - (file.Name.IndexOf(@"ClickOnce\") + 10)), file.Content);
 }
예제 #3
0
        public void Equals_ShouldBeFalse_WhenOther_IsNotFileContract()
        {
            var file = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "123456789", Arguments = "/qb"
            };

            var result = file.Equals(new { Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "123456789", Arguments = "/qb" });

            result.Should().BeFalse();
        }
예제 #4
0
        public void Equals_ShouldBeTrue_WhenOther_IsSelf()
        {
            var file = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha512CheckSum = "123456789", Arguments = "/qb"
            };

            var result = file.Equals(file);

            result.Should().BeTrue();
        }
예제 #5
0
        public void File_ShouldBe_Release_File()
        {
            var file     = new FileContract();
            var contract = new ReleaseContract {
                Version = "9.9.9", File = file
            };
            var release = new Release(contract, false, new Version());

            var result = release.File;

            result.Should().BeSameAs(file);
        }
예제 #6
0
        public void Equals_ShouldBeFalse_WhenOther_Url_IsDifferent()
        {
            var file = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "123456789", Arguments = "/qb"
            };
            var other = new FileContract {
                Url = "http://ubiquito.com/abc.exe", Sha1CheckSum = "123456789", Arguments = "/qb"
            };

            var result = file.Equals(other);

            result.Should().BeFalse();
        }
예제 #7
0
        public void Equals_ShouldBeTrue_WhenBoth_Arguments_AreNull()
        {
            var file = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "123456789", Arguments = null
            };
            var other = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "123456789", Arguments = null
            };

            var result = file.Equals(other);

            result.Should().BeTrue();
        }
예제 #8
0
        public void Equals_ShouldBeTrue_WhenBoth_Sha1CheckSum_AreNull()
        {
            var file = new FileContract {
                Url = null, Sha1CheckSum = null, Arguments = "/qb"
            };
            var other = new FileContract {
                Url = null, Sha1CheckSum = null, Arguments = "/qb"
            };

            var result = file.Equals(other);

            result.Should().BeTrue();
        }
예제 #9
0
        public void Equals_ShouldBeFalse_WhenThis_Url_IsNull()
        {
            var file = new FileContract {
                Url = null, Sha1CheckSum = "123456789", Arguments = "/qb"
            };
            var other = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "123456789", Arguments = "/qb"
            };

            var result = file.Equals(other);

            result.Should().BeFalse();
        }
예제 #10
0
        public void Empty_ShouldBeFalse_WhenReleaseVersion_IsNotZero()
        {
            var file = new FileContract {
                Url = "https://protonvpn.com/download.exe", Sha1CheckSum = "012345", Arguments = "-install"
            };
            var contract = new ReleaseContract {
                Version = "0.0.1", ChangeLog = new[] { "Fixed" }, File = file
            };
            var release = new Release(contract, false, new Version());

            var result = release.Empty();

            result.Should().BeFalse();
        }
예제 #11
0
        static void Main(string[] args)
        {
            FileContract fc = new FileContract();

            fc.AttachToEvent("0xc5a9c78645c73f7370177db6bae9e7abf267ee9d", "OnChange", (s, objects) =>
            {
                foreach (var o in objects)
                {
                    Console.WriteLine(s, o);
                }
            });

            while (true)
            {
                Thread.Sleep(1000);
            }
        }