Esempio n. 1
0
        public SelectCountries(Settings.SelectionMode SelMode)
        {
            InitializeComponent();

            CinemaDataContext Context = new CinemaDataContext();
            List <string>     Strs;

            if (SelMode == Settings.SelectionMode.Countries)
            {
                Title = "Выберите страны";
                Strs  = new List <string>(Context.tblCountries.Count());
                Context.tblCountries.ToList().ForEach(A => Strs.Add(A.CountryName));
            }
            else
            if (SelMode == Settings.SelectionMode.Genres)
            {
                Title = "Выберите жанры";
                Strs  = new List <string>(Context.tblGenres.Count());
                Context.tblGenres.ToList().ForEach(A => Strs.Add(A.GenreName));
            }
            else
            {
                Title = "Выберите фильмы";
                Strs  = new List <string>(Context.tblMovies.Count());
                Context.tblMovies.ToList().ForEach(A => Strs.Add(A.MovieName));
            }
            Strs.ForEach(A => { var LVI = new ListViewItem(); LVI.Content = A; listView1.Items.Add(LVI); });
        }
Esempio n. 2
0
 public List <string> FindString(AssemblyDefinition assembly)
 {
     //List<string> strs = new List<string>();
     foreach (var type in assembly.MainModule.Types)
     {
         foreach (var met in type.Methods)
         {
             foreach (Instruction ist in met.Body.Instructions)
             {
                 if (ist.OpCode == OpCodes.Ldstr)
                 {
                     if (ist.Next.OpCode == OpCodes.Call || ist.Next.OpCode == OpCodes.Callvirt)
                     {
                         Strs.Add(ist.Operand.ToString());
                         reportManager.AddLine("Found String.");
                         List <Instruction> temp = new List <Instruction>();
                         temp.Add(ist);
                         temp.Add(ist.Next);
                         InstructionsToRemove.Add(temp);
                     }
                 }
             }
         }
     }
     return(Strs);
 }
Esempio n. 3
0
            public string Find()
            {
                int    minLength = FindMin();
                var    sb        = new StringBuilder();
                string mainWord  = Strs.ElementAt(0);

                int low = 0, high = minLength - 1;

                while (low <= high)
                {
                    var mid = low + (high - low) / 2;
                    if (CheckContain(mainWord, low, mid))
                    {
                        sb.Append(mainWord[low..(mid + 1)]);
Esempio n. 4
0
 public void FindStrs(AssemblyDefinition assembly)
 {
     foreach (var type in assembly.MainModule.Types)
     {
         foreach (var met in type.Methods)
         {
             foreach (var i in met.Body.Instructions)
             {
                 if (i.Operand != null && i.OpCode == OpCodes.Ldstr && (string)i.Operand != "")
                 {
                     Strs.Add(i.Operand.ToString());
                 }
             }
         }
     }
 }
Esempio n. 5
0
        public void ComparedMsg()
        {
            var cmp1 = "sadfasfgfdgljl;hkhgasdfip[pgsjlxjam./xzcvjg";
            var cmp2 = "sadfasfgfdgljl;hkhgasdgip[pgsjlxjam./xzcvjgvv";

            var result   = Strs.ComparedMsg(cmp1, cmp2);
            var expected = @"
##################
# EXPECTED: 
""sadfasfgfdgljl;hkhgasd███ DiFF ███▶fip[pgsjlxjam./xzcvjg""
##################
# ACTUAL: 
""sadfasfgfdgljl;hkhgasd███ DiFF ███▶gip[pgsjlxjam./xzcvjgvv"" 
##################
# expected len: 43
# actual len:   45
# diff index:   22 (line 0, col 22)
""jl;hkhgasd███ DiFF ███▶fip[pgsjlx""
""jl;hkhgasd███ DiFF ███▶gip[pgsjlx""
##################";

            Assert.AreEqual(expected, result);
        }