当前位置: 首页>>代码示例>>C#>>正文


C# Section类代码示例

本文整理汇总了C#中Section的典型用法代码示例。如果您正苦于以下问题:C# Section类的具体用法?C# Section怎么用?C# Section使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Section类属于命名空间,在下文中一共展示了Section类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SDT

		/// <summary>
		/// Create a new <i>Service Description Table</i> instance.
		/// </summary>
		/// <param name="section">The section which is currently parsed.</param>
		public SDT(Section section) : base(section)
		{
			// Get the size of the service entry region
			int offset = 8, length = section.Length - 3 - offset - 4;

			// Minimum size
			if ( length < 0 ) return;

			// Construct
			TransportStreamIdentifier = Tools.MergeBytesToWord(section[1], section[0]);
			OriginalNetworkIdentifier = Tools.MergeBytesToWord(section[6], section[5]);

			// Create helper
			ArrayList services = new ArrayList();

			// Process
			for ( ServiceEntry entry ; null != (entry = ServiceEntry.Create(this, offset, length)) ; )
				if ( entry.IsValid )
				{
					// Remember
					services.Add(entry);

					// Correct
					offset += entry.Length;
					length -= entry.Length;
				}

			// Usefull
			m_IsValid = (0 == length);

			// Convert
			if ( m_IsValid ) Services = (ServiceEntry[])services.ToArray(typeof(ServiceEntry));
		}
开发者ID:davinx,项目名称:DVB.NET---VCR.NET,代码行数:37,代码来源:SDT.cs

示例2: Get

		public static IEnumerable<Section> Get(IEnumerable<Assembly> testAssemblies)
		{
			var categories = new Dictionary<string, Section>();
			foreach (var asm in testAssemblies)
			{
				foreach (var type in asm.ExportedTypes)
				{
					#if PCL
					var section = type.GetTypeInfo().GetCustomAttribute<SectionAttribute>(false);
					#else
					var section = type.GetCustomAttribute<SectionAttribute>(false);
					#endif
					if (section != null)
					{
						if (section.Requires != null && !Platform.Instance.Supports(section.Requires))
							continue;

						Section category;
						if (!categories.TryGetValue(section.Category, out category))
							categories.Add(section.Category, category = new Section { Text = section.Category });

						var testType = type;
						category.Add(new SectionItem { Creator = () => Activator.CreateInstance(testType) as Control, Text = section.Name });
					}
				}
			}
			foreach (var category in categories.Values)
				category.Sort((x, y) => string.Compare(x.Text, y.Text, StringComparison.CurrentCultureIgnoreCase));
			return categories.Values.OrderBy(r => r.Text);
		}
开发者ID:mhusen,项目名称:Eto,代码行数:30,代码来源:TestSections.cs

示例3: AddSection

 //returns the cost of the newly added section
 public void AddSection(Section s)
 {
     this.sections.Add(s);
     s.attributes.height = this.sections.Count-1;
     s.attributes.myTower = this;
     StressCheck();
 }
开发者ID:austinblakeslee,项目名称:verthex,代码行数:8,代码来源:Tower.cs

