本文整理汇总了C#中Template.GetFullPath方法的典型用法代码示例。如果您正苦于以下问题:C# Template.GetFullPath方法的具体用法?C# Template.GetFullPath怎么用?C# Template.GetFullPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.GetFullPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssembleDocument
/// <summary>
/// <c>AssembleDocument</c> assembles (creates) a document from the given template, answers and settings.
/// </summary>
/// <param name="template">An instance of the Template class, from which the document will be assembled.</param>
/// <param name="answers">The set of answers that will be applied to the template to assemble the document</param>
/// <param name="settings">settings that will be used to assemble the document.
/// These settings include the assembled document format (file extension), markup syntax, how to display fields with unanswered variables, etc</param>
/// <param name="logRef">A string to display in logs related to this request.</param>
/// <returns>returns information about the assembled document, the document type, the unanswered variables, the resulting answers, etc.</returns>
public AssembleDocumentResult AssembleDocument(Template template, TextReader answers, AssembleDocumentSettings settings, string logRef)
{
// Validate input parameters, creating defaults as appropriate.
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"WebService.Services.AssembleDocument: the ""template"" parameter passed in was null, logRef: {0}", logStr));
if (settings == null)
settings = new AssembleDocumentSettings();
AssembleDocumentResult result = null;
AssemblyResult asmResult = null;
using (Proxy client = new Proxy(_endPointName))
{
OutputFormat outputFormat = ConvertFormat(settings.Format);
AssemblyOptions assemblyOptions = ConvertOptions(settings);
string fileName = GetRelativePath(template.GetFullPath());
asmResult = client.AssembleDocument(
fileName,
answers == null ? null : new BinaryObject[] { Util.GetBinaryObjectFromTextReader(answers) }, // answers
outputFormat,
assemblyOptions,
null);
SafeCloseClient(client, logRef);
}
if (asmResult != null)
{
result = Util.ConvertAssemblyResult(template, asmResult, settings.Format);
}
return result;
}
示例2: AssembleDocument
/// <summary>
/// Assemble a document from the given template, answers and settings.
/// </summary>
/// <param name="template">An instance of the Template class.</param>
/// <param name="answers">Either an XML answer string, or a string containing encoded
/// interview answers as posted from a HotDocs browser interview.</param>
/// <param name="settings">An instance of the AssembleDocumentResult class.</param>
/// <include file="../Shared/Help.xml" path="Help/string/param[@name='logRef']"/>
/// <returns>An AssemblyResult object containing all the files and data resulting from the request.</returns>
public AssembleDocumentResult AssembleDocument(Template template, TextReader answers, AssembleDocumentSettings settings, string logRef)
{
// Validate input parameters, creating defaults as appropriate.
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"Local.Services.AssembleDocument: the ""template"" parameter passed in was null, logRef: {0}", logStr));
if (settings == null)
settings = new AssembleDocumentSettings();
HotDocs.Server.AnswerCollection ansColl = new HotDocs.Server.AnswerCollection();
ansColl.OverlayXMLAnswers(answers == null ? "" : answers.ReadToEnd());
HotDocs.Server.OutputOptions outputOptions = ConvertOutputOptions(settings.OutputOptions);
string docPath = CreateTempDocDirAndPath(template, settings.Format);
_app.AssembleDocument(
template.GetFullPath(),//Template path
settings.UseMarkupSyntax ? hdsi.HDAssemblyOptions.asmOptMarkupView : hdsi.HDAssemblyOptions.asmOptNone,
ansColl,
docPath,
outputOptions);
//Prepare the post-assembly answer set (dropping transient ("don't save") answers when appropriate)
HotDocs.Sdk.AnswerCollection resultAnsColl = new AnswerCollection();
resultAnsColl.ReadXml(new StringReader(ansColl.XmlAnswers));
string resultAnsXml = resultAnsColl.GetXMLString(false, settings.RetainTransientAnswers || _app.PendingAssemblyCmdLineStrings.Count > 0);
//Build the list of pending assemblies.
List<Template> pendingAssemblies = new List<Template>();
for (int i = 0; i < _app.PendingAssemblyCmdLineStrings.Count; i++)
{
string cmdLine = _app.PendingAssemblyCmdLineStrings[i];
string path, switches;
Util.ParseHdAsmCmdLine(cmdLine, out path, out switches);
pendingAssemblies.Add(new Template(Path.GetFileName(path), template.Location.Duplicate(), switches));
}
//Prepare the document stream and image information for the browser.
DocumentType docType = settings.Format;
List<NamedStream> supportingFiles = new List<NamedStream>();
MemoryStream docStream;
if (docType == DocumentType.Native)
{
docType = Document.GetDocumentType(docPath);
docStream = LoadFileIntoMemStream(docPath);
}
else if (docType == DocumentType.HTMLwDataURIs)
{
//If the consumer requested both HTML and HTMLwDataURIs, they'll only get the latter.
string content = Util.EmbedImagesInURIs(docPath);
docStream = new MemoryStream(Encoding.UTF8.GetBytes(content));
}
else if (docType == DocumentType.MHTML)
{
string content = Util.HtmlToMultiPartMime(docPath);
docStream = new MemoryStream(Encoding.UTF8.GetBytes(content));
}
else if (docType == DocumentType.HTML)
{
string targetFilenameNoExtention = Path.GetFileNameWithoutExtension(docPath);
foreach (string img in Directory.EnumerateFiles(Path.GetDirectoryName(docPath)))
{
string ext = Path.GetExtension(img).ToLower();
if (Path.GetFileName(img).StartsWith(targetFilenameNoExtention) && (ext == ".jpg" || ext == ".jpeg" || ext == ".gif" || ext == ".png" || ext == ".bmp"))
supportingFiles.Add(LoadFileIntoNamedStream(img));
}
docStream = LoadFileIntoMemStream(docPath);
}
else
{
docStream = LoadFileIntoMemStream(docPath);
}
//Now that we've loaded all of the assembly results into memory, remove the assembly files.
FreeTempDocDir(docPath);
//Return the results.
Document document = new Document(template, docStream, docType, supportingFiles.ToArray(), _app.UnansweredVariablesList.ToArray());
AssembleDocumentResult result = new AssembleDocumentResult(document, resultAnsXml, pendingAssemblies.ToArray(), _app.UnansweredVariablesList.ToArray());
return result;
}
示例3: RemoveSupportFiles
/// <summary>
/// Remove the server files for the specified template.
/// </summary>
/// <param name="template">The template for which support files will be removed.</param>
public void RemoveSupportFiles(Template template)
{
if (template == null)
throw new ArgumentNullException("template", @"Local.Services.RemoveSupportFiles: the ""template"" parameter passed in was null");
using (HotDocs.Server.Application app = new HotDocs.Server.Application())
{
app.RemoveSupportFiles(template.GetFullPath(), template.Key);
}
}
示例4: GetInterviewFile
/// <summary>
/// Retrieves a file required by the interview. This could be either an interview definition that contains the
/// variables and logic required to display an interview (questionaire) for the main template or one of its
/// inserted templates, or it could be an image file displayed on a dialog within the interview.
/// </summary>
/// <param name="template">The template related to the requested file.</param>
/// <param name="fileName">The file name of the image, or the file name of the template for which the interview
/// definition is being requested. In either case, this value is passed as "template" on the query string by the browser interview.</param>
/// <param name="fileType">The type of file being requested: img (image file), js (JavaScript interview definition),
/// or dll (Silverlight interview definition).</param>
/// <returns>A stream containing the requested interview file, to be returned to the caller.</returns>
public Stream GetInterviewFile(Template template, string fileName, string fileType)
{
// Validate input parameters, creating defaults as appropriate.
if (template == null)
throw new ArgumentNullException("template", @"Local.Services.GetInterviewFile: the ""template"" parameter passed in was null");
if (string.IsNullOrEmpty(fileName))
throw new ArgumentNullException("fileName", @"Local.Services.GetInterviewFile: the ""fileName"" parameter passed in was null or empty");
if (string.IsNullOrEmpty(fileType))
throw new ArgumentNullException("fileType", @"Local.Services.GetInterviewFile: the ""fileType"" parameter passed in was null or empty");
// Return an image or interview definition from the template.
switch (fileType.ToUpper())
{
case "IMG":
return template.Location.GetFile(fileName);
default:
string interviewDefPath = _app.GetInterviewDefinitionFromTemplate(
Path.Combine(Path.GetDirectoryName(template.GetFullPath()), fileName),
fileName,
fileType == "dll" ? hdsi.interviewFormat.Silverlight : hdsi.interviewFormat.javascript
);
return File.OpenRead(interviewDefPath);
}
}
示例5: GetInterview
///<summary>
/// GetInterview returns an HTML fragment suitable for inclusion in any standards-mode web page, which embeds a HotDocs interview
/// directly in that web page.
///</summary>
/// <param name="template">The template for which to return an interview.</param>
/// <param name="answers">The answers to use when building an interview.</param>
/// <param name="settings">The <see cref="InterviewSettings"/> to use when building an interview.</param>
/// <param name="markedVariables">The variables to highlight to the user as needing special attention.
/// This is usually populated with <see cref="AssembleDocumentResult.UnansweredVariables" />
/// from <see cref="AssembleDocument" />.</param>
/// <include file="../Shared/Help.xml" path="Help/string/param[@name='logRef']"/>
/// <returns>Returns the results of building the interview as an <see cref="InterviewResult"/> object.</returns>
public InterviewResult GetInterview(Template template, TextReader answers, InterviewSettings settings, IEnumerable<string> markedVariables, string logRef)
{
// Validate input parameters, creating defaults as appropriate.
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"Local.Services.GetInterview: the ""template"" parameter passed in was null, logRef: {0}", logStr));
if (settings == null)
settings = new InterviewSettings();
// HotDocs Server reads the following settings out of the registry all the time; therefore these items are ignored when running against Server:
// settings.AddHdMainDiv
// settings.AnswerSummary.*
// settings.DefaultDateFormat
// settings.DefaultUnansweredFormat
// settings.HonorCmpUnansweredFormat
// settings.DisableAnswerSummary
// HotDocs Server does not include the following settings in its .NET or COM APIs, so Util.AppendSdkScriptBlock (below)
// includes them with the interview script block:
// settings.Locale
// settings.NextFollowsOutline
// settings.ShowAllResourceButtons
hdsi.interviewFormat fmt;
switch (settings.Format)
{
case InterviewFormat.JavaScript:
fmt = hdsi.interviewFormat.javascript;
break;
case InterviewFormat.Silverlight:
fmt = hdsi.interviewFormat.Silverlight;
break;
default:
fmt = hdsi.interviewFormat.Unspecified;
break;
}
// Configure the interview options
hdsi.HDInterviewOptions itvOpts = hdsi.HDInterviewOptions.intOptNoImages; // Instructs HDS not to return images used by the interview; we'll get them ourselves from the template folder.
if (settings.DisableDocumentPreview)
itvOpts |= hdsi.HDInterviewOptions.intOptNoPreview; // Disables (omits) the Document Preview button on the interview toolbar.
if (settings.DisableSaveAnswers)
itvOpts |= hdsi.HDInterviewOptions.intOptNoSave; // Disables (omits) the Save Answers button on the interview toolbar.
if (settings.RoundTripUnusedAnswers)
itvOpts |= hdsi.HDInterviewOptions.intOptStateless; // Prevents original answer file from being encrypted and sent to the interview and then posted back at the end.
// Get the interview.
InterviewResult result = new InterviewResult();
StringBuilder htmlFragment;
using (var ansColl = new HotDocs.Server.AnswerCollection())
{
if (answers != null)
{
if (answers.Peek() == 0xFEFF)
answers.Read(); // discard BOM if present
ansColl.XmlAnswers = answers.ReadToEnd();
}
if (markedVariables == null)
_app.UnansweredVariablesList = new string[0];
else
_app.UnansweredVariablesList = markedVariables;
htmlFragment = new StringBuilder(
_app.GetInterview(
template.GetFullPath(),
template.Key,
fmt,
itvOpts,
settings.InterviewRuntimeUrl,
settings.StyleSheetUrl + "/" + settings.ThemeName + ".css",
ansColl,
settings.PostInterviewUrl,
settings.Title,
Util.GetInterviewDefinitionUrl(settings, template),
null, // the path to which HDS should copy interview images; also the path that may become part of the DocumentPreviewStateString & passed to document preview handler
Util.GetInterviewImageUrl(settings, template),
settings.SaveAnswersUrl,
settings.DocumentPreviewUrl)
);
}
Util.AppendSdkScriptBlock(htmlFragment, template, settings);
result.HtmlFragment = htmlFragment.ToString();
//.........这里部分代码省略.........
示例6: GetComponentInfo
/// <summary>
/// GetComponentInfo returns metadata about the variables/types (and optionally dialogs and mapping info)
/// for the indicated template's interview.
/// </summary>
/// <param name="template">The template for which to return a ComponentInfo object.</param>
/// <param name="includeDialogs">True if dialog components are to be included in the returned <c>ComponentInfo</c>.</param>
/// <include file="../../Shared/Help.xml" path="Help/string/param[@name='logRef']"/>
/// <returns></returns>
public ComponentInfo GetComponentInfo(Template template, bool includeDialogs, string logRef)
{
string logStr = logRef == null ? string.Empty : logRef;
// Validate input parameters, creating defaults as appropriate.
if (template == null)
throw new ArgumentNullException("template", @"Local.Services.GetInterviewFile: the ""template"" parameter passed in was null or empty, logRef: " + logStr);
string templateFilePath = template.GetFullPath();
//Get the hvc path. GetHvcPath will also validate the template file name.
string hvcPath;
GetHvcPath(templateFilePath, out hvcPath);
if (hvcPath.Length == 0)
throw new Exception("Invalid template path.");
if (!File.Exists(hvcPath))
throw new HotDocs.Server.HotDocsServerException("You do not have read access to the variable collection file (.hvc)");
// Instantiate a ComponentInfo object to hold the data to be returned
ComponentInfo cmpInfo = new ComponentInfo();
// Load the HVC variable collection
using (HotDocs.Server.VariableCollection varCol = new HotDocs.Server.VariableCollection(hvcPath))
{
for (int i = 0; i < varCol.Count; i++)
cmpInfo.AddVariable(new Contracts.VariableInfo { Name = varCol.VarName(i), Type = AnsTypeToString(varCol.VarType(i)) });
}
// Load the Dialogs (if requested)
if (includeDialogs)
{
// Load the component collection from disk
using (var cmpColl = new HotDocs.Server.ComponentCollection())
{
cmpColl.Open(templateFilePath, hdsi.CMPOpenOptions.LoadAllCompLibs);
// Iterate through the component collection and add dialogs to ComponentInfo
foreach (HotDocs.Server.Component cmp in cmpColl)
{
if (cmp.Type == hdsi.hdCmpType.hdDialog)
{
// Fetch dialog properties (AnswerSource, Repeat, variable list and mappingNames) from the component collection
object[] variableNames = null;
object[] mappingNames = null;
DialogInfo dlgInfo = new DialogInfo();
dlgInfo.Name = cmp.Name;
using (HotDocs.Server.ComponentProperties properties = cmp.Properties)
{
using (HotDocs.Server.ComponentProperty p = (HotDocs.Server.ComponentProperty)properties["Variables"])
{
variableNames = (object[])p.Value;
};
using (HotDocs.Server.ComponentProperty p = (HotDocs.Server.ComponentProperty)properties["IsRepeated"])
using (HotDocs.Server.ComponentProperty p2 = (HotDocs.Server.ComponentProperty)properties["IsSpread"])
{
dlgInfo.Repeat = (bool)p.Value || (bool)p2.Value;
};
using (HotDocs.Server.ComponentProperty p = (HotDocs.Server.ComponentProperty)properties["AnswerSource"])
{
dlgInfo.AnswerSource = ((p != null) && (!String.IsNullOrWhiteSpace((string)p.Value))) ? (string)p.Value : null;
};
if (dlgInfo.AnswerSource != null)
{
using (HotDocs.Server.ComponentProperty p = (HotDocs.Server.ComponentProperty)properties["MappingNames"])
{
mappingNames = (object[])p.Value;
};
}
}
// Add the mapping information to the dialog
// Note that variableNames.Length is always equal to mappingNames.Length if mappingNames.Length is not null.
for (int i = 0; i < variableNames.Length; i++)
{
string variableName = variableNames[i].ToString();
if (cmpInfo.IsDefinedVariable(variableName))
{
//The i < mappingNames.Length test here is strictly defensive.
string mappingName = (mappingNames != null && i < mappingNames.Length) ? mappingNames[i].ToString() : null;
dlgInfo.Items.Add(new DialogItemInfo
{
Name = variableName,
Mapping = String.IsNullOrWhiteSpace(mappingName) ? null : mappingName
});
}
}
// Adds the dialog to ComponentInfo object IF it contains any variables that were in the HVC
if (dlgInfo.Items.Count > 0)
cmpInfo.AddDialog(dlgInfo);
}
//.........这里部分代码省略.........
示例7: BuildSupportFiles
/// <summary>
/// Build the server files for the specified template.
/// </summary>
/// <param name="template">The template for which support files will be built.</param>
/// <param name="flags">Indicates what types of support files to build.</param>
public void BuildSupportFiles(Template template, HDSupportFilesBuildFlags flags)
{
if (template == null)
throw new ArgumentNullException("template", @"Local.Services.BuildSupportFiles: the ""template"" parameter passed in was null");
using (HotDocs.Server.Application app = new HotDocs.Server.Application())
{
hdsi.HDSupportFilesBuildFlags hdBuildFlags = 0;
if ((flags & HDSupportFilesBuildFlags.BuildJavaScriptFiles) != 0)
hdBuildFlags |= hdsi.HDSupportFilesBuildFlags.BuildJavaScriptFiles;
if ((flags & HDSupportFilesBuildFlags.BuildSilverlightFiles) != 0)
hdBuildFlags |= hdsi.HDSupportFilesBuildFlags.BuildSilverlightFiles;
if ((flags & HDSupportFilesBuildFlags.ForceRebuildAll) != 0)
hdBuildFlags |= hdsi.HDSupportFilesBuildFlags.ForceRebuildAll;
if ((flags & HDSupportFilesBuildFlags.IncludeAssembleTemplates) != 0)
hdBuildFlags |= hdsi.HDSupportFilesBuildFlags.IncludeAssembleTemplates;
app.BuildSupportFiles(template.GetFullPath(), template.Key, hdBuildFlags);
}
}
示例8: RemoveSupportFiles
/// <summary>
/// <c>RemoveSupportFiles</c> removes support files (javascript and SilverLight) for the supplied <c>template</c>
/// </summary>
/// <param name="template">An instance of the Template class, for which the supporting javascript files and
/// Silverlight DLLs will be removed</param>
public void RemoveSupportFiles(Template template)
{
if (template == null)
throw new ArgumentNullException("template", @"WebService.Services.RemoveSupportFiles: The ""template"" parameter passed in was null.");
using (Proxy client = GetProxy())
{
string templateId = GetRelativePath(template.GetFullPath());
string templateKey = template.FileName;
string templateState = null;
client.RemoveSupportFiles(templateId, templateKey, templateState);
SafeCloseClient(client, null);
}
}
示例9: GetInterviewFile
/// <summary>
/// Retrieves a file required by the interview. This could be either an interview definition that contains the
/// variables and logic required to display an interview (questionaire) for the main template or one of its
/// inserted templates, or it could be an image file displayed on a dialog within the interview.
/// </summary>
/// <param name="template">The template related to the requested file.</param>
/// <param name="fileName">The file name of the image, or the file name of the template for which the interview
/// definition is being requested. In either case, this value is passed as "template" on the query string by the browser interview.</param>
/// <param name="fileType">The type of file being requested: img (image file), js (JavaScript interview definition),
/// or dll (Silverlight interview definition).</param>
/// <returns>A stream containing the requested interview file, to be returned to the caller.</returns>
public Stream GetInterviewFile(Template template, string fileName, string fileType)
{
// Validate input parameters, creating defaults as appropriate.
if (template == null)
throw new ArgumentNullException("template", @"WebService.Services.GetInterviewFile: The ""template"" parameter passed in was null.");
if (string.IsNullOrEmpty(fileName))
throw new ArgumentNullException("fileName", @"WebService.Services.GetInterviewFile: The ""fileName"" parameter passed in was null or empty.");
if (string.IsNullOrEmpty(fileType))
throw new ArgumentNullException("fileType", @"WebService.Services.GetInterviewFile: The ""fileType"" parameter passed in was null or empty.");
// Return an image or interview definition from the template.
InterviewFormat format = InterviewFormat.Unspecified;
switch (fileType.ToUpper())
{
case "IMG":
return template.Location.GetFile(fileName);
case "DLL":
format = InterviewFormat.Silverlight;
break;
case "JS":
format = InterviewFormat.JavaScript;
break;
}
if (format == InterviewFormat.Unspecified)
throw new ArgumentOutOfRangeException(); // The format must be either JS or DLL.
System.IO.Stream result = null;
using (Proxy client = GetProxy())
{
string templateId = GetRelativePath(Path.Combine(Path.GetDirectoryName(template.GetFullPath()), fileName)); // The relative path to the template folder.
string templateName = fileName; // The name of the template file for which the interview is being requested (e.g., demoempl.rtf).
string templateState = string.Empty; // We are using the templateId rather than template state since all we have to work with is a template locator.
BinaryObject binaryObject = client.GetInterviewDefinition(templateId, templateName, format, templateState);
SafeCloseClient(client, null);
result = new MemoryStream(binaryObject.Data);
}
return result;
}
示例10: GetInterview
/// <summary>
/// <c>GetInterview</c> returns an HTML fragment suitable for inclusion in any standards-mode web page, which embeds a HotDocs interview
/// directly in that web page.
/// </summary>
/// <param name="template">An instance of the Template class, for which the interview will be requested.</param>
/// <param name="answers">The initial set of answers to include in the interview.</param>
/// <param name="settings">Settings that define various interview behaviors.</param>
/// <param name="markedVariables">A collection of variables that should be marked with special formatting in the interview.</param>
/// <param name="logRef">A string to display in logs related to this request.</param>
/// <returns>An object which contains an HTML fragment to be inserted in a web page to display the interview.</returns>
public InterviewResult GetInterview(Template template, TextReader answers, InterviewSettings settings, IEnumerable<string> markedVariables, string logRef)
{
// Validate input parameters, creating defaults as appropriate.
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"WebServices.Services.GetInterview: The ""template"" parameter passed in was null, logRef: {0}.", logStr));
if (settings == null)
settings = new InterviewSettings();
// Configure interview options
InterviewOptions itvOpts = InterviewOptions.OmitImages; // Instructs HDS not to return images used by the interview; we'll get them ourselves from the template folder.
if (settings.DisableDocumentPreview)
itvOpts |= InterviewOptions.NoPreview; // Disables (omits) the Document Preview button on the interview toolbar.
if (settings.DisableSaveAnswers)
itvOpts |= InterviewOptions.NoSave; // Disables (omits) the Save Answers button on the interview toolbar.
if (!settings.RoundTripUnusedAnswers)
itvOpts |= InterviewOptions.ExcludeStateFromOutput; // Prevents original answer file from being encrypted and sent to the interview and then posted back at the end.
// Get the interview.
InterviewResult result = new InterviewResult();
BinaryObject[] interviewFiles = null;
using (Proxy client = GetProxy())
{
string fileName = GetRelativePath(template.GetFullPath());
interviewFiles = client.GetInterview(
fileName,
answers == null ? null : new BinaryObject[] { Util.GetBinaryObjectFromTextReader(answers) }, // answers
settings.Format,
itvOpts,
markedVariables != null ? markedVariables.ToArray<string>() : null, // variables to highlight as unanswered
settings.PostInterviewUrl, // page to which interview will submit its answers
settings.InterviewRuntimeUrl, // location (under this app's domain name) where HotDocs Server JS files are available
settings.StyleSheetUrl + "/" + settings.ThemeName + ".css", // URL of CSS stylesheet (typically called hdsuser.css). hdssystem.css must exist in same directory.
Util.GetInterviewImageUrl(settings, template), // interview images will be requested from GetInterviewFile.ashx, which will stream them from the template directory
!settings.DisableSaveAnswers ? settings.SaveAnswersUrl : "", //for the save answers button; if this is null the "Save Answers" button does not appear
!settings.DisableDocumentPreview ? settings.DocumentPreviewUrl : "", // document previews will be requested from here; if null the "Document Preview" button does not appear
Util.GetInterviewDefinitionUrl(settings, template)); // Interview definitions (Silverlight or JavaScript) will be requested from here -- careful with relative URLs!!
if (interviewFiles != null)
{
StringBuilder interview = new StringBuilder(Util.ExtractString(interviewFiles[0]));
Util.AppendSdkScriptBlock(interview, template, settings);
result.HtmlFragment = interview.ToString();
// The Web Services do not have a way to set the title of the template--it always uses the title from the component file.
// So here we are replacing the title that was put in the html fragment with the template's title, which may have
// been set later and does not match its component file.
result.HtmlFragment = Regex.Replace(result.HtmlFragment, "HDTemplateName=\\\".+?\"", "HDTemplateName=\"" + settings.Title + "\"");
}
SafeCloseClient(client, logRef);
}
return result;
}
示例11: GetComponentInfo
/// <summary>
/// <c>GetComponentInfo</c> returns metadata about the variables/types (and optionally dialogs and mapping info)
/// for the indicated template's interview.
/// </summary>
/// <param name="template">An instance of the Template class, for which you are requesting component information.</param>
/// <param name="includeDialogs">Whether to include dialog and mapping information in the returned results.</param>
/// <param name="logRef">A string to display in logs related to this request.</param>
/// <returns>returns the list of variables and dialogs (if includeDialogs is true) associated with the <c>template</c> parameter</returns>
public ComponentInfo GetComponentInfo(Template template, bool includeDialogs, string logRef)
{
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"WebService.Services.GetComponentInfo: The ""template"" parameter passed in was null, logRef: {0}.", logStr));
ComponentInfo result;
using (Proxy client = GetProxy())
{
string fileName = GetRelativePath(template.GetFullPath());
result = client.GetComponentInfo(fileName, includeDialogs);
SafeCloseClient(client, logRef);
}
return result;
}
示例12: BuildSupportFiles
/// <summary>
/// <c>BuildSupportFiles</c> generates (or regenerates) the supporting javascript files and Silverlight DLLs
/// for the supplied <c>template</c>
/// </summary>
/// <param name="template">An instance of the Template class, for which the supporting javascript files and
/// Silverlight DLLs will be generated</param>
/// <param name="flags">A set of flags to control whether javascript or SilverLight files will be generated,
/// as well as whether to build files for templates included with an assemble instruction.</param>
public void BuildSupportFiles(Template template, HDSupportFilesBuildFlags flags)
{
if (template == null)
throw new ArgumentNullException("template", @"WebService.Services.BuildSupportFiles: the ""template"" parameter passed in was null");
using (Proxy client = new Proxy(_endPointName))
{
string templateId = GetRelativePath(template.GetFullPath());
string templateKey = template.FileName;
string templateState = null;
client.BuildSupportFiles(templateId, templateKey, flags, templateState);
SafeCloseClient(client, null);
}
}