Exemple #1
0
        static void Main(string[] args)
        {
            MyDll s = new MyDll();

            Console.WriteLine("Результат функции = " + s.Formula(8, 9));
            Console.ReadLine();
        }
        public void GacLisat(MyDll mydll)
        {
            var args = string.Format(" /l {0}", mydll.Name);

            var output = _commandExecuter.ExecuteCommand(@"C:\RepomComponentsNET\GACUTIL 4.0\gacutil.exe", args);

            string[] lines = output.Split(
                new[] { "\r\n", "\r", "\n" },
                StringSplitOptions.None
                );

            foreach (var line in lines)
            {
                if (line.IndexOf("Number of items = 1") > -1)
                {
                    mydll.Installed = true;
                }

                if (line.IndexOf("PublicKeyToken=") > -1)
                {
                    var list = line.Split(',');
                    if (list.Length >= 3)
                    {
                        mydll.PublicKeyToken = list[3].Substring("PublicKeyToken=".Length + 1);
                    }
                }
                ;
            }
        }
Exemple #3
0
        public List <MyDll> GetDlls(string filter)
        {
            var retorno = new List <MyDll>();

            string[] fileEntries = Directory.GetFiles(TargetDirectory);
            foreach (string fileName in fileEntries)
            {
                var extension = Path.GetExtension(fileName);
                if (extension.ToLower() != ".dll")
                {
                    continue;
                }
                var name = Path.GetFileName(fileName).Replace(extension, string.Empty);
                // Filtra
                if (!string.IsNullOrEmpty(filter) && !name.ToLower().Contains(filter.ToLower()))
                {
                    continue;
                }

                var dll = new MyDll()
                {
                    Name      = name,
                    Path      = fileName,
                    Extension = extension
                };
                _cacHelper.GacLisat(dll);
                retorno.Add(dll);
            }

            return(retorno);
        }
Exemple #4
0
        public void FillDll(IGacDllEntity gacDllEntity, string filter, Action calback)
        {
            _gacDllEntity = gacDllEntity;

            var targetDirectory = @"C:\RepomComponentsNET";


            // guarda os checados
            var checados = new Dictionary <string, bool>();

            foreach (var sel in _gacDllEntity.GetDll)
            {
                checados.Add(sel.Name, sel.Checked);
            }


            _gacDllEntity.ClearDll();

            string[] fileEntries = Directory.GetFiles(targetDirectory);
            foreach (string fileName in fileEntries)
            {
                var extension = Path.GetExtension(fileName);
                if (extension.ToLower() != ".dll")
                {
                    continue;
                }
                var name = Path.GetFileName(fileName).Replace(extension, string.Empty);
                // Filtra
                if (!string.IsNullOrEmpty(filter) && !name.ToLower().Contains(filter.ToLower()))
                {
                    continue;
                }

                var dll = new MyDll()
                {
                    Name      = name,
                    Path      = fileName,
                    Extension = extension,
                    Checked   = !checados.ContainsKey(name) ? false : checados[name]
                };
                _cacHelper.GacLisat(dll);
                _gacDllEntity.AddDll(dll);
            }

            calback();
        }
 public void AddDll(MyDll myDll)
 {
     myDll.AddObserver(this);
     Dlls.Add(myDll);
     UpdateDll();
 }
 public void Install(MyDll mydll, Action <bool> callback)
 {
     throw new NotImplementedException();
 }