Skip to content

Commit

Permalink
Recover and publish documentation managed by the shfbproj projects #9
Browse files Browse the repository at this point in the history
- DataPorter has been generated and published
  • Loading branch information
mpostol committed Apr 26, 2020
1 parent 1a55e2a commit 796fdff
Show file tree
Hide file tree
Showing 355 changed files with 6,648 additions and 59 deletions.
90 changes: 31 additions & 59 deletions PR26-DataPorter_Help.shfbproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<!-- The configuration and platform will be used to determine which
assemblies to include from solution and project documentation
Expand All @@ -7,89 +8,60 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8b301eb8-8d71-4373-83bf-9f52726518ea}</ProjectGuid>
<SHFBSchemaVersion>1.9.0.0</SHFBSchemaVersion>
<SHFBSchemaVersion>2017.9.26.0</SHFBSchemaVersion>
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
Studio adds them anyway -->
<AssemblyName>Documentation</AssemblyName>
<RootNamespace>Documentation</RootNamespace>
<Name>Documentation</Name>
<!-- SHFB properties -->
<OutputPath>Temp\DataPorter\Help\</OutputPath>
<OutputPath>docs\DataPorter\</OutputPath>
<HtmlHelpName>DataPorter</HtmlHelpName>
<WorkingPath>Temp\DataPorter\Working\</WorkingPath>
<BuildLogFile>Temp\DataPorter\DataPorter.log</BuildLogFile>
<WorkingPath>PR26-DataPorter\bin\</WorkingPath>
<BuildLogFile>PR26-DataPorter\bin\DataPorter.log</BuildLogFile>
<HelpFileFormat>Website</HelpFileFormat>
<ComponentConfigurations>
<ComponentConfig id="Cached MSDN URL References" enabled="True">
<component id="Cached MSDN URL References" type="SandcastleBuilder.Components.CachedResolveReferenceLinksComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll" locale="{@Locale}" linkTarget="{@SdkLinkTarget}">
<helpOutput format="HtmlHelp1">
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@HtmlSdkLinkType}" />
<targets files="reflection.xml" type="Local" />
</helpOutput>
<helpOutput format="MSHelp2">
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@MSHelp2SdkLinkType}" />
<targets files="reflection.xml" type="Index" />
</helpOutput>
<helpOutput format="MSHelpViewer">
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@MSHelpViewerSdkLinkType}" />
<targets files="reflection.xml" type="Id" />
</helpOutput>
<helpOutput format="Website">
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@WebsiteSdkLinkType}" />
<targets files="reflection.xml" type="Local" />
</helpOutput>
</component>
</ComponentConfig>
<ComponentConfig id="Code Block Component" enabled="True">
<component id="Code Block Component" type="SandcastleBuilder.Components.CodeBlockComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
<basePath value="{@ProjectFolder}" />
<languageFilter value="true" />
<allowMissingSource value="false" />
<removeRegionMarkers value="false" />
<colorizer syntaxFile="{@SHFBFolder}Colorizer\highlight.xml" styleFile="{@SHFBFolder}Colorizer\highlight.xsl" copyImageUrl="../icons/CopyCode.gif" language="cs" tabSize="0" numberLines="false" outlining="false" keepSeeTags="false" defaultTitle="true" />
</component>
</ComponentConfig>
<ComponentConfig id="Post-transform Component" enabled="True">
<component id="Post-transform Component" type="SandcastleBuilder.Components.PostTransformComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
<!-- Code colorizer files (required).
Attributes:
Stylesheet file (required)
Script file (required)
"Copy" image file (required) -->
<colorizer stylesheet="{@SHFBFolder}Colorizer\highlight.css" scriptFile="{@SHFBFolder}Colorizer\highlight.js" copyImage="{@SHFBFolder}Colorizer\CopyCode.gif" />
<!-- Base output path for the files (required). This should match
the parent folder of the output path of the HTML files (see
SaveComponent). -->
<outputPaths>{@HelpFormatOutputPaths}</outputPaths>
<!-- Logo image file (optional). Filename is required. The height,
width, altText, placement, and alignment attributes are
optional. -->
<logoFile filename="\\CAS_002\cas_dfs\cas\Projekty\Produkty\PR21-CommServer\PR2103-Rysunki\commsrerver_logo_z_napisem_z_boku_small.gif" height="0" width="0" altText="www.commsvr.com" placement="right" alignment="left" />
</component>
<component id="Code Block Component">
<basePath value="{@HtmlEncProjectFolder}" />
<outputPaths>{@HelpFormatOutputPaths}</outputPaths>
<allowMissingSource value="false" />
<removeRegionMarkers value="false" />
<colorizer syntaxFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.xml" styleFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.xsl" stylesheet="{@SHFBFolder}PresentationStyles\Colorizer\highlight.css" scriptFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.js" disabled="{@DisableCodeBlockComponent}" language="cs" tabSize="0" numberLines="false" outlining="false" keepSeeTags="false" defaultTitle="true" />
</component>
</ComponentConfig>
</ComponentConfigurations>
<PlugInConfigurations>
<PlugInConfig id="Additional Content Only" enabled="True">
<configuration />
</PlugInConfig>
<PlugInConfig id="HelpTopicsGenerator" enabled="True">
<configuration />
</PlugInConfig>
</PlugInConfigurations>
<CopyrightHref>http://www.commsvr.com/</CopyrightHref>
<CopyrightText>Copyright \xA9 2008-2011, CAS, All rights reserved</CopyrightText>
<CopyrightText>Copyright \xA9 2008-2020, CAS, All rights reserved</CopyrightText>
<FeedbackEMailAddress>techsupp%40cas.eu</FeedbackEMailAddress>
<FeedbackEMailLinkText>CAS</FeedbackEMailLinkText>
<FooterText>This documentation is designed to be used with CAS DataPorter %28this software is available at &amp;lt%3bA href=&amp;quot%3bhttp://www.commsvr.com/DownloadCenter/ProductSoftware/PR2605DataPorter_Software.aspx&amp;quot%3b title=&amp;quot%3bDataPorter - ports data between most popular standards %28OPC, XML, SQL%29 – software installation.&amp;quot%3b&amp;gt%3bhttp://www.commsvr.com&amp;lt%3b/A&amp;gt%3b%29.</FooterText>
<HeaderText>&amp;lt%3bA href=&amp;quot%3bhttp://www.commsvr.com/&amp;quot%3b title=&amp;quot%3bDataPorter online help&amp;quot%3b target=&amp;quot%3b_blank&amp;quot%3b&amp;gt%3bHome&amp;lt%3b/A&amp;gt%3b</HeaderText>
<HelpTitle>DataPorter - ports data between most popular standards %28OPC, XML, SQL%29</HelpTitle>
<NamingMethod>MemberName</NamingMethod>
<Preliminary>False</Preliminary>
<PresentationStyle>vs2005-Produkty</PresentationStyle>
<PresentationStyle>VS2013</PresentationStyle>
<SyntaxFilters>C#</SyntaxFilters>
<FrameworkVersion>.NET Framework 4.5</FrameworkVersion>
<CleanIntermediates>True</CleanIntermediates>
<KeepLogFile>True</KeepLogFile>
<DisableCodeBlockComponent>False</DisableCodeBlockComponent>
<IndentHtml>False</IndentHtml>
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
<WarnOnMissingSourceContext>False</WarnOnMissingSourceContext>
<HelpFileVersion>1.0.0.0</HelpFileVersion>
<Language>en-US</Language>
<ContentPlacement>AboveNamespaces</ContentPlacement>
<RootNamespaceContainer>False</RootNamespaceContainer>
<NamespaceGrouping>False</NamespaceGrouping>
<MaximumGroupParts>2</MaximumGroupParts>
<SdkLinkTarget>Blank</SdkLinkTarget>
</PropertyGroup>
<!-- There are no properties for these two groups but they need to appear in
order for Visual Studio to perform the build. -->
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
233 changes: 233 additions & 0 deletions docs/DataPorter/SearchHelp.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
<%@ Page Language="C#" EnableViewState="False" %>

<script runat="server">
//===============================================================================================================
// System : Sandcastle Help File Builder
// File : SearchHelp.aspx
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 05/15/2014
// Note : Copyright 2007-2015, Eric Woodruff, All rights reserved
// Compiler: Microsoft C#
//
// 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. It can also 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;
List<int> matchingFileIndices = new 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)
{
if(!wordDictionary.TryGetValue(word, out occurrences))
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.AddRange(occurrenceIndices);
}
else
{
// After the first match, remove files that do not appear for
// all found keywords.
for(idx = 0; idx < matchingFileIndices.Count; idx++)
if(!occurrenceIndices.Contains(matchingFileIndices[idx]))
{
matchingFileIndices.RemoveAt(idx);
idx--;
}
}
}
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 796fdff

Please sign in to comment.