public bool NextByte() { if (position >= length) { return(false); } value = (ulong)Varint(); tag = (int)value >> 3; wireType = (WireTypes)(value & 0x07); return(true); }
/// <summary> /// Move to next byte and set wire type. Throws exeception if tag is out of range /// </summary> /// <returns>Returns false if at end of buffer</returns> public bool NextByte() { if (_pos >= _length) { return(false); } // get and process the next byte in the buffer // return true until end of stream Value = (ulong)Varint(); Tag = (int)Value >> 3; if ( (Tag == 0 || Tag >= 19000) && (Tag > 19999 || Tag <= ((1 << 29) - 1)) ) { throw new System.Exception("tag out of range"); } WireType = (WireTypes)(Value & 0x07); return(true); }
public string GetPreviewForTopic(WireTypes.AbsoluteTopicName topicName, string textToFormat) { // OmarS: why do I have to do this? NamespaceManager relativeToBase = Federation.NamespaceManagerForNamespace(topicName.Namespace); return FlexWiki.Formatting.Formatter.FormattedString(null, textToFormat, OutputFormat.HTML, relativeToBase, TheLinkMaker); }
public string GetHtmlForTopicVersion(WireTypes.AbsoluteTopicName topicName, string version) { QualifiedTopicRevision atn = new QualifiedTopicRevision(topicName.Name, topicName.Namespace); return InternalGetHtmlForTopic(atn, version); }
public WireTypes.AbsoluteTopicNameCollection GetAllTopics(WireTypes.ContentBase cb) { WireTypes.AbsoluteTopicNameCollection topicNames = new WireTypes.AbsoluteTopicNameCollection(); foreach (TopicName ab in Federation.NamespaceManagerForNamespace(cb.Namespace).AllTopics(ImportPolicy.DoNotIncludeImports)) { // We need to also return the current version NamespaceManager contentStoreManager2 = Federation.NamespaceManagerForTopic(ab); WireTypes.AbsoluteTopicName atn = new WireTypes.AbsoluteTopicName(); atn.Name = ab.LocalName; atn.Namespace = ab.Namespace; string version = contentStoreManager2.LatestVersionForTopic(ab.LocalName); if (version == null) { // There's only one version, so just use the empty string version = ""; } atn.Version = version; topicNames.Add(atn); } return topicNames; }
/// <summary> /// PbfReader constructor /// </summary> /// <param name="tileBuffer">Byte array containing the raw (already unzipped) tile data</param> public PbfReader(byte[] tileBuffer) { _buffer = tileBuffer; _length = (ulong)_buffer.Length; WireType = WireTypes.UNDEFINED; }
public StringCollection GetVersionsForTopic(WireTypes.AbsoluteTopicName topicName) { StringCollection topicVersions = new StringCollection(); AbsoluteTopicName atn = new AbsoluteTopicName(topicName.Name, topicName.Namespace); IEnumerable changeList = TheFederation.ContentBaseForTopic(atn).AllChangesForTopic(atn.LocalName); foreach (TopicChange change in changeList) { topicVersions.Add(change.Version); } return topicVersions; }
public void RestoreTopic(WireTypes.AbsoluteTopicName topicName, string visitorIdentityString, string version) { if (version != null && version == topicName.Version) { throw new Exception("Version not found"); } else { QualifiedTopicRevision atn = new QualifiedTopicRevision(topicName.Name, topicName.Namespace); IEnumerable changeList = Federation.NamespaceManagerForTopic(atn).AllChangesForTopic(atn.LocalName); foreach (TopicChange change in changeList) { if (change.Version == version) { WriteNewTopic(change.TopicRevision, Federation.Read(change.TopicRevision), visitorIdentityString, version); break; } } } }
public string GetPreviewForTopic(WireTypes.AbsoluteTopicName topicName, string textToFormat) { _linkMaker = new LinkMaker(RootUrl(Context.Request)); // OmarS: why do I have to do this? ContentBase relativeToBase = TheFederation.ContentBaseForNamespace(topicName.Namespace); return FlexWiki.Formatting.Formatter.FormattedString(null, textToFormat, Formatting.OutputFormat.HTML, relativeToBase, _linkMaker, null); }
public string GetTextForTopic(WireTypes.AbsoluteTopicName topicName) { string content = null; // OmarS: Do I need to check for Topic existence? AbsoluteTopicName atn = new AbsoluteTopicName(topicName.Name, topicName.Namespace); if (TheFederation.ContentBaseForTopic(atn).TopicExists(atn)) { content = TheFederation.ContentBaseForTopic(atn).Read(atn.LocalName); } if (content == null) { content = "[enter your text here]"; } return content; }
public string GetHtmlForTopicVersion(WireTypes.AbsoluteTopicName topicName, string version) { AbsoluteTopicName atn = new AbsoluteTopicName(topicName.Name, topicName.Namespace); return InternalGetHtmlForTopic(atn, version); }
public string GetHtmlForTopic(WireTypes.AbsoluteTopicName topicName) { AbsoluteTopicName atn = new AbsoluteTopicName(topicName.Name, topicName.Namespace); return InternalGetHtmlForTopic(atn, null); }
public WireTypes.AbsoluteTopicNameCollection GetAllTopics(WireTypes.ContentBase cb) { WireTypes.AbsoluteTopicNameCollection topicNames = new WireTypes.AbsoluteTopicNameCollection(); foreach (AbsoluteTopicName ab in TheFederation.ContentBaseForNamespace(cb.Namespace).AllTopics(false)) { // We need to also return the current version ContentBase cb2 = TheFederation.ContentBaseForTopic(ab); WireTypes.AbsoluteTopicName atn = new WireTypes.AbsoluteTopicName(); atn.Name = ab.Name; atn.Namespace = ab.Namespace; string version = cb2.LatestVersionForTopic(ab.LocalName); if (version == null) { // There's only one version, so just use the empty string version = ""; } atn.Version = version; topicNames.Add(atn); } return topicNames; }
public string GetTextForTopic(WireTypes.AbsoluteTopicName topicName) { string content = null; // OmarS: Do I need to check for Topic existence? QualifiedTopicRevision atn = new QualifiedTopicRevision(topicName.Name, topicName.Namespace); atn.Version = topicName.Version; if (Federation.TopicExists(atn)) { content = Federation.Read(atn); } if (content == null) { content = "[enter your text here]"; } return content; }
public void RestoreTopic(WireTypes.AbsoluteTopicName topicName, string visitorIdentityString, string version) { if (version != null && version == topicName.Version) { throw new Exception("Version not found"); } else { AbsoluteTopicName atn = new AbsoluteTopicName(topicName.Name, topicName.Namespace); IEnumerable changeList = TheFederation.ContentBaseForTopic(atn).AllChangesForTopic(atn.LocalName); foreach (TopicChange change in changeList) { if (change.Version == version) { WriteNewTopic(change.Topic, TheFederation.ContentBaseForTopic(atn).Read(change.Topic.LocalName), visitorIdentityString, version); break; } } } }
public StringCollection GetVersionsForTopic(WireTypes.AbsoluteTopicName topicName) { StringCollection topicVersions = new StringCollection(); QualifiedTopicRevision atn = new QualifiedTopicRevision(topicName.Name, topicName.Namespace); IEnumerable changeList = Federation.NamespaceManagerForTopic(atn).AllChangesForTopic(atn.LocalName); foreach (TopicChange change in changeList) { topicVersions.Add(change.Version); } return topicVersions; }
public void SetTextForTopic(WireTypes.AbsoluteTopicName topicName, string postedTopicText, string visitorIdentityString) { AbsoluteTopicName atn = new AbsoluteTopicName(topicName.Name, topicName.Namespace); WriteNewTopic(atn, postedTopicText, GetVisitorIdentity(visitorIdentityString), null); }
public void SetTextForTopic(WireTypes.AbsoluteTopicName topicName, string postedTopicText, string visitorIdentityString) { if (WriteAllowed()) { QualifiedTopicRevision atn = new QualifiedTopicRevision(topicName.Name, topicName.Namespace); WriteNewTopic(atn, postedTopicText, GetVisitorIdentity(visitorIdentityString), null); Federation.Application.LogDebug(this.GetType().ToString(), "Allowed - " + Context.Request.UserHostAddress + ": " + Context.Request.Url); } else { Federation.Application.LogDebug(this.GetType().ToString(), "Denied - " + Context.Request.UserHostAddress + ": " + Context.Request.Url); } }
public OnlineMapsPBFReader(byte[] buffer) { this.buffer = buffer; length = (ulong)this.buffer.Length; wireType = WireTypes.UNDEFINED; }