示例4: LastfmPreferences

        public LastfmPreferences (LastfmSource source)
        {
            var service = ServiceManager.Get<PreferenceService> ();
            if (service == null) {
                return;
            }

            this.source = source;

            service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters;
            source_page = new Banshee.Preferences.SourcePage (source) {
                (account_section = new Section ("lastfm-account", Catalog.GetString ("Account"), 20) {
                    (username_preference = new SchemaPreference<string> (LastfmSource.LastUserSchema,
                        Catalog.GetString ("_Username")) {
                        ShowLabel = false
                    }),
                    new VoidPreference ("lastfm-signup")
                }),
                (prefs_section = new Section ("lastfm-settings", Catalog.GetString ("Preferences"), 30))
            };

            scrobbler = ServiceManager.Get<Banshee.Lastfm.Audioscrobbler.AudioscrobblerService> ();
            if (scrobbler != null) {
                reporting_preference = new Preference<bool> ("enable-song-reporting",
                    Catalog.GetString ("_Enable Song Reporting"), null, scrobbler.Enabled);
                reporting_preference.ValueChanged += root => scrobbler.Enabled = reporting_preference.Value;
                prefs_section.Add (reporting_preference);
            }
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:29,代码来源:LastfmPreferences.cs

示例5: MultipleChoiceEntryElement

 public MultipleChoiceEntryElement (string caption, params string[] options): base(caption, new RadioGroup(-1)) {
     var section = new Section(caption);
     foreach(var s in options) {
         section.Add(new RadioEntryElement(s));
     }
     Add(section);
 }
开发者ID:cmckeegan,项目名称:MonoTouch.Dialog,代码行数:7,代码来源:MultipleChoiceEntryElement.cs

示例6: ScrapePage

        public List<ArticleInfo> ScrapePage(Section section, int page)
        {
            var builder = new UriBuilder(section.Host);
            builder.Path += section.RelativeUrl;
            var url = builder.ToString().AddQueryParameterToUrl("page", page);

            var docNode = Utilities.DownloadPage(url);
            var articleDivs = docNode.SelectNodes("//div[@class='category-headline-item']");

            var result = new List<ArticleInfo>();

            foreach (var articleDiv in articleDivs)
            {
                try
                {
                    result.Add(ParseArticleInfoDiv(articleDiv));
                }
                catch (CommonParsingException e)
                {
                }
                catch (Exception e)
                {
                    e.Data["articleDiv"] = articleDiv.OuterHtml;
                    _log.Error("An error occurred while parsing article info div.", e);
                }
            }

            return result;
        }
开发者ID:jonas-paul,项目名称:portal-scrape,代码行数:29,代码来源:DelfiArticleInfoScraper.cs

示例7: Edit

        public ActionResult Edit(string id, Section section)
        {
            RavenSession.Store(section);
              RavenSession.SaveChanges();

              return RedirectToAction("Index");
        }
开发者ID:haiku80,项目名称:raventest,代码行数:7,代码来源:SectionsController.cs

示例8: LoadLanguages

        private async Task LoadLanguages()
        {
            var lRepo = new LanguageRepository();
            var langs = await lRepo.GetLanguages();

            var sec = new Section();

            langs.Insert(0, new Language("All Languages", null));
            sec.AddAll(langs.Select(x =>
            {
                var el = new StringElement(x.Name) { Accessory = UITableViewCellAccessory.None };
                el.Clicked.Subscribe(_ => _languageSubject.OnNext(x));
                return el;
            }));

            Root.Reset(sec);

            if (SelectedLanguage != null)
            {
                var el = sec.Elements.OfType<StringElement>().FirstOrDefault(x => string.Equals(x.Caption, SelectedLanguage.Name));
                if (el != null)
                    el.Accessory = UITableViewCellAccessory.Checkmark;

                var indexPath = el?.IndexPath;
                if (indexPath != null)
                    TableView.ScrollToRow(indexPath, UITableViewScrollPosition.Middle, false);
            }
        }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:28,代码来源:LanguagesViewController.cs

示例9: ParseTimeoutSleepIntervalSettings

		/// <summary>
		/// Parses the timeout sleep interval settings.
		/// </summary>
		/// <param name="section">The section.</param>
		/// <returns></returns>
		private TimeSpan ParseTimeoutSleepIntervalSettings(Section section)
		{
			TimeSpan timeSpan = _defaultSleepInterval;

			if (section.Settings.ContainsKey("Timeout"))
			{
				int interval;
				if (int.TryParse(section.Settings["Timeout"].Value, out interval))
				{
					timeSpan = TimeSpan.FromMilliseconds(interval);
				}
				else
				{
					UnityResolver.UnityContainer.Resolve<ILogger>().LogEvent(() =>
						Config.AppEvents.GainWinServicesExactTarget.ExactTargetWarning,
						string.Format("Can't parse timeout setting (='{1}') for {0}. {2} msec  will be used by default.",
						GetType().Name, section.Settings["Timeout"].Value, _defaultSleepInterval.TotalMilliseconds));
				}
			}
			else
			{
				UnityResolver.UnityContainer.Resolve<ILogger>().LogEvent(() =>
					Config.AppEvents.GainWinServicesExactTarget.ExactTargetWarning,
					string.Format("Can't read timeout setting for {0}. {1} msec  will be used by default.",
					GetType().Name, _defaultSleepInterval.TotalMilliseconds));
			}

			return timeSpan;
		}
开发者ID:evkap,项目名称:ExactTarget,代码行数:34,代码来源:SleepIntervalCalculator.cs

示例10: PAT

        /// <summary>
        /// Create a new <i>Program Association Table</i> instance.
        /// </summary>
        /// <param name="section">The section which is currently parsed.</param>
        public PAT(Section section)
            : base(section)
        {
            // Get position size of the program list
            int offset = 5, length = section.Length - 3 - offset - 4;

            // Minimum size
            if (length < 0) return;

            // Construct
            TransportStreamIdentifier = Tools.MergeBytesToWord(section[1], section[0]);

            // Process all
            for (; length >= 4; offset += 4, length -= 4)
            {
                // Load items
                ushort number = Tools.MergeBytesToWord(section[offset + 1], section[offset + 0]);
                ushort pid = (ushort)(0x1fff&Tools.MergeBytesToWord(section[offset + 3], section[offset + 2]));

                // Remember
                if (0 == number)
                {
                    // The NIT
                    NetworkInformationTable = pid;
                }
                else
                {
                    // Some program
                    ProgramIdentifier[number] = pid;
                }
            }

            // Usefull
            m_IsValid = (0 == length);
        }
开发者ID:bietiekay,项目名称:YAPS,代码行数:39,代码来源:PAT.cs

示例11: TOT

        /// <summary>
        /// Erzeugt eine neue Tabelle.
        /// </summary>
        /// <param name="section">Der Bereich, in den die Tabelle eingebettet ist.</param>
        public TOT( Section section )
            : base( section )
        {
            // Load length
            int length = section.Length - 7;

            // Check for minimum length required
            if (length < 7) 
                return;

            // Load the time
            Time = Tools.DecodeTime( section, 0 );

            // Correct
            length -= 7;

            // Load the length of the descriptors
            int deslen = Tools.MergeBytesToWord( section[6], section[5] ) & 0x0fff;

            // Validate
            if (deslen > length)
                return;

            // Create my descriptors
            Descriptors = Descriptor.Load( this, 7, deslen );

            // Done
            m_IsValid = (deslen == length);
        }
开发者ID:davinx,项目名称:DVB.NET---VCR.NET,代码行数:33,代码来源:TOT.cs

示例12: ConfigurationService

        internal ConfigurationService()
        {
            var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            _configPath = Path.Combine(appData, AppFolderName);
            _configFileName = Path.Combine(_configPath, ConfigFileName);

            if(!Directory.Exists(_configPath))
            {
                try
                {
                    Directory.CreateDirectory(_configPath);
                }
                catch(Exception exc)
                {
                    if(exc.IsCritical())
                    {
                        throw;
                    }
                    LoggingService.Global.Error(exc);
                }
            }

            _configuration            = LoadConfig(ConfigFileName, "Configuration");
            _rootSection              = _configuration.RootSection;
            _guiSection               = _rootSection.GetCreateSection("Gui");
            _globalSection            = _rootSection.GetCreateSection("Global");
            _viewsSection             = _rootSection.GetCreateSection("Tools");
            _providersSection         = _rootSection.GetCreateSection("Providers");
            _repositoryManagerSection = _rootSection.GetCreateSection("RepositoryManager");
        }
开发者ID:Kuzq,项目名称:gitter,代码行数:30,代码来源:ConfigurationService.cs

示例13: GetInstruments

 /// <summary>
 /// Gets a list of Instrument objects filtered by a section
 /// </summary>
 /// <param name="selectedSection">A section to filter instruments by</param>
 /// <returns></returns>
 //public List<Instrument> GetInstruments(Section selectedSection)
 //{
 //    using (dbconn = new SqlConnection(Music.Properties.Settings.Default.orchestraConnection))
 //    {
 //        dbconn.Open();
 //        dbcomm = new SqlCommand(String.Format("select Instrument, Type from Instruments where Type = '{0}' order by Type asc",selectedSection.ToString()), dbconn);
 //        dbreader = dbcomm.ExecuteReader();
 //        List<Instrument> instruments = new List<Instrument>();
 //        while (dbreader.Read())
 //        {
 //            string instrumentName = dbreader["Instrument"].ToString();
 //            Section instrumentType;
 //            if (Enum.TryParse<Section>(dbreader["Type"].ToString(), true, out instrumentType))
 //                instruments.Add(new Instrument(instrumentName, instrumentType));
 //            else
 //                instruments.Add(new Instrument());
 //        }
 //        dbconn.Close();
 //        return instruments;
 //    }
 //}
 /// <summary>
 /// Gets a list of Instrument objects filtered by an array of Sections
 /// </summary>
 /// <param name="selectedSection">An array to filter instruments by</param>
 /// <returns></returns>
 public List<Instrument> GetInstruments(Section[] selectedSection)
 {
     try
     {
         using (dbconn = new SqlConnection(Music.Properties.Settings.Default.orchestraConnection))
         {
             dbconn.Open();
             //This command creates a sql string that checks for instruments of a type contained in the parameter list which is created by using a string join and some string formats
             dbcomm = new SqlCommand(String.Format("select Instrument, Type from Instruments where Type in({0}) order by Instrument asc", String.Join(",", selectedSection.Select(x => String.Format("'{0}'", x.ToString())).ToArray())), dbconn);
             dbreader = dbcomm.ExecuteReader();
             List<Instrument> instruments = new List<Instrument>();
             while (dbreader.Read())
             {
                 string instrumentName = dbreader["Instrument"].ToString();
                 Section instrumentType;
                 //This sneaky little section tries to parse the instrument value of the instrument by using the Enum.TryParse which returns a bool, if false there is a bad type and a default instrument replaces it
                 if (Enum.TryParse<Section>(dbreader["Type"].ToString(), true, out instrumentType))
                     instruments.Add(new Instrument(instrumentName, instrumentType));
                 else
                     instruments.Add(new Instrument());
             }
             return instruments;
         }
     }
     catch
     {
         throw new ArgumentException("Something has gone horribly, horribly wrong. Most likely my SQL instance is unreachable or down.");
     }
 }
开发者ID:vanhouc,项目名称:vanhouc-final,代码行数:60,代码来源:DataRepository.cs

示例14: PopulateTable

		/// <summary>
		/// Populates the page with sessions, grouped by time slot
		/// that are marked as 'favorite'
		/// </summary>
		protected override void PopulateTable()
		{
			// get the sessions from the database
			var sessions = BL.Managers.SessionManager.GetSessions ();
			var favs = BL.Managers.FavoritesManager.GetFavorites();
			// extract IDs from Favorites query
			List<string> favoriteIDs = new List<string>();
			foreach (var f in favs) favoriteIDs.Add (f.SessionKey);

			// build list, matching the Favorite.SessionKey with actual
			// Session.Key rows - which might have moved if the data changed
			var root = 	new RootElement ("Favorites") {
						from s in sessions
							where favoriteIDs.Contains(s.Key)
							group s by s.Start.Ticks into g
							orderby g.Key
							select new Section (new DateTime (g.Key).ToString ("dddd HH:mm")) {
							from hs in g
							   select (Element) new SessionElement (hs)
			}};	
			
			if(root.Count == 0) {
				var section = new Section("No favorites") {
					new StyledStringElement("Touch the star to favorite a session") 
				};
				root.Add(section);
			}
			Root = root;
		}	
开发者ID:slodge,项目名称:mobile-samples,代码行数:33,代码来源:FavoritesScreen.cs

示例15: ResetTest

        public void ResetTest()
        {
            var objectFile = new ObjectFileMock();
            Context context = new Context(objectFile);

            Section section = new Section("Test");
            var symbol = new Symbol(SymbolType.Public, "test");
            var relocation = new Relocation(symbol, section, 0, 0, RelocationType.Default32);

            context.SymbolTable.Add(symbol);
            context.RelocationTable.Add(relocation);
            context.Section = section;
            context.Address = 123456789;
            Assert.AreEqual(symbol, context.SymbolTable[0]);
            Assert.AreEqual(relocation, context.RelocationTable[0]);
            Assert.AreEqual(section, context.Section);
            Assert.AreEqual((Int128)123456789, context.Address);

            context.Reset();

            // These have not changed
            Assert.AreEqual(symbol, context.SymbolTable[0]);
            Assert.AreEqual(relocation, context.RelocationTable[0]);

            // These are reset
            Assert.AreEqual(null, context.Section);
            Assert.AreEqual((Int128)0, context.Address);
        }
开发者ID:Konctantin,项目名称:CSharpAssembler,代码行数:28,代码来源:ContextTests.cs


注:本文中的Section类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。