コード例 #1
0
        /// <summary>
        /// Gets the update status of a provider.
        /// </summary>
        /// <param name="info">The component information.</param>
        /// <returns>The update status.</returns>
        private string GetUpdateStatus(ComponentInformation info)
        {
            if (!Settings.DisableAutomaticVersionCheck)
            {
                if (string.IsNullOrEmpty(info.UpdateUrl))
                {
                    return("n/a");
                }
                string       newVersion     = null;
                string       newAssemblyUrl = null;
                UpdateStatus status         = Tools.GetUpdateStatus(info.UpdateUrl, info.Version, out newVersion, out newAssemblyUrl);

                if (status == UpdateStatus.Error)
                {
                    return("<span class=\"resulterror\">" + Properties.Messages.Error + "</span>");
                }
                if (status == UpdateStatus.NewVersionFound)
                {
                    return("<span class=\"resulterror\">" + Properties.Messages.NewVersion + " <b>" + newVersion + "</b>" +
                           (string.IsNullOrEmpty(newAssemblyUrl) ? "" : " (" + Properties.Messages.AutoUpdateAvailable + ")") + "</span>");
                }
                if (status == UpdateStatus.UpToDate)
                {
                    return("<span class=\"resultok\">" + Properties.Messages.UpToDate + "</span>");
                }
                throw new NotSupportedException();
            }
            return("n/a");
        }
コード例 #2
0
        public void MergeComponentInformation()
        {
            var compInfo1 = new ComponentInformation()
            {
                //only relevant fields (I hope ;) )
                author            = "author1",
                backupSampleImage = "backupSampleImage1",
                description       = "description1",
                name        = "name1",
                sampleImage = "sampleImage1"
            };

            var compInfo2 = new ComponentInformation()
            {
                //only relevant fields (I hope ;) )
                author            = "author2",
                backupSampleImage = "backupSampleImage2",
                description       = "description2",
                name        = "name2",
                sampleImage = "sampleImage2"
            };

            var expectedCompInfo = new ComponentInformation()
            {
                author            = "author1, author2",
                backupSampleImage = "backupSampleImage1",
                description       = "Combined Voicepack: name1, name2",
                name        = "Combined Voicepack",
                sampleImage = "sampleImage1"
            };

            //VoicepackMerger.MergeComponentInformation(compInfo1, compInfo2);

            //Assert.IsTrue(VoicepackComparer.EqualComponentInformation(compInfo1, expectedCompInfo));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            ComponentInformation componentInformation = db.ComponentInformations.Find(id);

            db.ComponentInformations.Remove(componentInformation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 /// <summary>
 /// Compare ComponentInformation objects for equality.
 /// </summary>
 /// <param name="lhs">left hand side, assumed not to be null</param>
 /// <param name="rhs">right hand side, assumed not to be null</param>
 /// <returns>true if equal, false if not equal</returns>
 public static bool EqualComponentInformation(ComponentInformation lhs, ComponentInformation rhs)
 {
     return
         (lhs.name == rhs.name &&
          lhs.author == rhs.author &&
          lhs.description == rhs.description &&
          lhs.sampleImage == rhs.sampleImage &&
          lhs.backupSampleImage == rhs.backupSampleImage);
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ProviderRow" /> class.
 /// </summary>
 /// <param name="info">The original component information.</param>
 /// <param name="typeName">The type name.</param>
 /// <param name="updateStatus"></param>
 /// <param name="disabled">A value indicating whether the provider is disabled.</param>
 /// <param name="selected">A value indicating whether the provider is selected.</param>
 public ProviderRow(ComponentInformation info, string typeName, string updateStatus, bool disabled, bool selected)
 {
     name              = info.Name;
     this.typeName     = typeName;
     version           = info.Version;
     author            = info.Author;
     authorUrl         = info.Url;
     this.updateStatus = updateStatus;
     additionalClass   = disabled ? " disabled" : "";
     additionalClass  += selected ? " selected" : "";
 }
コード例 #6
0
        static SystemWebMembershipProxyProvider()
        {
            var type = typeof(SystemWebMembershipProxyProvider);

            info = new ComponentInformation("PF membership proxy", "Pathfinder-fr", type.Assembly.GetName().Version.ToString(), "http://www.pathfinder-fr.org", null);

            using (var reader = new StreamReader(type.Assembly.GetManifestResourceStream(type.Namespace + ".HelpHtml.htm")))
            {
                helpHtml = reader.ReadToEnd();
            }
        }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "InfoId,ComponentName,ComponentInfo,DataSheet,Image,ManufacturerLink,Category")] ComponentInformation componentInformation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(componentInformation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Category = new SelectList(db.Categories, "CategoryId", "CategoryName", componentInformation.Category);
     return(View(componentInformation));
 }
コード例 #8
0
        public ActionResult Create([Bind(Include = "InfoId,ComponentName,ComponentInfo,DataSheet,Image,ManufacturerLink,Category")] ComponentInformation componentInformation)
        {
            if (ModelState.IsValid)
            {
                db.ComponentInformations.Add(componentInformation);
                db.SaveChanges();
                return(Redirect("~/Components/Create?ID=" + componentInformation.InfoId));
            }

            ViewBag.Category = new SelectList(db.Categories, "CategoryId", "CategoryName", componentInformation.Category);
            return(View(componentInformation));
        }
コード例 #9
0
        // GET: ComponentInformations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ComponentInformation componentInformation = db.ComponentInformations.Find(id);

            if (componentInformation == null)
            {
                return(HttpNotFound());
            }
            return(View(componentInformation));
        }
