Skip to content

Commit fd0d042

Browse files
Added web reference, minor documentation fixes.
1 parent ee73af9 commit fd0d042

File tree

686 files changed

+17957
-3
lines changed

Some content is hidden

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

686 files changed

+17957
-3
lines changed

ClearScript/ScriptEngine.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ public ScriptAccess DefaultAccess
126126
/// <remarks>
127127
/// When this property is set to <c>true</c>, script code running in the current script
128128
/// engine is permitted to use reflection. This affects
129-
/// <see cref="System.Object.GetType"/>, <see cref="HostFunctions.typeOf(object)"/> and
129+
/// <see cref="System.Object.GetType"/>, <see cref="System.Exception.GetType"/>,
130+
/// <see cref="System.Delegate.Method"/>, <see cref="HostFunctions.typeOf(object)"/> and
130131
/// <see cref="HostFunctions.typeOf{T}"/>. By default, any attempt to invoke these methods
131132
/// from script code results in an exception.
132133
/// </remarks>

ClearScript/doc/Reference.chm

810 Bytes
Binary file not shown.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3+
<PropertyGroup>
4+
<!-- The configuration and platform will be used to determine which
5+
assemblies to include from solution and project documentation
6+
sources -->
7+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<SchemaVersion>2.0</SchemaVersion>
10+
<ProjectGuid>{5e8abcfa-8cbd-4d77-bfcc-d396e945a10e}</ProjectGuid>
11+
<SHFBSchemaVersion>2015.6.5.0</SHFBSchemaVersion>
12+
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
13+
Studio adds them anyway -->
14+
<AssemblyName>Documentation</AssemblyName>
15+
<RootNamespace>Documentation</RootNamespace>
16+
<Name>Documentation</Name>
17+
<!-- SHFB properties -->
18+
<OutputPath>..\..\docs\Reference\</OutputPath>
19+
<HtmlHelpName>Reference</HtmlHelpName>
20+
<Language>en-US</Language>
21+
<HelpTitle>ClearScript Library</HelpTitle>
22+
<DocumentationSources>
23+
<DocumentationSource sourceFile="..\ClearScript.csproj" />
24+
</DocumentationSources>
25+
<VisibleItems>Attributes, InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected</VisibleItems>
26+
<MissingTags>Summary, Parameter, Returns, TypeParameter</MissingTags>
27+
<FeedbackEMailAddress>ClearScript%40microsoft.com</FeedbackEMailAddress>
28+
<FeedbackEMailLinkText>Microsoft</FeedbackEMailLinkText>
29+
<FrameworkVersion>.NET Framework 4.0</FrameworkVersion>
30+
<PresentationStyle>VS2013</PresentationStyle>
31+
<Preliminary>False</Preliminary>
32+
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
33+
<HelpFileFormat>Website</HelpFileFormat>
34+
<IndentHtml>False</IndentHtml>
35+
<KeepLogFile>True</KeepLogFile>
36+
<DisableCodeBlockComponent>False</DisableCodeBlockComponent>
37+
<CppCommentsFixup>False</CppCommentsFixup>
38+
<CleanIntermediates>True</CleanIntermediates>
39+
<SyntaxFilters>Standard</SyntaxFilters>
40+
<SdkLinkTarget>Blank</SdkLinkTarget>
41+
<RootNamespaceContainer>True</RootNamespaceContainer>
42+
<NamingMethod>MemberName</NamingMethod>
43+
<ContentPlacement>AboveNamespaces</ContentPlacement>
44+
<CopyrightText>Copyright &amp;#169%3b Microsoft Corporation. All rights reserved.</CopyrightText>
45+
<NamespaceSummaries>
46+
<NamespaceSummaryItem name="Microsoft.ClearScript" isDocumented="True">The Microsoft.ClearScript namespace contains types that support all script engines.</NamespaceSummaryItem>
47+
<NamespaceSummaryItem name="Microsoft.ClearScript.V8" isDocumented="True">The Microsoft.ClearScript.V8 namespace contains types that provide access to the V8 high-performance open-source JavaScript engine.</NamespaceSummaryItem>
48+
<NamespaceSummaryItem name="Microsoft.ClearScript.Windows" isDocumented="True">The Microsoft.ClearScript.Windows namespace contains types that provide access to Windows Script engines such as JScript and VBScript.</NamespaceSummaryItem>
49+
<NamespaceSummaryItem name="(global)" isDocumented="False" />
50+
<NamespaceSummaryItem name="Microsoft.ClearScript.JavaScript" isDocumented="True">The Microsoft.ClearScript.JavaScript namespace contains types that provide access to JavaScript-specific features.</NamespaceSummaryItem>
51+
</NamespaceSummaries>
52+
<RootNamespaceTitle>ClearScript Library Reference</RootNamespaceTitle>
53+
<ProjectSummary>The ClearScript library makes it easy to add scripting to your .NET applications.</ProjectSummary>
54+
<MaximumGroupParts>2</MaximumGroupParts>
55+
<NamespaceGrouping>False</NamespaceGrouping>
56+
<HelpFileVersion>1.0.0.0</HelpFileVersion>
57+
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
58+
<WarnOnMissingSourceContext>False</WarnOnMissingSourceContext>
59+
</PropertyGroup>
60+
<!-- There are no properties for these groups. AnyCPU needs to appear in
61+
order for Visual Studio to perform the build. The others are optional
62+
common platform types that may appear. -->
63+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
64+
</PropertyGroup>
65+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
66+
</PropertyGroup>
67+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
68+
</PropertyGroup>
69+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
70+
</PropertyGroup>
71+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
72+
</PropertyGroup>
73+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
74+
</PropertyGroup>
75+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
76+
</PropertyGroup>
77+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
78+
</PropertyGroup>
79+
<!-- Import the SHFB build targets -->
80+
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
81+
</Project>

License.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
MIT License
2+
13
ClearScript
24
Copyright (c) Microsoft Corporation
35
All rights reserved.
46

5-
MIT License
6-
77
Permission is hereby granted, free of charge, to any person obtaining a copy of
88
this software and associated documentation files (the Software), to deal in the
99
Software without restriction, including without limitation the rights to use,

docs/Reference/SearchHelp.aspx

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

0 commit comments

Comments
 (0)