Skip to content

Commit

Permalink
Merge pull request #35 from sportradar/develop
Browse files Browse the repository at this point in the history
Added Github docs
  • Loading branch information
dhrovat authored Mar 6, 2024
2 parents ce1de3d + bfd7cd8 commit 7edfafb
Show file tree
Hide file tree
Showing 4,905 changed files with 41,299 additions and 7 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added docs/HelpLibraryManagerLauncher.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions docs/Install_Odds Feed SDK Std Documentation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@ECHO OFF
CLS

REM This is an example script to show how to use the Help Library Manager Launcher to install an MS Help Viewer
REM file. You can use this as an example for creating a script to run from your product's installer.

REM NOTE: If not executed from within the same folder as the executable, a full path is required on the
REM executable and the HelpContentSetup.msha file.

IF "%1%"=="" GOTO MissingVersion
IF "%1%"=="1.0" GOTO HelpViewer1

GOTO HelpViewer2:

:HelpViewer1

REM Help Viewer 1.0
REM Uninstall first in case it is already there. If not, it won't install below. We'll ignore any error output
REM by redirecting it to NUL.
HelpLibraryManagerLauncher.exe /product "VS" /version "100" /locale en-us /uninstall /silent /vendor "Vendor Name" /productName "Odds Feed SDK Std Documentation" /mediaBookList "Odds Feed SDK Std Documentation" > NUL

REM For Help Viewer 1.0. the setup name must be HelpContentSetup.msha so make sure we copy the setup file to that
REM name. SHFB names it after the help file so that multiple files can be deployed to the same output older at
REM build time.
IF EXIST "Odds Feed SDK Std Documentation.msha" COPY /Y "Odds Feed SDK Std Documentation.msha" HelpContentSetup.msha

REM Install the new content.
HelpLibraryManagerLauncher.exe /product "VS" /version "100" /locale en-us /sourceMedia "%CD%\HelpContentSetup.msha"

GOTO Exit

:HelpViewer2

REM Help Viewer 2.x
REM Uninstall first in case it is already there. If not, it won't install below. We'll ignore any error output
REM by redirecting it to NUL.
HelpLibraryManagerLauncher.exe /viewerVersion %1 /locale en-us /wait 0 /operation uninstall /vendor "Vendor Name" /productName "Odds Feed SDK Std Documentation" /bookList "Odds Feed SDK Std Documentation" > NUL

REM Install the new content.
HelpLibraryManagerLauncher.exe /viewerVersion %1 /locale en-us /wait 0 /operation install /sourceUri "%CD%\Odds Feed SDK Std Documentation.msha"

GOTO Exit

:MissingVersion
ECHO A help viewer version parameter is required

:Exit
1,986 changes: 1,986 additions & 0 deletions docs/LastBuild.log

Large diffs are not rendered by default.

Binary file added docs/Odds Feed SDK Std Documentation.chm
Binary file not shown.
20 changes: 20 additions & 0 deletions docs/Odds Feed SDK Std Documentation.msha
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Odds Feed SDK Std Documentation</title>
</head>
<body class="vendor-book">
<div class="details">
<span class="vendor">Vendor Name</span>
<span class="locale">en-us</span>
<span class="product">Odds Feed SDK Std Documentation</span>
<span class="name">Odds Feed SDK Std Documentation</span>
</div>
<div class="package-list">
<div class="package">
<!-- NOTE: The "name" span value cannot contain any periods! -->
<span class="name">Odds Feed SDK Std Documentation</span>
<a class="current-link" href="Odds Feed SDK Std Documentation.mshc">Odds Feed SDK Std Documentation.mshc</a>
</div>
</div>
</body>
</html>
Binary file added docs/Odds Feed SDK Std Documentation.mshc
Binary file not shown.
31 changes: 31 additions & 0 deletions docs/Remove_Odds Feed SDK Std Documentation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@ECHO OFF
CLS

REM This is an example script to show how to use the Help Library Manager Launcher to remove an MS Help Viewer file.
REM You can use this as an example for creating a script to run from your product's uninstaller.