コード例 #10
0
        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            var componentInfo = new ComponentInformation();
            var component     = new Component();

            componentInfo.ComponentName = "PSoC4";
            componentInfo.Category      = 1;
            component.ComponentNumber   = 10;
            component.ComponentInfoId   = componentInfo.InfoId;
            addComponentWithInfo(component, componentInfo);

            return(View());
        }
コード例 #11
0
        // GET: ComponentInformations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ComponentInformation componentInformation = db.ComponentInformations.Find(id);

            if (componentInformation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Category = new SelectList(db.Categories, "CategoryId", "CategoryName", componentInformation.Category);
            return(View(componentInformation));
        }
コード例 #12
0
        public void Must_Identify_All_Assembly_Metadata()
        {
            // Arrange
            var guid   = Guid.NewGuid();
            var semver = new SemVer
            {
                Major = 1,
                Minor = 2,
                Patch = 3
            };

            var assembly = new AssemblyTestBuilder("TesteAssembly1")
                           .SetCustomAttribute <AssemblyTitleAttribute>("TesteAssembly1 Title")
                           .SetCustomAttribute <AssemblyDescriptionAttribute>("Meu Assembly de Teste")
                           .SetCustomAttribute <AssemblyCompanyAttribute>("Assembly Ltda.")
                           .SetCustomAttribute <AssemblyProductAttribute>("Meu produto no Assembly")
                           .SetCustomAttribute <AssemblyCopyrightAttribute>("Copyright (c) 2020")
                           .SetCustomAttribute <AssemblyTrademarkAttribute>("E5R Development Team")
                           .SetCustomAttribute <GuidAttribute>(guid.ToString())
                           .SetCustomAttribute <AssemblyVersionAttribute>("1.2.3")
                           .Build();

            // Act
            var info = ComponentInformation.MakeFromAssembly(assembly);

            // Assert
            Assert.NotNull(info);
            Assert.NotNull(info.Version);
            Assert.Equal("TesteAssembly1", info.Name);
            Assert.Equal("TesteAssembly1 Title", info.Title);
            Assert.Equal("Meu Assembly de Teste", info.Description);
            Assert.Equal("Assembly Ltda.", info.Company);
            Assert.Equal("Meu produto no Assembly", info.Product);
            Assert.Equal("Copyright (c) 2020", info.Copyright);
            Assert.Equal("E5R Development Team", info.Trademark);
            Assert.Equal(guid.ToString(), info.Guid);
            Assert.Equal(semver.Major, info.Version.Major);
            Assert.Equal(semver.Minor, info.Version.Minor);
            Assert.Equal(semver.Patch, info.Version.Patch);
        }
コード例 #13
0
ファイル: AboutViewModel.cs プロジェクト: judwhite/CD-Tag
        private void GetAssemblies()
        {
            try
            {
                string   appDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                string[] files  = Directory.GetFiles(appDir, "*.dll", SearchOption.TopDirectoryOnly);
                ObservableCollection <ComponentInformation> items = new ObservableCollection <ComponentInformation>();
                foreach (string file in files)
                {
                    try
                    {
                        Assembly     assembly     = Assembly.LoadFrom(file);
                        AssemblyName assemblyName = assembly.GetName();
                        Version      version      = assemblyName.Version;

                        ComponentInformation info = new ComponentInformation();
                        info.Name        = assemblyName.Name;
                        info.Version     = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
                        info.SortVersion = string.Format("{0:0000000}.{1:0000000}.{2:0000000}.{3:0000000}", version.Major, version.Minor, version.Build, version.Revision);

                        items.Add(info);
                    }
                    catch (Exception ex)
                    {
                        ShowException(ex);
                    }
                }

                BeginInvoke(() =>
                {
                    ComponentsCollection = items;
                });
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
        }
コード例 #14
0
 public void addComponentWithInfo(Component component_, ComponentInformation compInfo_)
 {
     component_.ComponentInfoId = compInfo_.InfoId;
     db.ComponentInformations.Add(compInfo_);
     db.Components.Add(component_);
 }
コード例 #15
0
 public ArchitectureLayerException(ArchitectureLayerIdentifier layerId, Exception exception)
     : base(exception.Message, exception.InnerException)
 {
     Identifier    = layerId;
     ComponentInfo = ComponentInformation.MakeFromAssembly(GetCallingAssembly());
 }
コード例 #16
0
 public static void MergeComponentInformation(ComponentInformation compInfo1, ComponentInformation compInfo2)
 {
     //TODO
     //only author, description and name
     throw new NotImplementedException();
 }