Skip to content

Commit 5277001

Browse files
committed
Add 2.17 docs.
1 parent b8db889 commit 5277001

File tree

20,190 files changed

+698654
-319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

20,190 files changed

+698654
-319
lines changed

2.17/.nojekyll

Whitespace-only changes.

2.17/.readme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Custom static resources

2.17/404/index.html

Whitespace-only changes.

2.17/apidocs/CSharpDriverDocs.chm

15 MB
Binary file not shown.

2.17/apidocs/LastBuild.log

Lines changed: 2498 additions & 0 deletions
Large diffs are not rendered by default.

2.17/apidocs/SearchHelp.aspx

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
<%@ Page Language="C#" EnableViewState="False" %>
2+
3+
<script runat="server">
4+
//===============================================================================================================
5+
// System : Sandcastle Help File Builder
6+
// File : SearchHelp.aspx
7+
// Author : Eric Woodruff (Eric@EWoodruff.us)
8+
// Updated : 05/15/2014
9+
// Note : Copyright 2007-2015, Eric Woodruff, All rights reserved
10+
//
11+
// This file contains the code used to search for keywords within the help topics using the full-text index
12+
// files created by the help file builder.
13+
//
14+
// This code is published under the Microsoft Public License (Ms-PL). A copy of the license should be
15+
// distributed with the code and can be found at the project website: https://GitHub.com/EWSoftware/SHFB. This
16+
// notice, the author's name, and all copyright notices must remain intact in all applications, documentation,
17+
// and source files.
18+
//
19+
// Date Who Comments
20+
// ==============================================================================================================
21+
// 06/24/2007 EFW Created the code
22+
// 02/17/2012 EFW Switched to JSON serialization to support websites that use something other than ASP.NET
23+
// such as PHP.
24+
// 05/15/2014 EFW Updated for use with the lightweight website presentation styles
25+
//===============================================================================================================
26+
27+
/// <summary>
28+
/// This class is used to track the results and their rankings
29+
/// </summary>
30+
private class Ranking
31+
{
32+
public string Filename, PageTitle;
33+
public int Rank;
34+
35+
public Ranking(string file, string title, int rank)
36+
{
37+
Filename = file;
38+
PageTitle = title;
39+
Rank = rank;
40+
}
41+
}
42+
43+
/// <summary>
44+
/// Render the search results
45+
/// </summary>
46+
/// <param name="writer">The writer to which the results are written</param>
47+
protected override void Render(HtmlTextWriter writer)
48+
{
49+
JavaScriptSerializer jss = new JavaScriptSerializer();
50+
string searchText, ftiFile;
51+
char letter;
52+
bool sortByTitle = false;
53+
54+
jss.MaxJsonLength = Int32.MaxValue;
55+
56+
// The keywords for which to search should be passed in the query string
57+
searchText = this.Request.QueryString["Keywords"];
58+
59+
if(String.IsNullOrEmpty(searchText))
60+
{
61+
writer.Write("<strong>Nothing found</strong>");
62+
return;
63+
}
64+
65+
// An optional SortByTitle option can also be specified
66+
if(this.Request.QueryString["SortByTitle"] != null)
67+
sortByTitle = Convert.ToBoolean(this.Request.QueryString["SortByTitle"]);
68+
69+
List<string> keywords = this.ParseKeywords(searchText);
70+
List<char> letters = new List<char>();
71+
List<string> fileList;
72+
Dictionary<string, List<long>> ftiWords, wordDictionary = new Dictionary<string,List<long>>();
73+
74+
// Load the file index
75+
using(StreamReader sr = new StreamReader(Server.MapPath("fti/FTI_Files.json")))
76+
{
77+
fileList = jss.Deserialize<List<string>>(sr.ReadToEnd());
78+
}
79+
80+
// Load the required word index files
81+
foreach(string word in keywords)
82+
{
83+
letter = word[0];
84+
85+
if(!letters.Contains(letter))
86+
{
87+
letters.Add(letter);
88+
ftiFile = Server.MapPath(String.Format(CultureInfo.InvariantCulture, "fti/FTI_{0}.json", (int)letter));
89+
90+
if(File.Exists(ftiFile))
91+
{
92+
using(StreamReader sr = new StreamReader(ftiFile))
93+
{
94+
ftiWords = jss.Deserialize<Dictionary<string, List<long>>>(sr.ReadToEnd());
95+
}
96+
97+
foreach(string ftiWord in ftiWords.Keys)
98+
wordDictionary.Add(ftiWord, ftiWords[ftiWord]);
99+
}
100+
}
101+
}
102+
103+
// Perform the search and return the results as a block of HTML
104+
writer.Write(this.Search(keywords, fileList, wordDictionary, sortByTitle));
105+
}
106+
107+
/// <summary>
108+
/// Split the search text up into keywords
109+
/// </summary>
110+
/// <param name="keywords">The keywords to parse</param>
111+
/// <returns>A list containing the words for which to search</returns>
112+
private List<string> ParseKeywords(string keywords)
113+
{
114+
List<string> keywordList = new List<string>();
115+
string checkWord;
116+
string[] words = Regex.Split(keywords, @"\W+");
117+
118+
foreach(string word in words)
119+
{
120+
checkWord = word.ToLower(CultureInfo.InvariantCulture);
121+
122+
if(checkWord.Length > 2 && !Char.IsDigit(checkWord[0]) && !keywordList.Contains(checkWord))
123+
keywordList.Add(checkWord);
124+
}
125+
126+
return keywordList;
127+
}
128+
129+
/// <summary>
130+
/// Search for the specified keywords and return the results as a block of HTML
131+
/// </summary>
132+
/// <param name="keywords">The keywords for which to search</param>
133+
/// <param name="fileInfo">The file list</param>
134+
/// <param name="wordDictionary">The dictionary used to find the words</param>
135+
/// <param name="sortByTitle">True to sort by title, false to sort by ranking</param>
136+
/// <returns>A block of HTML representing the search results</returns>
137+
private string Search(List<string> keywords, List<string> fileInfo,
138+
Dictionary<string, List<long>> wordDictionary, bool sortByTitle)
139+
{
140+
StringBuilder sb = new StringBuilder(10240);
141+
Dictionary<string, List<long>> matches = new Dictionary<string, List<long>>();
142+
List<long> occurrences;
143+
List<int> matchingFileIndices = new List<int>(), occurrenceIndices = new List<int>();
144+
List<Ranking> rankings = new List<Ranking>();
145+
146+
string filename, title;
147+
string[] fileIndex;
148+
bool isFirst = true;
149+
int idx, wordCount, matchCount;
150+
151+
foreach(string word in keywords)
152+
{
153+
if(!wordDictionary.TryGetValue(word, out occurrences))
154+
return "<strong>Nothing found</strong>";
155+
156+
matches.Add(word, occurrences);
157+
occurrenceIndices.Clear();
158+
159+
// Get a list of the file indices for this match
160+
foreach(long entry in occurrences)
161+
occurrenceIndices.Add((int)(entry >> 16));
162+
163+
if(isFirst)
164+
{
165+
isFirst = false;
166+
matchingFileIndices.AddRange(occurrenceIndices);
167+
}
168+
else
169+
{
170+
// After the first match, remove files that do not appear for
171+
// all found keywords.
172+
for(idx = 0; idx < matchingFileIndices.Count; idx++)
173+
if(!occurrenceIndices.Contains(matchingFileIndices[idx]))
174+
{
175+
matchingFileIndices.RemoveAt(idx);
176+
idx--;
177+
}
178+
}
179+
}
180+
181+
if(matchingFileIndices.Count == 0)
182+
return "<strong>Nothing found</strong>";
183+
184+
// Rank the files based on the number of times the words occurs
185+
foreach(int index in matchingFileIndices)
186+
{
187+
// Split out the title, filename, and word count
188+
fileIndex = fileInfo[index].Split('\x0');
189+
190+
title = fileIndex[0];
191+
filename = fileIndex[1];
192+
wordCount = Convert.ToInt32(fileIndex[2]);
193+
matchCount = 0;
194+
195+
foreach(string word in keywords)
196+
{
197+
occurrences = matches[word];
198+
199+
foreach(long entry in occurrences)
200+
if((int)(entry >> 16) == index)
201+
matchCount += (int)(entry & 0xFFFF);
202+
}
203+
204+
rankings.Add(new Ranking(filename, title, matchCount * 1000 / wordCount));
205+
206+
if(rankings.Count > 99)
207+
break;
208+
}
209+
210+
// Sort by rank in descending order or by page title in ascending order
211+
rankings.Sort(delegate (Ranking x, Ranking y)
212+
{
213+
if(!sortByTitle)
214+
return y.Rank - x.Rank;
215+
216+
return x.PageTitle.CompareTo(y.PageTitle);
217+
});
218+
219+
// Format the file list and return the results
220+
sb.Append("<ol>");
221+
222+
foreach(Ranking r in rankings)
223+
sb.AppendFormat("<li><a href=\"{0}\" target=\"_blank\">{1}</a></li>", r.Filename, r.PageTitle);
224+
225+
sb.Append("</ol>");
226+
227+
if(rankings.Count < matchingFileIndices.Count)
228+
sb.AppendFormat("<p>Omitted {0} more results</p>", matchingFileIndices.Count - rankings.Count);
229+
230+
return sb.ToString();
231+
}
232+
</script>

0 commit comments

Comments
 (0)