public CalendarStore(Federation fed, string ns, int year, int month) { SetFederation(fed); Namespace = ns; Year = year; Month = month; foreach (DateTime each in Dates) { AbsoluteTopicName abs = TopicNameForDate(each); _Topics[abs] = each; _Topics[abs.LocalName] = each; } AbsoluteTopicName a = new AbsoluteTopicName("_NormalBorders", Namespace); BackingTopic top = new BackingTopic(a, DefaultNormalBordersContent, true); BackingTopics[a.Name] = top; _Topics[a] = DateTime.MinValue; }
void Read() { if (_State == State.Loading) throw new Exception("Recursion problem: already loading ContentBase for " + _Root); ImportedNamespaces = new ArrayList(); Description = null; Title = null; ImageURL = null; Contact = null; _State = State.Loading; _LastRead = DateTime.Now; DisplaySpacesInWikiLinks = false; // the default, applied if *.config key is missing and _ContentBaseDefinition property is missing if (System.Configuration.ConfigurationSettings.AppSettings["DisplaySpacesInWikiLinks"] != null) DisplaySpacesInWikiLinks = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["DisplaySpacesInWikiLinks"]); string filename = DefinitionTopicFilePath; if (File.Exists(filename)) { DefinitionTopicLastRead = File.GetLastWriteTime(filename); string body; using (StreamReader sr = new StreamReader(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))) { body = sr.ReadToEnd(); } Hashtable hash = ExtractExplicitFieldsFromTopicBody(body); Title = (string)hash["Title"]; string homePage = (string)hash["HomePage"]; if (homePage != null) { HomePage = homePage; } Description = (string)hash["Description"]; ImageURL = (string)hash["ImageURL"]; Contact = (string)hash["Contact"]; if(hash.ContainsKey("DisplaySpacesInWikiLinks")) // _ContentBaseDefinition property overrides *.config setting DisplaySpacesInWikiLinks = Convert.ToBoolean(hash["DisplaySpacesInWikiLinks"]); string importList = (string)hash["Import"]; if (importList != null) { foreach (string each in Federation.ParseListPropertyValue(importList)) { ImportedNamespaces.Add(each); } } } // Establish backing topics AbsoluteTopicName a; BackingTopic top; a = new AbsoluteTopicName((HomePage == null ? "HomePage" : HomePage), Namespace); top = new BackingTopic(a, DefaultHomePageContent, true); BackingTopics[a.Name] = top; a = new AbsoluteTopicName("_NormalBorders", Namespace); top = new BackingTopic(a, DefaultNormalBordersContent, true); BackingTopics[a.Name] = top; _State = State.Loaded; }
public BackingTopicTopicData(BackingTopic back) { _Back = back; }
/// <summary> /// Read the Namespace details from the store. /// </summary> private void Read() { if (_State == State.Loading) throw new Exception("Recursion problem: already loading ContentBase for " + Namespace); ImportedNamespaces = new ArrayList(); Description = null; Title = null; ImageURL = null; Contact = null; _State = State.Loading; _LastRead = DateTime.Now; DisplaySpacesInWikiLinks = false; // the default, applied if *.config key is missing and _ContentBaseDefinition property is missing if (System.Configuration.ConfigurationSettings.AppSettings["DisplaySpacesInWikiLinks"] != null) DisplaySpacesInWikiLinks = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["DisplaySpacesInWikiLinks"]); if (SqlHelper.TopicExists(Namespace, ContentBase.DefinitionTopicLocalName, ConnectionString)) { DefinitionTopicLastRead = SqlHelper.GetTopicLastWriteTime(Namespace, ContentBase.DefinitionTopicLocalName, ConnectionString); Hashtable hash = ExtractExplicitFieldsFromTopicBody(SqlHelper.GetTopicBody(Namespace, ContentBase.DefinitionTopicLocalName, ConnectionString)); Title = (string)hash["Title"]; string homePage = (string)hash["HomePage"]; if (homePage != null) { HomePage = homePage; } Description = (string)hash["Description"]; ImageURL = (string)hash["ImageURL"]; Contact = (string)hash["Contact"]; if(hash.ContainsKey("DisplaySpacesInWikiLinks")) // _ContentBaseDefinition property overrides *.config setting DisplaySpacesInWikiLinks = Convert.ToBoolean(hash["DisplaySpacesInWikiLinks"]); string importList = (string)hash["Import"]; if (importList != null) { foreach (string each in Federation.ParseListPropertyValue(importList)) { ImportedNamespaces.Add(each); } } } // Establish backing topics AbsoluteTopicName a; BackingTopic top; a = new AbsoluteTopicName("HomePage", Namespace); top = new BackingTopic(a, DefaultHomePageContent, true); BackingTopics[a.Name] = top; a = new AbsoluteTopicName("_NormalBorders", Namespace); top = new BackingTopic(a, DefaultNormalBordersContent, true); BackingTopics[a.Name] = top; _State = State.Loaded; }