本文整理汇总了C#中Custom_Tracer类的典型用法代码示例。如果您正苦于以下问题:C# Custom_Tracer类的具体用法?C# Custom_Tracer怎么用?C# Custom_Tracer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Custom_Tracer类属于命名空间,在下文中一共展示了Custom_Tracer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Static_Pages_Builder
/// <summary> Constructor for a new instance of the Static_Pages_Builder class </summary>
/// <param name="Primary_Web_Server_URL"> URL for the primary web server </param>
/// <param name="Static_Data_Location"> Network location for the data directory </param>
/// <param name="Default_Skin"> Default skin code </param>
public Static_Pages_Builder(string Primary_Web_Server_URL, string Static_Data_Location, string Default_Skin)
{
primaryWebServerUrl = Primary_Web_Server_URL;
staticSobekcmDataLocation = Static_Data_Location;
staticSobekcmLocation = UI_ApplicationCache_Gateway.Settings.Servers.Application_Server_Network;
tracer = new Custom_Tracer();
assistant = new SobekCM_Assistant();
// Save all the objects needed by the SobekCM Library
defaultSkin = Default_Skin;
// Create the mode object
currentMode = new Navigation_Object
{
ViewerCode = "citation",
Skin = String.Empty,
Mode = Display_Mode_Enum.Item_Display,
Language = Web_Language_Enum.English,
Base_URL = primaryWebServerUrl
};
// Set some constant settings
// SobekCM.Library.UI_ApplicationCache_Gateway.Settings.Watermarks_URL = primary_web_server_url + "/design/wordmarks/";
UI_ApplicationCache_Gateway.Settings.Base_SobekCM_Location_Relative = primaryWebServerUrl;
// Ensure all the folders exist
if (!Directory.Exists(staticSobekcmDataLocation))
Directory.CreateDirectory(staticSobekcmDataLocation);
if (!Directory.Exists(staticSobekcmDataLocation + "\\rss"))
Directory.CreateDirectory(staticSobekcmDataLocation + "\\rss");
}
示例2: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Feature_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
// Build the value
StringBuilder builder = new StringBuilder(5000);
// Save the current viewer code
string current_view_code = CurrentMode.ViewerCode;
// Start the citation table
builder.AppendLine("\t\t<!-- FEATURE VIEWER OUTPUT -->" );
builder.AppendLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Features</b></span></td></tr>" );
builder.AppendLine("\t\t<tr><td class=\"SobekDocumentDisplay\">");
builder.AppendLine("\t\t\t<div class=\"SobekCitation\">");
// Get the list of streets from the database
Map_Features_DataSet features = SobekCM_Database.Get_All_Features_By_Item( CurrentItem.Web.ItemID, Tracer );
Create_Feature_Index( builder, features );
// Finish the citation table
builder.AppendLine( "\t\t\t</div>" );
builder.AppendLine("\t\t</td>" );
builder.AppendLine("\t\t<!-- END FEATURE VIEWER OUTPUT -->" );
// Restore the mode
CurrentMode.ViewerCode = current_view_code;
// Add the HTML for the image
Literal mainLiteral = new Literal {Text = builder.ToString()};
placeHolder.Controls.Add( mainLiteral );
}
示例3: Write_HTML
/// <summary> Writes the HTML generated by this error html subwriter directly to the response stream </summary>
/// <param name="Output"> Stream to which to write the HTML for this subwriter </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
/// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns>
public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer)
{
Tracer.Add_Trace("Error_HtmlSubwriter.Write_HTML", "Rendering HTML");
// Start the page container
Output.WriteLine("<div id=\"pagecontainer\">");
Output.WriteLine("<br />");
Output.WriteLine("<center>");
Output.WriteLine(" <br /><br />");
Output.WriteLine("<span style=\"font-size:large; color:red\">");
Output.WriteLine(" <b>Deprecated URL detected</b>");
Output.WriteLine("</span>");
Output.WriteLine("<span style=\"font-size:1.2em\">");
Output.WriteLine(" <br /><br />");
Output.WriteLine("The URL you entered is a legacy URL. Support for this URL will end shortly.<br /><br />Please update your records to the new URL below:<br /><br />");
Output.WriteLine("<a href=\"" + currentMode.Error_Message + "\">" + currentMode.Error_Message + "</a>");
Output.WriteLine(" <br /><br /><br /><br />");
Output.WriteLine("</span>");
Output.WriteLine("</center>");
Output.WriteLine();
Output.WriteLine("<!-- Close the pagecontainer div -->");
Output.WriteLine("</div>");
Output.WriteLine();
return true;
}
示例4: Read_Web_Document
/// <summary> Read the source browse and info static html files and create the
/// appropriate <see cref="HTML_Based_Content"/> object with all the bibliographic information
/// (author, keywords, description, title, code) loaded from the header in the HTML file</summary>
/// <param name="Source_URL"> URL to the source HTML document, retrievable via the web</param>
/// <param name="Retain_Entire_Display_Text"> Flag indicates whether the entire display text should be retained (as it is about to be displayed) or just the basic information from the HEAD of the file </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
/// <returns> Fully built browse info object with all the bibliographic information</returns>
public static HTML_Based_Content Read_Web_Document(string Source_URL, bool Retain_Entire_Display_Text, Custom_Tracer Tracer)
{
try
{
if (Tracer != null)
{
Tracer.Add_Trace("HTML_Based_Content_Reader.Read_Web_Document", "Reading source file via web response");
}
// the html retrieved from the page
string displayText;
WebRequest objRequest = WebRequest.Create(Source_URL);
WebResponse objResponse = objRequest.GetResponse();
// the using keyword will automatically dispose the object once complete
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
displayText = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
// Convert this to the object
return Text_To_HTML_Based_Content(displayText, Retain_Entire_Display_Text, String.Empty);
}
catch
{
return null;
}
}
示例5: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Download_Only_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
// Build the value
StringBuilder builder = new StringBuilder(1500);
// Save the current viewer code
string current_view_code = CurrentMode.ViewerCode;
// Start the citation table
builder.AppendLine("\t\t<!-- DOWNLOAD ONLY VIEWER OUTPUT -->" );
builder.AppendLine("\t\t<td class=\"SobekDocumentDisplay\">" );
builder.AppendLine("\t\t\t<div class=\"SobekCitation\">" );
builder.AppendLine("\t\t\t</div>" );
// Finish the table
builder.AppendLine( "\t\t</td>" );
builder.AppendLine("\t\t<!-- END DOWNLOAD ONLY VIEWER OUTPUT -->" );
// Restore the mode
CurrentMode.ViewerCode = current_view_code;
// Add the HTML for the image
Literal mainLiteral = new Literal {Text = builder.ToString()};
placeHolder.Controls.Add( mainLiteral );
}
示例6: Add_Main_Viewer_Section
public override void Add_Main_Viewer_Section(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
{
StringBuilder responseBuilder = new StringBuilder();
// Calculate the title and url
string title = HttpUtility.HtmlEncode(CurrentItem.Bib_Info.Main_Title.Title);
string share_url = CurrentMode.Base_URL + "/" + CurrentItem.BibID + "/" + CurrentItem.VID;
if (HttpContext.Current != null)
share_url = HttpContext.Current.Items["Original_URL"].ToString().Replace("&", "%26").Replace("?", "%3F").Replace("http://", "").Replace("=", "%3D").Replace("\"", """);
responseBuilder.AppendLine("<!-- Share form -->");
responseBuilder.AppendLine("<div id=\"shareform_content\">");
responseBuilder.AppendLine("<a href=\"http://www.facebook.com/share.php?u=" + share_url + "&t=" + title + "\" target=\"FACEBOOK_WINDOW\" onmouseover=\"facebook_share.src='" + CurrentMode.Base_URL + "default/images/facebook_share_h.gif'\" onmouseout=\"facebook_share.src='" + CurrentMode.Base_URL + "default/images/facebook_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"facebook_share\" name=\"facebook_share\" src=\"" + CurrentMode.Base_URL + "default/images/facebook_share.gif\" alt=\"FACEBOOK\" /></a>");
responseBuilder.AppendLine("<a href=\"http://buzz.yahoo.com/buzz?targetUrl=" + share_url + "&headline=" + title + "\" target=\"YAHOOBUZZ_WINDOW\" onmouseover=\"yahoobuzz_share.src='" + CurrentMode.Base_URL + "default/images/yahoobuzz_share_h.gif'\" onmouseout=\"yahoobuzz_share.src='" + CurrentMode.Base_URL + "default/images/yahoobuzz_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"yahoobuzz_share\" name=\"yahoobuzz_share\" src=\"" + CurrentMode.Base_URL + "default/images/yahoobuzz_share.gif\" alt=\"YAHOO BUZZ\" /></a>");
responseBuilder.AppendLine("<br />");
responseBuilder.AppendLine("<a href=\"http://twitter.com/home?status=Currently reading " + share_url + "\" target=\"TWITTER_WINDOW\" onmouseover=\"twitter_share.src='" + CurrentMode.Base_URL + "default/images/twitter_share_h.gif'\" onmouseout=\"twitter_share.src='" + CurrentMode.Base_URL + "default/images/twitter_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"twitter_share\" name=\"twitter_share\" src=\"" + CurrentMode.Base_URL + "default/images/twitter_share.gif\" alt=\"TWITTER\" /></a>");
responseBuilder.AppendLine("<a href=\"http://www.google.com/bookmarks/mark?op=add&bkmk=" + share_url + "&title=" + title + "\" target=\"GOOGLE_WINDOW\" onmouseover=\"google_share.src='" + CurrentMode.Base_URL + "default/images/google_share_h.gif'\" onmouseout=\"google_share.src='" + CurrentMode.Base_URL + "default/images/google_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"google_share\" name=\"google_share\" src=\"" + CurrentMode.Base_URL + "default/images/google_share.gif\" alt=\"GOOGLE SHARE\" /></a>");
responseBuilder.AppendLine("<br />");
responseBuilder.AppendLine("<a href=\"http://www.stumbleupon.com/submit?url=" + share_url + "&title=" + title + "\" target=\"STUMBLEUPON_WINDOW\" onmouseover=\"stumbleupon_share.src='" + CurrentMode.Base_URL + "default/images/stumbleupon_share_h.gif'\" onmouseout=\"stumbleupon_share.src='" + CurrentMode.Base_URL + "default/images/stumbleupon_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"stumbleupon_share\" name=\"stumbleupon_share\" src=\"" + CurrentMode.Base_URL + "default/images/stumbleupon_share.gif\" alt=\"STUMBLEUPON\" /></a>");
responseBuilder.AppendLine("<a href=\"http://myweb.yahoo.com/myresults/bookmarklet?t=" + title + "&u=" + share_url + "\" target=\"YAHOO_WINDOW\" onmouseover=\"yahoo_share.src='" + CurrentMode.Base_URL + "default/images/yahoo_share_h.gif'\" onmouseout=\"yahoo_share.src='" + CurrentMode.Base_URL + "default/images/yahoo_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"yahoo_share\" name=\"yahoo_share\" src=\"" + CurrentMode.Base_URL + "default/images/yahoo_share.gif\" alt=\"YAHOO SHARE\" /></a>");
responseBuilder.AppendLine("<br />");
responseBuilder.AppendLine("<a href=\"http://digg.com/submit?phase=2&url=" + share_url + "&title=" + title + "\" target=\"DIGG_WINDOW\" onmouseover=\"digg_share.src='" + CurrentMode.Base_URL + "default/images/digg_share_h.gif'\" onmouseout=\"digg_share.src='" + CurrentMode.Base_URL + "default/images/digg_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"digg_share\" name=\"digg_share\" src=\"" + CurrentMode.Base_URL + "default/images/digg_share.gif\" alt=\"DIGG\" /></a>");
responseBuilder.AppendLine("<a onmouseover=\"favorites_share.src='" + CurrentMode.Base_URL + "default/images/favorites_share_h.gif'\" onmouseout=\"favorites_share.src='" + CurrentMode.Base_URL + "default/images/favorites_share.gif'\" onclick=\"javascript:add_to_favorites();\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"favorites_share\" name=\"favorites_share\" src=\"" + CurrentMode.Base_URL + "default/images/favorites_share.gif\" alt=\"MY FAVORITES\" /></a>");
responseBuilder.AppendLine("<br />");
responseBuilder.AppendLine("</div>");
responseBuilder.AppendLine();
MainPlaceHolder.Controls.Add(new Literal() { Text = responseBuilder.ToString() });
}
示例7: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("EmbeddedVideo_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
//Determine the name of the FLASH file
string youtube_url = CurrentItem.Bib_Info.Location.Other_URL;
if (youtube_url.IndexOf("watch") > 0)
youtube_url = youtube_url.Replace("watch?v=", "v/") + "?fs=1&hl=en_US";
const int width = 600;
const int height = 480;
// Add the HTML for the image
StringBuilder result = new StringBuilder(500);
result.AppendLine(" <!-- EMBEDDED VIDEO VIEWER OUTPUT -->");
result.AppendLine(" <td align=\"left\"><span class=\"SobekViewerTitle\"><b>Streaming Video</b></span></td>");
result.AppendLine(" </tr>");
result.AppendLine(" <tr>");
result.AppendLine(" <td class=\"SobekCitationDisplay\">");
result.AppendLine(CurrentItem.Behaviors.Embedded_Video);
result.AppendLine(" </td>");
result.AppendLine(" <!-- END EMBEDDED VIDEO VIEWER OUTPUT -->");
Literal mainLiteral = new Literal { Text = result.ToString() };
placeHolder.Controls.Add(mainLiteral);
}
示例8: Perform_PreDisplay_Work
/// <summary> This provides an opportunity for the viewer to perform any pre-display work
/// which is necessary before entering any of the rendering portions </summary>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
/// <remarks> This methods pulls the text to display and determines the width </remarks>
public override void Perform_PreDisplay_Work(Custom_Tracer Tracer)
{
// Set some defaults
text_from_file = String.Empty;
file_does_not_exist = false;
error_occurred = false;
width = -1;
if (FileName.Length > 0)
{
string filesource = CurrentItem.Web.Source_URL + "/" + FileName;
text_from_file = Get_Html_Page(filesource, Tracer);
// Did this work?
if (text_from_file.Length > 0)
{
string[] splitter = text_from_file.Split("\n".ToCharArray());
foreach (string thisString in splitter)
{
width = Math.Max(width, thisString.Length*9);
}
// width = Math.Min(width, 800);
}
}
else
{
file_does_not_exist = true;
}
}
示例9: Add_Search_Box_HTML
/// <summary> Add the HTML to be displayed in the search box </summary>
/// <param name="Output"> Textwriter to write the HTML for this viewer</param>
/// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
/// <remarks> This adds the title of the into the box </remarks>
public override void Add_Search_Box_HTML(TextWriter Output, Custom_Tracer Tracer)
{
// Normalize the submode
string submode = currentMode.Info_Browse_Mode.ToLower();
if ((submode != "views") && (submode != "itemviews") && (submode != "titles") && (submode != "items") && (submode != "definitions"))
{
submode = "views";
}
// Show the next data, depending on type
switch (submode)
{
case "views":
Output.WriteLine("<h1>History of Collection-Level Usage</h1>");
break;
case "itemviews":
Output.WriteLine("<h1>History of Item Usage</h1>");
break;
case "titles":
Output.WriteLine("<h1>Most Accessed Titles</h1>");
break;
case "items":
Output.WriteLine("<h1>Most Accessed Items</h1>");
break;
case "definitions":
Output.WriteLine("<h1>Definitions of Terms Used</h1>");
break;
}
}
示例10: Add_Text_To_Page
/// <summary> Perform all the work of adding text directly to the response stream back to the web user </summary>
/// <param name="Output"> Stream to which to write the text for this main writer </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Text_To_Page(TextWriter Output, Custom_Tracer Tracer)
{
Tracer.Add_Trace("Html_Echo_MainWriter.Add_Text_To_Page", "Reading the text from the file and echoing back to the output stream");
try
{
FileStream fileStream = new FileStream(fileToEcho, FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(fileStream);
string line = reader.ReadLine();
while ( line != null )
{
Output.WriteLine(line);
line = reader.ReadLine();
}
reader.Close();
}
catch
{
Output.WriteLine("ERROR READING THE SOURCE FILE");
}
Tracer.Add_Trace("Html_Echo_MainWriter.Add_Text_To_Page", "Finished reading and writing the file");
Output.WriteLine("<br /><br /><b>TRACE ROUTE</b>");
Output.WriteLine("<br /><br />Total Execution Time: " + Tracer.Milliseconds + " Milliseconds<br /><br />");
Output.WriteLine(Tracer.Complete_Trace + "<br />");
}
示例11: Saved_Searches_MySobekViewer
/// <summary> Constructor for a new instance of the Saved_Searches_MySobekViewer class </summary>
/// <param name="User"> Authenticated user information </param>
/// <param name="Translator"> Translation / language support object for writing the user interface is multiple languages</param>
/// <param name="currentMode"> Mode / navigation information for the current request</param>
/// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
public Saved_Searches_MySobekViewer(User_Object User,
Language_Support_Info Translator,
SobekCM_Navigation_Object currentMode,
Custom_Tracer Tracer)
: base(User)
{
Tracer.Add_Trace("Saved_Searches_MySobekViewer.Constructor", String.Empty);
user = User;
base.Translator = Translator;
if (currentMode.isPostBack)
{
// Pull the standard values
NameValueCollection form = HttpContext.Current.Request.Form;
string item_action = form["item_action"].ToUpper().Trim();
string folder_id = form["folder_id"].Trim();
if (item_action == "REMOVE")
{
int folder_id_int;
if (Int32.TryParse(folder_id, out folder_id_int))
SobekCM_Database.Delete_User_Search(folder_id_int, Tracer);
}
HttpContext.Current.Response.Redirect(HttpContext.Current.Items["Original_URL"].ToString());
}
}
示例12: Build_Brief_Item
/// <summary> Builds a brief version of a digital resource, used when displaying the 'FULL VIEW' in
/// a search result or browse list </summary>
/// <param name="METS_Location"> Location (URL) of the METS file to read via HTTP </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
/// <returns> Briefly built version of a digital resource </returns>
public SobekCM_Item Build_Brief_Item(string METS_Location, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", "Create the requested item");
}
try
{
// Get the response object for this METS file
string mets_file = METS_Location.Replace("\\", "/") + "/citation_mets.xml";
SobekCM_Item thisPackage = Build_Item_From_METS(mets_file, "citation_mets.xml", Tracer);
if (thisPackage == null)
{
if (Tracer != null)
Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", "Unable to find/read either METS file", Custom_Trace_Type_Enum.Error);
}
if (Tracer != null)
{
Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", "Finished building this item");
}
return thisPackage;
}
catch (Exception ee)
{
if (Tracer != null)
Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", ee.ToString().Replace("\n", "<br />"), Custom_Trace_Type_Enum.Error);
return null;
}
}
示例13: Write_Main_Viewer_Section
/// <summary> Stream to which to write the HTML for this subwriter </summary>
/// <param name="Output"> Response stream for the item viewer to write directly to </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Feature_ItemViewer.Write_Main_Viewer_Section", "");
}
// Save the current viewer code
string current_view_code = CurrentMode.ViewerCode;
// Start the citation table
Output.WriteLine("\t\t<!-- FEATURE VIEWER OUTPUT -->" );
Output.WriteLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Features</b></span></td></tr>" );
Output.WriteLine("\t\t<tr><td class=\"SobekDocumentDisplay\">");
Output.WriteLine("\t\t\t<div class=\"SobekCitation\">");
// Get the list of streets from the database
Map_Features_DataSet features = SobekCM_Database.Get_All_Features_By_Item( CurrentItem.Web.ItemID, Tracer );
Create_Feature_Index( Output, features );
// Finish the citation table
Output.WriteLine( "\t\t\t</div>" );
Output.WriteLine("\t\t</td>" );
Output.WriteLine("\t\t<!-- END FEATURE VIEWER OUTPUT -->" );
// Restore the mode
CurrentMode.ViewerCode = current_view_code;
}
示例14: Write_Main_Viewer_Section
/// <summary> Stream to which to write the HTML for this subwriter </summary>
/// <param name="Output"> Response stream for the item viewer to write directly to </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("EAD_Description_ItemViewer.Write_Main_Viewer_Section", "");
}
// Get the metadata module for EADs
EAD_Info eadInfo = (EAD_Info)CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);
// Build the value
Output.WriteLine(" <td>");
Output.WriteLine(" <div id=\"sbkEad_MainArea\">");
if (CurrentMode.Text_Search.Length > 0)
{
// Get any search terms
List<string> terms = new List<string>();
if (CurrentMode.Text_Search.Trim().Length > 0)
{
string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
}
Output.Write(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(eadInfo.Full_Description, terms));
}
else
{
Output.Write(eadInfo.Full_Description);
}
Output.WriteLine(" </div>");
Output.WriteLine(" </td>");
}
示例15: Get_Current_Page
/// <summary> Gets a page from an existing digital resource, by page sequence </summary>
/// <param name="Current_Item"> Digital resource from which to pull the current page, by sequence </param>
/// <param name="Sequence"> Sequence for the page to retrieve from this item </param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
/// <returns> Page tree node object for the requested page </returns>
public static Page_TreeNode Get_Current_Page(SobekCM_Item Current_Item, int Sequence, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("SobekCM_Item_Factory.Get_Current_Page", "Requesting the page (by sequence) from the item");
}
Page_TreeNode returnValue = null;
try
{
// Set the current page
if (Sequence >= 1)
{
int requested_page = Sequence - 1;
if ((requested_page < 0) || (requested_page > Current_Item.Web.Static_PageCount - 1))
requested_page = 0;
if (requested_page <= Current_Item.Web.Static_PageCount - 1)
{
returnValue = Current_Item.Web.Pages_By_Sequence[requested_page];
}
}
}
catch (Exception ee)
{
throw new ApplicationException("Error assigning the current page sequence", ee);
}
return returnValue;
}