REM NOTE: If not executed from within the same folder as the executable, a full path is required on the executable.

IF "%1%"=="" GOTO MissingVersion
IF "%1%"=="1.0" GOTO HelpViewer1

GOTO HelpViewer2

:HelpViewer1

REM Help Viewer 1.0
HelpLibraryManagerLauncher.exe /product "VS" /version "100" /locale en-us /uninstall /silent /vendor "Vendor Name" /productName "Odds Feed SDK Std Documentation" /mediaBookList "Odds Feed SDK Std Documentation"

GOTO Exit

:HelpViewer2

REM Help Viewer 2.x
HelpLibraryManagerLauncher.exe /viewerVersion %1 /locale en-us /wait 0 /operation uninstall /vendor "Vendor Name" /productName "Odds Feed SDK Std Documentation" /bookList "Odds Feed SDK Std Documentation"

GOTO Exit

:MissingVersion
ECHO A help viewer version parameter is required

:Exit
235 changes: 235 additions & 0 deletions docs/SearchHelp.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<%@ Page Language="C#" EnableViewState="False" %>

<script runat="server">
//===============================================================================================================
// System : Sandcastle Help File Builder
// File : SearchHelp.aspx
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 08/13/2022
// Note : Copyright 2007-2022, Eric Woodruff, All rights reserved
//
// This file contains the code used to search for keywords within the help topics using the full-text index
// files created by the help file builder.
//
// This code is published under the Microsoft Public License (Ms-PL). A copy of the license should be
// distributed with the code and can be found at the project website: https://GitHub.com/EWSoftware/SHFB. This
// notice, the author's name, and all copyright notices must remain intact in all applications, documentation,
// and source files.
//
// Date Who Comments
// ==============================================================================================================
// 06/24/2007 EFW Created the code
// 02/17/2012 EFW Switched to JSON serialization to support websites that use something other than ASP.NET
// such as PHP.
// 05/15/2014 EFW Updated for use with the lightweight website presentation styles
//===============================================================================================================
/// <summary>
/// This class is used to track the results and their rankings
/// </summary>
private class Ranking
{
public string Filename, PageTitle;
public int Rank;
public Ranking(string file, string title, int rank)
{
Filename = file;
PageTitle = title;
Rank = rank;
}
}
/// <summary>
/// Render the search results
/// </summary>
/// <param name="writer">The writer to which the results are written</param>
protected override void Render(HtmlTextWriter writer)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
string searchText, ftiFile;
char letter;
bool sortByTitle = false;
jss.MaxJsonLength = Int32.MaxValue;
// The keywords for which to search should be passed in the query string
searchText = this.Request.QueryString["Keywords"];
if(String.IsNullOrEmpty(searchText))
{
writer.Write("<strong>Nothing found</strong>");
return;
}
// An optional SortByTitle option can also be specified
if(this.Request.QueryString["SortByTitle"] != null)
sortByTitle = Convert.ToBoolean(this.Request.QueryString["SortByTitle"]);
List<string> keywords = this.ParseKeywords(searchText);
List<char> letters = new List<char>();
List<string> fileList;
Dictionary<string, List<long>> ftiWords, wordDictionary = new Dictionary<string,List<long>>();
// Load the file index
using(StreamReader sr = new StreamReader(Server.MapPath("fti/FTI_Files.json")))
{
fileList = jss.Deserialize<List<string>>(sr.ReadToEnd());
}
// Load the required word index files
foreach(string word in keywords)
{
letter = word[0];
if(!letters.Contains(letter))
{
letters.Add(letter);
ftiFile = Server.MapPath(String.Format(CultureInfo.InvariantCulture, "fti/FTI_{0}.json", (int)letter));
if(File.Exists(ftiFile))
{
using(StreamReader sr = new StreamReader(ftiFile))
{
ftiWords = jss.Deserialize<Dictionary<string, List<long>>>(sr.ReadToEnd());
}
foreach(string ftiWord in ftiWords.Keys)
wordDictionary.Add(ftiWord, ftiWords[ftiWord]);
}
}
}
// Perform the search and return the results as a block of HTML
writer.Write(this.Search(keywords, fileList, wordDictionary, sortByTitle));
}
/// <summary>
/// Split the search text up into keywords
/// </summary>
/// <param name="keywords">The keywords to parse</param>
/// <returns>A list containing the words for which to search</returns>
private List<string> ParseKeywords(string keywords)
{
List<string> keywordList = new List<string>();
string checkWord;
string[] words = Regex.Split(keywords, @"\W+");
foreach(string word in words)
{
checkWord = word.ToLower(CultureInfo.InvariantCulture);
if(checkWord.Length >= 2 && !Char.IsDigit(checkWord[0]) && !keywordList.Contains(checkWord))
keywordList.Add(checkWord);
}
return keywordList;
}
/// <summary>
/// Search for the specified keywords and return the results as a block of HTML
/// </summary>
/// <param name="keywords">The keywords for which to search</param>
/// <param name="fileInfo">The file list</param>
/// <param name="wordDictionary">The dictionary used to find the words</param>
/// <param name="sortByTitle">True to sort by title, false to sort by ranking</param>
/// <returns>A block of HTML representing the search results</returns>
private string Search(List<string> keywords, List<string> fileInfo,
Dictionary<string, List<long>> wordDictionary, bool sortByTitle)
{
StringBuilder sb = new StringBuilder(10240);
Dictionary<string, List<long>> matches = new Dictionary<string, List<long>>();
List<long> occurrences;
HashSet<int> matchingFileIndices = new HashSet<int>();
List<int> occurrenceIndices = new List<int>();
List<Ranking> rankings = new List<Ranking>();
string filename, title;
string[] fileIndex;
bool isFirst = true;
int idx, wordCount, matchCount;
foreach(string word in keywords)
{
occurrences = new List<long>();
foreach(KeyValuePair<string, List<long>> kv in wordDictionary)
if(kv.Key.Contains(word))
occurrences.AddRange(kv.Value);
if(occurrences.Count == 0)
return "<strong>Nothing found</strong>";
matches.Add(word, occurrences);
occurrenceIndices.Clear();
// Get a list of the file indices for this match
foreach(long entry in occurrences)
occurrenceIndices.Add((int)(entry >> 16));
if(isFirst)
{
isFirst = false;
matchingFileIndices.UnionWith(occurrenceIndices);
}
else
{
// After the first match, remove files that do not appear for all found keywords
foreach(int i in matchingFileIndices.ToArray())
if(!occurrenceIndices.Contains(i))
matchingFileIndices.Remove(i);
}
}
if(matchingFileIndices.Count == 0)
return "<strong>Nothing found</strong>";
// Rank the files based on the number of times the words occurs
foreach(int index in matchingFileIndices)
{
// Split out the title, filename, and word count
fileIndex = fileInfo[index].Split('\x0');
title = fileIndex[0];
filename = fileIndex[1];
wordCount = Convert.ToInt32(fileIndex[2]);
matchCount = 0;
foreach(string word in keywords)
{
occurrences = matches[word];
foreach(long entry in occurrences)
if((int)(entry >> 16) == index)
matchCount += (int)(entry & 0xFFFF);
}
rankings.Add(new Ranking(filename, title, matchCount * 1000 / wordCount));
if(rankings.Count > 99)
break;
}
// Sort by rank in descending order or by page title in ascending order
rankings.Sort(delegate (Ranking x, Ranking y)
{
if(!sortByTitle)
return y.Rank - x.Rank;
return x.PageTitle.CompareTo(y.PageTitle);
});
// Format the file list and return the results
sb.Append("<ol>");
foreach(Ranking r in rankings)
sb.AppendFormat("<li><a href=\"{0}\" target=\"_blank\">{1}</a></li>", r.Filename, r.PageTitle);
sb.Append("</ol>");
if(rankings.Count < matchingFileIndices.Count)
sb.AppendFormat("<p>Omitted {0} more results</p>", matchingFileIndices.Count - rankings.Count);
return sb.ToString();
}
</script>
Loading

0 comments on commit 7edfafb

Please sign in to comment.