public bool AddNumberSet(NumberSet newNumberSet) { return(_numberSetDomain.AddNumberSet(newNumberSet)); }
/* Function: ResolveNewTopics * * Goes through the IDs of newly created <Topics> and sees if they serve as better targets for any existing links. * * Parameters: * * topicIDs - The set of IDs to check. Every <Topic> represented here must have the same <EndingSymbol>. * endingSymbol - The <EndingSymbol> shared by all of the topic IDs. * accessor - The <Accessor> used for the database. * * Requirements: * * - Requires the accessor to have at least a read/possible write lock. If the link changes it will be upgraded to * read/write automatically. * */ protected void ResolveNewTopics(NumberSet topicIDs, EndingSymbol endingSymbol, Accessor accessor) { // We only need the body's length, not its contents. List <Topic> topics = accessor.GetTopicsByID(topicIDs, Delegates.NeverCancel, Accessor.GetTopicFlags.BodyLengthOnly | Accessor.GetTopicFlags.DontLookupClasses | Accessor.GetTopicFlags.DontLookupContexts); List <Link> links = accessor.GetLinksByEndingSymbol(endingSymbol, Delegates.NeverCancel, Accessor.GetLinkFlags.DontLookupClasses); // Go through each link and see if any of the topics serve as a better target. It's better for the links to be the outer loop // because we can generate alternate interpretations only once per link. foreach (Link link in links) { List <LinkInterpretation> alternateInterpretations = null; if (link.Type == LinkType.NaturalDocs) { string ignore; alternateInterpretations = EngineInstance.Comments.NaturalDocsParser.LinkInterpretations(link.Text, Comments.Parsers.NaturalDocs.LinkInterpretationFlags.FromOriginalText | Comments.Parsers.NaturalDocs.LinkInterpretationFlags.AllowNamedLinks | Comments.Parsers.NaturalDocs.LinkInterpretationFlags.AllowPluralsAndPossessives, out ignore); } int bestMatchTopicID = link.TargetTopicID; int bestMatchClassID = link.TargetClassID; long bestMatchScore = link.TargetScore; foreach (Topic topic in topics) { // No use rescoring the existing target. if (topic.TopicID != link.TargetTopicID) { long score = Manager.Score(link, topic, bestMatchScore, alternateInterpretations); if (score > bestMatchScore) { bestMatchTopicID = topic.TopicID; bestMatchClassID = topic.ClassID; bestMatchScore = score; } } } if (bestMatchTopicID != link.TargetTopicID || bestMatchClassID != link.TargetClassID || bestMatchScore != link.TargetScore) { int oldTargetTopicID = link.TargetTopicID; int oldTargetClassID = link.TargetClassID; link.TargetTopicID = bestMatchTopicID; link.TargetClassID = bestMatchClassID; link.TargetScore = bestMatchScore; accessor.UpdateLinkTarget(link, oldTargetTopicID, oldTargetClassID); } } }
/* Function: Load * Loads the information in <BuildState.nd> and returns whether it was successful. If not the function will return an empty * BuildState object. */ public bool Load(Path filename, out BuildState buildState, out UnprocessedChanges unprocessedChanges) { // Since we're creating new objects only we have access to them right now and thus we don't need to use Lock() and // Unlock(). buildState = new BuildState(); unprocessedChanges = new UnprocessedChanges(); BinaryFile binaryFile = new BinaryFile(); bool result = true; try { if (binaryFile.OpenForReading(filename, "2.2") == false) { result = false; } else { // [Byte: Need to Build Frame Page (0 or 1)] // [Byte: Need to Build Home Page (0 or 1)] // [Byte: Need to Build Main Style Files (0 or 1)] // [Byte: Need to Build Menu (0 or 1)] // [Byte: Need to Build Main Search Files (0 or 1)] unprocessedChanges.framePage = (binaryFile.ReadByte() == 1); unprocessedChanges.homePage = (binaryFile.ReadByte() == 1); unprocessedChanges.mainStyleFiles = (binaryFile.ReadByte() == 1); unprocessedChanges.menu = (binaryFile.ReadByte() == 1); unprocessedChanges.mainSearchFiles = (binaryFile.ReadByte() == 1); // [NumberSet: Source File IDs to Rebuild] // [NumberSet: Class IDs to Rebuild] // [NumberSet: Image File IDs to Rebuild] // [NumberSet: Style File IDs to Rebuild] // [NumberSet: Source File IDs with Content] // [NumberSet: Class IDs with Content] // [NumberSet: Used Image File IDs] // [NumberSet: Unchanged Image File Use Check IDs] unprocessedChanges.sourceFiles.ReadFrom(binaryFile); unprocessedChanges.classes.ReadFrom(binaryFile); unprocessedChanges.imageFiles.ReadFrom(binaryFile); unprocessedChanges.styleFiles.ReadFrom(binaryFile); buildState.sourceFilesWithContent.ReadFrom(binaryFile); buildState.classesWithContent.ReadFrom(binaryFile); buildState.usedImageFiles.ReadFrom(binaryFile); unprocessedChanges.unchangedImageFileUseChecks.ReadFrom(binaryFile); // [StringSet: Search Prefixes to Rebuild] // [StringSet: Folders to Check for Deletion] unprocessedChanges.searchPrefixes.ReadFrom(binaryFile); unprocessedChanges.possiblyEmptyFolders.ReadFrom(binaryFile); // [String: Menu Data File Type] [NumberSet: Menu Data File Numbers] // [String: Menu Data File Type] [NumberSet: Menu Data File Numbers] // ... // [String: null] string menuDataFileType = binaryFile.ReadString(); while (menuDataFileType != null) { Hierarchy hierarchy; if (menuDataFileType == "files") { hierarchy = Hierarchy.File; } else if (menuDataFileType == "classes") { hierarchy = Hierarchy.Class; } else if (menuDataFileType == "database") { hierarchy = Hierarchy.Database; } else { throw new NotImplementedException(); } NumberSet menuDataFileNumbers = binaryFile.ReadNumberSet(); buildState.usedMenuDataFiles.Add(hierarchy, menuDataFileNumbers); menuDataFileType = binaryFile.ReadString(); } // [String: Path to Home Page or null] // [String: Generated Timestamp or null] // [Byte: Home Page Uses Timestamp (0 or 1)] buildState.HomePage = binaryFile.ReadString(); buildState.GeneratedTimestamp = binaryFile.ReadString(); buildState.HomePageUsesTimestamp = (binaryFile.ReadByte() != 0); } } catch { result = false; } finally { binaryFile.Dispose(); } if (result == false) { buildState = new BuildState(); unprocessedChanges = new UnprocessedChanges(); } return(result); }
public bool AddNumberSet(NumberSet newNumberSet) { _numberSetRepository.AddNumberSet(newNumberSet); return(SaveData().Result); }
public TokenType NextToken() { int P; TokenType resulttype; const string EvalOperators = "*+-/()=><:;,"; const string CompositeOperators = ":!<>="; const string HexaDigits = "0123456789ABCDEF"; const string NumberSet = ".Ee"; const string FloatExplicit = "cCdDsSfF"; SkipBlanks(); P = FSourcePtr; FTokenPtr = P; resulttype = TokenType.Eof; if (P >= FExpression.Length) { resulttype = TokenType.Eof; // throw new EvalException(Translator.TranslateStr(449,"Syntax error"), // FSourceLine,P-1,""); } else if (IsValidFirstSymbol(FExpression[P])) { P++; while (P < FExpression.Length) { if (IsValidSecondSymbol(FExpression[P]) || (FExpression[P] == '.')) { P++; } else { break; } } resulttype = TokenType.Symbol; // Looks if the symbol is an operator string thetoken = FExpression.Substring(FSourcePtr, P - FSourcePtr).ToUpper(); if ((thetoken == "OR") || (thetoken == "AND") || (thetoken == "NOT") || (thetoken == "IIF")) { resulttype = TokenType.Operator; } } else if (FExpression[P] == '[') { P++; while (P < FExpression.Length) { if (FExpression[P] != ']') { P++; } else { P++; break; } } if (FExpression[P - 1] != ']') { throw new EvalException(String.Format(Translator.TranslateStr(448), "]"), FSourceLine, P - 1, ""); } resulttype = TokenType.Symbol; } else if (EvalOperators.IndexOf(FExpression[P]) >= 0) { aoperator = FExpression[P]; P++; if (P < FExpression.Length) { switch (Expression[P]) { case '=': if (CompositeOperators.IndexOf(aoperator) >= 0) { P++; } break; case '<': if (aoperator == '>') { P++; } break; case '>': if (aoperator == '<') { P++; } break; } } resulttype = TokenType.Operator; } else // Strings if ((FExpression[P] == '#') || (FExpression[P] == '\'')) { int J = 0, I = 0; FString = ""; while (P < FExpression.Length) { if (FExpression[P] == '#') { P++; while (P < FExpression.Length) { if (Char.IsDigit(FExpression[P])) { I = I * 10 + ((int)FExpression[P] - (int)'0'); P++; J++; } else { break; } } FString = FString + (char)I; } else if (FExpression[P] == '\'') { P++; while (P < FExpression.Length) { if (FExpression[P] == '\'') { P++; if (P < FExpression.Length) { if (FExpression[P] != '\'') { J++; break; } else { FString = FString + FExpression[P]; } } else { J++; break; } } else { FString = FString + FExpression[P]; } J++; P++; } } else { break; } } if (P >= FExpression.Length) { if (J == 0) { throw new EvalException(String.Format(Translator.TranslateStr(448), "'"), FSourceLine, P - 1, ""); } } resulttype = TokenType.String; } else if (FExpression[P] == '$') { P++; int I = 0, J = 0, index; if (P < FExpression.Length) { index = HexaDigits.IndexOf(Char.ToUpper(FExpression[P])); while (index >= 0) { I = I * 16 + index; J++; P++; if (P < FExpression.Length) { index = HexaDigits.IndexOf(Char.ToUpper(FExpression[P])); } else { index = -1; } } } if (J == 0) { throw new EvalException(Translator.TranslateStr(445), FSourceLine, P - 1, ""); } FInteger = I; resulttype = TokenType.Integer; } else if (Char.IsDigit(FExpression[P])) { string FNumber = ""; int decimals = -1; FNumber = FNumber + FExpression[P]; P++; resulttype = TokenType.Integer; int index; if (P < FExpression.Length) { index = NumberSet.IndexOf(FExpression[P]); while ((index >= 0) || Char.IsDigit(FExpression[P])) { if (index == 0) { if (decimals < 0) { decimals++; } else { throw new EvalException(Translator.TranslateStr(445), FSourceLine, P - 1, ""); } FNumber = FNumber + System.Globalization.NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator; resulttype = TokenType.Decimal; } else if (index < 0) { FNumber = FNumber + FExpression[P]; } else { resulttype = TokenType.Double; FNumber = FNumber + FExpression[P]; } P++; if (P >= FExpression.Length) { break; } index = NumberSet.IndexOf(FExpression[P]); } } if (FNumber.Length > 20) { resulttype = TokenType.Double; } if (resulttype == TokenType.Integer) { if (FNumber.Length > 8) { resulttype = TokenType.Double; } } // Floatexplicit if (P < FExpression.Length) { if (FloatExplicit.IndexOf(FExpression[P]) >= 0) { P++; resulttype = TokenType.Double; } } switch (resulttype) { case TokenType.Integer: FInteger = System.Convert.ToInt32(FNumber); break; case TokenType.Decimal: FDecimal = System.Convert.ToDecimal(FNumber); break; case TokenType.Double: FDouble = System.Convert.ToDouble(FNumber); break; } } FToken = resulttype; FSourcePtr = P; return(resulttype); }
/* Function: GetInfoOnLinksToTopicsWithImageLinkInSummary * * What the hell? Okay, check this out: First it finds the topics which have the passed image link in their summaries. * Then it returns aggregate information on all links that resolve to any of those topics. This is needed for keeping * tooltips accurate with differential building. It makes sense, trust me. * * Parameters: * * imageLink - The image link to look up. * fileIDs - The file IDs of all the links that resolve to the topics that have the link in the summary. Will be null if none. * classIDs - The class IDs of all the links that resolve to the topics that have the link in the summary. Will be null if none. * */ public void GetInfoOnLinksToTopicsWithImageLinkInSummary(ImageLink imageLink, out IDObjects.NumberSet fileIDs, out IDObjects.NumberSet classIDs) { accessor.RequireAtLeast(Accessor.LockType.ReadOnly); fileIDs = null; classIDs = null; // First find all the topics that have the image link in the summary. We can restrict the search to the same file ID as the link // because links appearing in a different file would be seen as a different link. Only inline image links can appear in the // summary so we don't need to orry about standalone ones. IDObjects.NumberSet topicIDs = null; string likeText = "%<image type=\"inline\" originaltext=\"" + imageLink.OriginalText.EntityEncode() + "\"%"; using (SQLite.Query query = accessor.Connection.Query("SELECT TopicID FROM Topics WHERE FileID=? AND Summary LIKE ?", imageLink.FileID, likeText)) { while (query.Step()) { if (topicIDs == null) { topicIDs = new NumberSet(); } topicIDs.Add(query.IntColumn(0)); } } if (topicIDs == null) { return; } // Now find all the links that resolve to these topics. We only need their file and class IDs though. IDObjects.NumberSet remainingTopicIDs = topicIDs; do { IDObjects.NumberSet temp; string queryText = "SELECT FileID, ClassID FROM Links WHERE " + Accessor.ColumnIsInNumberSetExpression("TargetTopicID", remainingTopicIDs, out temp); remainingTopicIDs = temp; using (SQLite.Query query = accessor.Connection.Query(queryText)) { while (query.Step()) { if (fileIDs == null) { fileIDs = new NumberSet(); } fileIDs.Add(query.IntColumn(0)); int classID = query.IntColumn(1); if (classID != 0) { if (classIDs == null) { classIDs = new NumberSet(); } classIDs.Add(classID); } } } }while (remainingTopicIDs != null); }
/* Function: AddSourceFiles * Adds a set of source file IDs to the list that need their output files rebuilt. */ public void AddSourceFiles(NumberSet fileIDs) { lock (accessLock) { sourceFiles.Add(fileIDs); } }
private async void ViewAndManageShuffles(NumberSet numberSet) { _shufflePickPage = new ShufflePickPage(numberSet); await NavigationManager.PushAsyncPage(Navigation, _shufflePickPage); }
private async void ShuffleAndPickFromNumberSet(NumberSet numberSet) { _numberSetNumbersPage = new NumberSetNumbersPage(); await NavigationManager.PushAsyncPage(Navigation, _numberSetNumbersPage); }
private void ViewAndManageShuffles(NumberSet numberSet) { var numberSetsPage = this.Parent.Parent.Parent.Parent as NumberSetsPage; numberSetsPage.ViewAndManageShuffles(numberSet); }
private void EditNumberSet(NumberSet numberSet) { var numberSetsPage = this.Parent.Parent.Parent.Parent as NumberSetsPage; numberSetsPage.EditNumberSet(numberSet); }
public void AddNumberSet(NumberSet newNumberSet) { _context.Add(newNumberSet); }
public void LoadShuffleNumbersData(NumberSet numberSet, bool shuffle = true) { _shuffleNumbersViewModel.LoadNumberSetNumbersData(numberSet, shuffle); }
public bool EditNumberSet(NumberSet numberSetToEdit) { _numberSetRepository.EditNumberSet(numberSetToEdit); return(SaveData().Result); }
public bool EditNumberSet(NumberSet numberSetToEdit) { return(_numberSetDomain.EditNumberSet(numberSetToEdit)); }
private void SelectNumberSet(NumberSet selectedNumberSet) { CurrentNumberSet = selectedNumberSet; _numberSetNumberCounter = 0; _numberSetNumbersViewModel.LoadNumberSetNumbersData(selectedNumberSet); }
/* Function: GetInfoOnLinksToTopicsWithNDLinkInSummary * * What the hell? Okay, check this out: First it finds the topics which have the passed Natural Docs link in their * summaries. Then it returns aggregate information on all links that resolve to any of those topics. This is needed * for keeping tooltips accurate with differential building. It makes sense, trust me. * * Parameters: * * link - The link to look up. It must be a Natural Docs link. * fileIDs - The file IDs of all the links that resolve to the topics that have the link in the summary. Will be null if none. * classIDs - The class IDs of all the links that resolve to the topics that have the link in the summary. Will be null if none. * */ public void GetInfoOnLinksToTopicsWithNDLinkInSummary(Link link, out IDObjects.NumberSet fileIDs, out IDObjects.NumberSet classIDs) { #if DEBUG if (link.Type != LinkType.NaturalDocs) { throw new InvalidOperationException("GetInfoOnLinksToTopicsWithNDLinkInSummary() must be used with Natural Docs links. It's right there in the title, derp."); } #endif accessor.RequireAtLeast(Accessor.LockType.ReadOnly); fileIDs = null; classIDs = null; // First find all the topics that have the link in the summary. We can restrict the search to the same file ID as the link because // links appearing in a different file would be seen as a different link. IDObjects.NumberSet topicIDs = null; string likeText = "%<link type=\"naturaldocs\" originaltext=\"" + link.Text.EntityEncode() + "\"%"; using (SQLite.Query query = accessor.Connection.Query("SELECT TopicID FROM Topics WHERE FileID=? AND Summary LIKE ?", link.FileID, likeText)) { while (query.Step()) { if (topicIDs == null) { topicIDs = new NumberSet(); } topicIDs.Add(query.IntColumn(0)); } } if (topicIDs == null) { return; } // Now find all the links that resolve to these topics. We only need their file and class IDs though. IDObjects.NumberSet remainingTopicIDs = topicIDs; do { IDObjects.NumberSet temp; string queryText = "SELECT FileID, ClassID FROM Links WHERE " + Accessor.ColumnIsInNumberSetExpression("TargetTopicID", remainingTopicIDs, out temp); remainingTopicIDs = temp; using (SQLite.Query query = accessor.Connection.Query(queryText)) { while (query.Step()) { if (fileIDs == null) { fileIDs = new NumberSet(); } fileIDs.Add(query.IntColumn(0)); int classID = query.IntColumn(1); if (classID != 0) { if (classIDs == null) { classIDs = new NumberSet(); } classIDs.Add(classID); } } } }while (remainingTopicIDs != null); }
public void RefreshData(NumberSet numberSet) { LoadNumberSetNumbersData(numberSet); }
/// <summary> /// Copy constructor /// </summary> private Cell(int number, NumberSet options) { Number = number; _options = options; }
/* Function: GetInfoOnLinksToTopicsWithNDLinkInSummary * * What the hell? Okay, check this out: First it finds the topics which have the passed Natural Docs link in their * summaries. Then it returns aggregate information on all links that resolve to any of those topics. This is needed * for keeping tooltips accurate with differential building. It makes sense, trust me. * * Parameters: * * link - The link to look up. It must be a Natural Docs link. * fileIDs - The file IDs of all the links that resolve to the topics that have the link in the summary. Will be null if none. * classIDs - The class IDs of all the links that resolve to the topics that have the link in the summary. Will be null if none. * */ public void GetInfoOnLinksToTopicsWithNDLinkInSummary(Link link, out IDObjects.NumberSet fileIDs, out IDObjects.NumberSet classIDs) { #if DEBUG if (link.Type != LinkType.NaturalDocs) { throw new InvalidOperationException("GetInfoOnLinksToTopicsWithNDLinkInSummary() must be used with Natural Docs links. It's right there in the title, derp."); } #endif accessor.RequireAtLeast(Accessor.LockType.ReadOnly); fileIDs = null; classIDs = null; IDObjects.NumberSet topicIDs = null; string likeText = "%<link type=\"naturaldocs\" originaltext=\"" + link.Text.EntityEncode() + "\"%"; using (SQLite.Query query = accessor.Connection.Query("SELECT TopicID FROM Topics WHERE FileID=? AND Summary LIKE ?", link.FileID, likeText)) { while (query.Step()) { if (topicIDs == null) { topicIDs = new NumberSet(); } topicIDs.Add(query.IntColumn(0)); } } if (topicIDs == null) { return; } StringBuilder queryText = new StringBuilder("SELECT FileID, ClassID FROM Links WHERE "); List <object> queryParams = new List <object>(); CodeDB.Accessor.AppendWhereClause_ColumnIsInNumberSet("TargetTopicID", topicIDs, queryText, queryParams); using (SQLite.Query query = accessor.Connection.Query(queryText.ToString(), queryParams.ToArray())) { while (query.Step()) { if (fileIDs == null) { fileIDs = new NumberSet(); } fileIDs.Add(query.IntColumn(0)); int classID = query.IntColumn(1); if (classID != 0) { if (classIDs == null) { classIDs = new NumberSet(); } classIDs.Add(classID); } } } }
/* Function: AddClasses * Adds a set of class IDs to the list that need their output files rebuilt. */ public void AddClasses(NumberSet classIDs) { lock (accessLock) { classes.Add(classIDs); } }
//public void SetShuffle(Shuffle shuffle) //{ // _shuffle = shuffle; // SetShuffleNumbers(_shuffle); //} //private void SetShuffleNumbers(Shuffle shuffle) //{ // _shuffle = shuffle; // List<ShuffleNumber> data = new List<ShuffleNumber>(); // if (_shuffle != null) // { // data = _numbrTumblrBusiness.GetShuffleNumbersByShuffleId(_shuffle.ShuffleID); // } // _shuffleNumbers.Clear(); // _shuffleNumbers.AddRange(data); //} public void RefreshData(Shuffle shuffle, NumberSet numberSet) { LoadShuffleNumbersData(shuffle, numberSet); }