Пример #1
0
        // GET: Info/Info
        public ActionResult Version()
        {
            AssemblyInfos infos = new AssemblyInfos();

            ViewBag.Assemblies = infos.Assemblies;
            return(View());
        }
Пример #2
0
 public DocsMember(string filePath, DocsType parentType, XElement xeMember)
     : base(xeMember)
 {
     FilePath   = filePath;
     ParentType = parentType;
     AssemblyInfos.AddRange(XERoot.Elements("AssemblyInfo").Select(x => new DocsAssemblyInfo(x)));
 }
Пример #3
0
 private void btnDALPath_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         OpenFileDialog ofd = new OpenFileDialog();
         ofd.Title  = Resources.select_driver;
         ofd.Filter = $"{Resources.dynamic_libaray}(*.dll)|*.dll";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             string   filename    = ofd.FileName;
             FileInfo info        = new FileInfo(filename);
             string   to_filename = $@"{Application.StartupPath}\{info.Name}";
             info.CopyTo(to_filename, true);
             AssemblyInfos asmInfo = ReflectionHelper.GetAssemblyInfo(to_filename);
             this.txtAssemblyName.Text = asmInfo.AssemblyName;
             this.txtNameSpace.Text    = asmInfo.NameSpace;
             this.txtClassName.Text    = asmInfo.ClassName;
             ConnectInfo connectInfo = ReflectionHelper.CreateInstance <ConnectInfo>(asmInfo.AssemblyName, asmInfo.NameSpace, asmInfo.ClassName);
             this.txtDriverName.Text = connectInfo.DriverName;
             this.btnDALPath.Text    = filename;
             this.tipMessage.Show("数据访问层上传成功", this.btnDALPath, this.btnDALPath.Location, 2000);
         }
     }
     catch (Exception ex)
     {
         this.tipMessage.Show("数据访问层上传失败", this.btnDALPath, this.btnDALPath.Location, 2000);
         LogHelper.Error(ex);
     }
 }
Пример #4
0
 public DocsType(string filePath, XDocument xDoc, XElement xeRoot)
     : base(xeRoot)
 {
     FilePath = filePath;
     XDoc     = xDoc;
     AssemblyInfos.AddRange(XERoot.Elements("AssemblyInfo").Select(x => new DocsAssemblyInfo(x)));
 }
Пример #5
0
        public IPersistentAssemblyInfo[] ValidateAssemblyInfos()
        {
            var infos = (from info in AssemblyInfos.Where(ShouldValidate)
                         let result = Validate(info)
                                      where CanLoad(result)
                                      select info).ToArray();

            _objectSpace.CommitChanges();
            return(infos);
        }
Пример #6
0
 private void RenewList(string path)
 {
     try
     {
         AssemblyInfos.AddElement(LoadAssembly(path));
     }
     catch (FileNotFoundException)
     {
         Console.WriteLine("File not found.");
     }
 }
Пример #7
0
        private void OpenFiles(IEnumerable <string> files, IProgress <int> progress)
        {
            if (files != null)
            {
                Task.Factory.StartNew <IEnumerable <AssemblyInfo> >(() =>
                {
                    List <AssemblyInfo> ais = new List <AssemblyInfo>();
                    int totalNumberOfFiles  = files.Count();
                    try
                    {
                        for (int i = 0; i < totalNumberOfFiles; i++)
                        {
                            string file = files.ElementAt(i);
                            if (HasCorrectFileExtension(file))
                            {
                                AssemblyInfo ai = GetAssemblyInfo(file);
                                if (ai != null)
                                {
                                    ais.Add(ai);
                                }
                            }

                            if (progress != null)
                            {
                                progress.Report(100 * (i + 1) / totalNumberOfFiles);
                            }
                        }
                    }
                    finally
                    {
                        //Ensure that the progress is set to 100%
                        if (progress != null)
                        {
                            progress.Report(100);
                        }
                    }
                    return(ais);
                }).ContinueWith((antecedent) =>
                {
                    foreach (AssemblyInfo ai in antecedent.Result)
                    {
                        if (AssemblyInfos.FirstOrDefault(x => x.FullPath == ai.FullPath) == null)
                        {
                            AssemblyInfos.Add(ai);
                        }
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
        }