public string GetOutputData(OutputMethod method) { var data = GetData(); if (data == null) { return(null); } switch (method) { case OutputMethod.Raw: return(data.ToString()); case OutputMethod.Text: return(HttpUtility.HtmlEncode(data)); case OutputMethod.Html: return(Sanitizer.Sanitize(data.ToString())); case OutputMethod.Default: return(GetOutputData(this.OutputMethod)); default: throw new SnNotSupportedException("Unknown OutputMethod: " + this.Field.FieldSetting.OutputMethod); } }
/// <summary> /// Creates new <c>OutputState</c> with default properties values: /// UTF8 encoding, no indentation, nonstandalone document, XML output /// method. /// </summary> public OutputState() { encoding = System.Text.Encoding.UTF8; indent = true; standalone = false; method = OutputMethod.Html; }
public void PrintWarnings(OutputMethod output) { foreach (string warning in _warnings) { output(warning); } }
/// <summary> /// 例外をユーザー定義の方法で出力する /// </summary> /// <param name="outMethod">ユーザー定義の例外出力デリゲートメソッド</param> public static void Output(OutputMethod outMethod) { if (eList.Count > 0) { outMethod(eList.ToArray()); } }
/// <summary> /// Creates new <c>OutputState</c> with default properties values: /// UTF8 encoding, no indentation, nonstandalone document, XML output /// method. /// </summary> public OutputState() { encoding = System.Text.Encoding.UTF8; indent = false; standalone = false; omitXmlDecl = false; method = OutputMethod.Xml; }
public LogOut_Method(OutputMethod OutMethod) { if (OutMethod == null) { throw new ArgumentNullException(); } base.Output = OutMethod; }
public void SetLinkedTo(XDvdFsFileSystemEntry fse) { if (this._copymethod != OutputMethod.Crosslink) { this.ParentNode.Files.UpdateSizes(0, 0, (long)(((int)this.LogicalFileSize) * -1)); } this.linkedTo = fse; this._copymethod = OutputMethod.Crosslink; }
//設定撥放方法 public void SetSourceOutputMethod(byte num, OutputMethod method) { for (int i = 0; i < audioSourcesPack.Count; i++) { if (audioSourcesPack[i].GetSourceNum == num) { audioSourcesPack[i].SetOutputMethod = method; } } }
public void Output_OutputMethod_CreatesElementWithMethod(OutputMethod outputMethod) { var xslt = new XsltFactory(); var method = outputMethod.ToString().ToLower(); var output = xslt.Output(outputMethod); Assert.Equal("output", output.Name.LocalName); Assert.Contains(output.Attributes(), a => a.Name == "method" && a.Value == method); Assert.DoesNotContain(output.Attributes(), a => a.Name == "indent"); }
internal XsltOutput CreateDerivedOutput(OutputMethod method) { XsltOutput output = (XsltOutput)MemberwiseClone(); output.method = method; if (method == OutputMethod.Html && this.indentSId == int.MaxValue) // HTML output and Ident wasn't specified { output.indent = true; } return(output); }
/// <summary> /// Creates an <c>xsl:output</c> element. /// <code> /// <xsl:output method="<paramref name="outputMethod"/>" /> /// </code> /// </summary> /// <param name="outputMethod">The output method.</param> /// <param name="indent">if set to <c>true</c> [indent].</param> public XsltElement Output(OutputMethod outputMethod = OutputMethod.Xml, bool indent = false) { var element = new XsltElement(XsltElementType.Output, new XAttribute("method", outputMethod.ToString().ToLower())); if (indent) { element.SetAttributeValue("indent", "yes"); } return(element); }
private EnvironmentParameters(ARMEnvironment environment, OutputMethod outputMethod, string subscriptionId = null, string userId = null) { this.AADUri = EnvironmentParameters.GetAADUri(environment: environment); this.GraphUri = EnvironmentParameters.GetGraphUri(environment: environment); this.GraphApiVersion = "2013-04-05"; this.ResourceManagerUri = EnvironmentParameters.GetResourceManagerUri(environment: environment); this.ResourceManagerApiVersion = "2014-01-01"; this.ProvidedSubscriptionId = subscriptionId; this.ProvidedUserId = userId; this.OutputMethod = outputMethod; }
private static string GetFrom(IViewBaseInternal view, OutputMethod output) { string actual; using (var writer = new StringWriter()) using (view.SetDisposeableOutputWriter(writer)) { output.Invoke(); actual = writer.GetStringBuilder().ToString(); } return(actual); }
// ctor public UiGenerator(OutputMethod output, string configurationFileName, string assemblyDirectory) { _output = output; _warnings = new CodeGeneratorWarnings(); _configuration = new ApplicationConfiguration(configurationFileName, _warnings); _assemblyDirectory = assemblyDirectory; Placeholder.Prefix = _configuration.PlaceholderPrefix; Placeholder.Postfix = _configuration.PlaceholderPostfix; AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); InitializeConfiguration(assemblyDirectory); }
// ctor public UiGenerator(OutputMethod output, string configurationFileName, string assemblyDirectory) { _output = output; _warnings = new CodeGeneratorWarnings(); _configuration = new ApplicationConfiguration(configurationFileName, _warnings); _assemblyDirectory = assemblyDirectory; Placeholder.Prefix = _configuration.PlaceholderPrefix; Placeholder.Postfix = _configuration.PlaceholderPostfix; AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler (CurrentDomain_AssemblyResolve); InitializeConfiguration (assemblyDirectory); }
public static IOutputMethod GetOutputMethod(string outputName) { OutputMethod format = GetOutputMethod(); switch (format) { case OutputMethod.ZipAes256: return(new ZipAes256.ZipAes256Exporter(outputName)); case OutputMethod.Kdbx: break; } return(null); }
public static string BuildFile(string bicepTemplateFilePath, OutputMethod outputMethod = null) { if (!IsBicepExecutable && !CheckBicepExecutable()) { throw new AzPSApplicationException(Properties.Resources.BicepNotFound); } string currentBicepVersion = CheckMinimalVersionRequirement(MinimalVersionRequirement); string tempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(tempDirectory); if (FileUtilities.DataStore.FileExists(bicepTemplateFilePath)) { System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create(); powershell.AddScript($"bicep build '{bicepTemplateFilePath}' --outdir '{tempDirectory}'"); var result = powershell.Invoke(); if (outputMethod != null) { outputMethod(string.Format("Using Bicep v{0}", currentBicepVersion)); result.ForEach(r => outputMethod(r.ToString())); } string errorMsg = string.Empty; if (powershell.HadErrors) { powershell.Streams.Error.ForEach(e => { errorMsg += (e + Environment.NewLine); }); errorMsg = errorMsg.Substring(0, errorMsg.Length - Environment.NewLine.Length); outputMethod(errorMsg); } powershell.AddScript("$LASTEXITCODE"); result = powershell.Invoke(); int.TryParse(result.ToString(), out int exitcode); if (exitcode != 0) { throw new AzPSApplicationException(errorMsg); } } else { throw new AzPSArgumentException(Properties.Resources.InvalidBicepFilePath, "TemplateFile"); } return(Path.Combine(tempDirectory, Path.GetFileName(bicepTemplateFilePath)).Replace(".bicep", ".json")); }
public static void OutputToken(OutputMethod outputMethod, string token) { switch (outputMethod) { case OutputMethod.Clipboard: OutputHelpers.CopyToClipboard(text: token); return; case OutputMethod.TempFile: OutputHelpers.WriteToTempFile(text: token); return; case OutputMethod.Print: default: Console.WriteLine(token); return; } }
/// <summary> /// Gets a the specified property belonging to the Content of the View in a safe way. /// </summary> /// <param name="name">The property name. Can be hierarchical.</param> /// <returns>String value of the property specified</returns> internal static string GetValue(string name, SNC.Content parentContent, OutputMethod outputMethod) { switch (outputMethod) { case OutputMethod.Default: throw new NotSupportedException("OutputMethod cannot be Default"); case OutputMethod.Raw: return(GetValue(name, parentContent)); case OutputMethod.Text: return(System.Web.HttpUtility.HtmlEncode(GetValue(name, parentContent))); case OutputMethod.Html: return(SenseNet.Portal.Security.Sanitize(GetValue(name, parentContent))); default: throw new NotImplementedException("Unknown OutputMethod: " + outputMethod); } }
/// <summary> /// Gets a the specified property belonging to the Content of the View in a safe way. /// </summary> /// <param name="name">The property name. Can be hierarchical.</param> /// <returns>String value of the property specified</returns> internal static string GetValue(string name, SNC.Content parentContent, OutputMethod outputMethod, bool storedData = false, CultureInfo cultureInfo = null) { switch (outputMethod) { case OutputMethod.Default: throw new NotSupportedException("OutputMethod cannot be Default"); case OutputMethod.Raw: return(GetValue(name, parentContent, storedData, cultureInfo)); case OutputMethod.Text: return(System.Web.HttpUtility.HtmlEncode(GetValue(name, parentContent, storedData, cultureInfo))); case OutputMethod.Html: return(Sanitizer.Sanitize(GetValue(name, parentContent, storedData, cultureInfo))); default: throw new NotImplementedException("Unknown OutputMethod: " + outputMethod); } }
public uint Open(OutputMethod OutMethd) { var newlog = new LogOut_Method(OutMethd); return this.add(newlog); }
public LogOut() { this.Output = (string Message) => Console.WriteLine(Message); }
public LogOut_Method(OutputMethod OutMethod) { if (OutMethod == null) throw new ArgumentNullException(); base.Output = OutMethod; }
public void TestOps(int numberOfTests, int ObstacleChance) { //besmellahe rahman rahim OutputMethod RawFile = new OutputMethod(); OutputMethod resultsOutput = new OutputMethod(); RawFile.CreateDirectory("Raw Outputs!"); resultsOutput.CreateDirectory("Overall Test - 2nd Nov"); resultsOutput.CreateFile("Map Size 120in120 k = 6"); resultsOutput.ContinueFile("Obs Chance,Total Success,Total Failed,OverAll Avg Ops,Success Ops,Ops Variance,Ops SD,Max Ops,Min Ops,Overall Time,Success Time,Number Of Nodes Expanded,Success Nodes Expanded"); for (int ObsChance = 0; ObsChance < 60; ObsChance += 5) { RawFile.CreateFile("RawFile - MapSize = 120IN120 k=6 Chance of " + ObsChance); List <ResultsClass> Results = new List <ResultsClass>(); List <AvgClass> AverageList = new List <AvgClass>(); List <AvgClass> AverageHeap = new List <AvgClass>(); List <AvgClass> AveragePartialMinHeap = new List <AvgClass>(); List <AvgClass> AverageCachedMinHeap = new List <AvgClass>(); grid.ObstacleChance = ObsChance; grid.regenrateGrid(); for (int i = 0; i < numberOfTests; i++) { RandomPosition(seeker); RandomPosition(target); Results.Add(FindPath(seeker.position, target.position)); Results.Add(FindPathHeap(seeker.position, target.position)); Results.Add(FindPathPartialHeap(seeker.position, target.position, 6)); Results.Add(FindPathCachedMinHeap(seeker.position, target.position, 10, 7)); //resultsOutput.ContinueFile(grid.NodeFromWorldPoint(seeker.position).gridX + "," + grid.NodeFromWorldPoint(seeker.position).gridY + " -- " + grid.NodeFromWorldPoint(target.position).gridX + "," + grid.NodeFromWorldPoint(target.position).gridY); RawFile.ContinueFile(Results[4 * i].Success + " - " + Results[4 * i].HeapType + " - " + Results[4 * i].Ops + " - " + Results[4 * i].Time + " - " + Results[4 * i].PathLength + " - " + Results[4 * i].PathCost + grid.NodeFromWorldPoint(seeker.position).gridX + "," + grid.NodeFromWorldPoint(seeker.position).gridY + " -- " + grid.NodeFromWorldPoint(target.position).gridX + "," + grid.NodeFromWorldPoint(target.position).gridY); RawFile.ContinueFile(Results[4 * i + 1].Success + " - " + Results[4 * i + 1].HeapType + " - " + Results[4 * i + 1].Ops + " - " + Results[4 * i + 1].Time + " - " + Results[4 * i + 1].PathLength + " - " + Results[4 * i + 1].PathCost); RawFile.ContinueFile(Results[4 * i + 2].Success + " - " + Results[4 * i + 2].HeapType + " - " + Results[4 * i + 2].Ops + " - " + Results[4 * i + 2].Time + " - " + Results[4 * i + 2].PathLength + " - " + Results[4 * i + 2].PathCost); RawFile.ContinueFile(Results[4 * i + 3].Success + " - " + Results[4 * i + 3].HeapType + " - " + Results[4 * i + 3].Ops + " - " + Results[4 * i + 3].Time + " - " + Results[4 * i + 3].PathLength + " - " + Results[4 * i + 3].PathCost); AverageList.Add(new AvgClass { HeapType = "List", TimeTaken = Results[4 * i].Time, Success = Results[4 * i].Success == true ? 1 : 0, Failed = Results[4 * i].Success == false ? 1 : 0, ops = Results[4 * i].Ops, PathCost = Results[4 * i].PathCost, ObstacleChance = ObsChance, NumberOfNodesExpanded = Results[4 * i].NodesExpanded }); AverageHeap.Add(new AvgClass { HeapType = "Heap", TimeTaken = Results[4 * i + 1].Time, Success = Results[4 * i + 1].Success == true ? 1 : 0, Failed = Results[4 * i + 1].Success == false ? 1 : 0, ops = Results[4 * i + 1].Ops, PathCost = Results[4 * i + 1].PathCost, ObstacleChance = ObsChance, NumberOfNodesExpanded = Results[4 * i + 1].NodesExpanded }); AveragePartialMinHeap.Add(new AvgClass { HeapType = "Partial Min Heap", TimeTaken = Results[4 * i + 2].Time, Success = Results[4 * i + 2].Success == true ? 1 : 0, Failed = Results[4 * i + 2].Success == false ? 1 : 0, ops = Results[4 * i + 2].Ops, PathCost = Results[4 * i + 2].PathCost, ObstacleChance = ObsChance, NumberOfNodesExpanded = Results[4 * i + 2].NodesExpanded }); AverageCachedMinHeap.Add(new AvgClass { HeapType = "Cached Min Heap", TimeTaken = Results[4 * i + 3].Time, Success = Results[4 * i + 3].Success == true ? 1 : 0, Failed = Results[4 * i + 3].Success == false ? 1 : 0, ops = Results[4 * i + 3].Ops, PathCost = Results[4 * i + 3].PathCost, ObstacleChance = ObsChance, NumberOfNodesExpanded = Results[4 * i + 3].NodesExpanded }); //print(Results[4 * i].Success + " - " + Results[4 * i].HeapType + " - " + Results[4 * i].Ops + " - " + Results[4 * i].Time + " - " + Results[4 * i].PathLength + " - " + Results[4 * i].PathCost); //print(Results[4 * i + 1].Success + " - " + Results[4 * i + 1].HeapType + " - " + Results[4 * i + 1].Ops + " - " + Results[4 * i + 1].Time + " - " + Results[4 * i + 1].PathLength + " - " + Results[4 * i + 1].PathCost); //print(Results[4 * i + 2].Success + " - " + Results[4 * i + 2].HeapType + " - " + Results[4 * i + 2].Ops + " - " + Results[4 * i + 2].Time + " - " + Results[4 * i + 2].PathLength + " - " + Results[4 * i + 2].PathCost); //print(Results[4 * i + 3].Success + " - " + Results[4 * i + 3].HeapType + " - " + Results[4 * i + 3].Ops + " - " + Results[4 * i + 3].Time + " - " + Results[4 * i + 3].PathLength + " - " + Results[4 * i + 3].PathCost); } AvgClass AvgList = CalculateAverage(AverageList); AvgClass AvgHeap = CalculateAverage(AverageHeap); AvgClass AvgPartialMinHeap = CalculateAverage(AveragePartialMinHeap); AvgClass AvgCachedMinHeap = CalculateAverage(AverageCachedMinHeap); //"Obs Chance,Total Success,Total Failed,OverAll Ops,Success Ops,Ops Variance,Ops SD,Max Ops,Min Ops,Overall Time,Success Time,Number Of Nodes Expanded,Success Nodes Expanded" resultsOutput.ContinueFile(ObsChance + "," + AvgList.Success + "," + AvgList.Failed + "," + AvgList.ops + "," + AvgList.PosOps + "," + AvgList.Variance + "," + AvgList.StandardDeviation + "," + AvgList.Max + "," + AvgList.Min + "," + AvgList.PosTime + "," + AvgList.NumberOfNodesExpanded + "," + AvgList.PathCost + "," + AvgList.HeapType); resultsOutput.ContinueFile(ObsChance + "," + AvgHeap.Success + "," + AvgHeap.Failed + "," + AvgHeap.ops + "," + AvgHeap.PosOps + "," + AvgHeap.Variance + "," + AvgHeap.StandardDeviation + "," + AvgHeap.Max + "," + AvgHeap.Min + "," + AvgHeap.PosTime + "," + AvgHeap.NumberOfNodesExpanded + "," + AvgHeap.PathCost + "," + AvgHeap.HeapType); resultsOutput.ContinueFile(ObsChance + "," + AvgPartialMinHeap.Success + "," + AvgPartialMinHeap.Failed + "," + AvgPartialMinHeap.ops + "," + AvgPartialMinHeap.PosOps + "," + AvgPartialMinHeap.Variance + "," + AvgPartialMinHeap.StandardDeviation + "," + AvgPartialMinHeap.Max + "," + AvgPartialMinHeap.Min + "," + +AvgPartialMinHeap.PosTime + "," + AvgPartialMinHeap.NumberOfNodesExpanded + "," + AvgPartialMinHeap.PathCost + "," + AvgPartialMinHeap.HeapType); resultsOutput.ContinueFile(ObsChance + "," + AvgCachedMinHeap.Success + "," + AvgCachedMinHeap.Failed + "," + AvgCachedMinHeap.ops + "," + AvgCachedMinHeap.PosOps + "," + AvgCachedMinHeap.Variance + "," + AvgPartialMinHeap.StandardDeviation + "," + AvgCachedMinHeap.Max + "," + AvgCachedMinHeap.Min + "," + AvgCachedMinHeap.PosTime + "," + AvgCachedMinHeap.NumberOfNodesExpanded + "," + AvgCachedMinHeap.PathCost + "," + AvgCachedMinHeap.HeapType); //Wait(); } print("Done!"); }
private static string GetFrom(IViewBaseInternal view, OutputMethod output) { string actual; using (StringWriter writer = new StringWriter()) using (view.SetDisposeableOutputWriter(writer)) { output.Invoke(); actual = writer.GetStringBuilder().ToString(); } return actual; }
/// <summary> /// Set output callback method. /// </summary> /// <param name="outputMethod"></param> public void SetOutPutDelegate(OutputMethod outputMethod) { dllInterface.SetOutputDelegate(outputMethod); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Method)) { if (compiler.Stylesheetid <= this.methodSId) { this.method = ParseOutputMethod(value, compiler); this.methodSId = compiler.Stylesheetid; if (this.indentSId == int.MaxValue) { this.indent = (this.method == OutputMethod.Html); } } } else if (Ref.Equal(name, compiler.Atoms.Version)) { if (compiler.Stylesheetid <= this.versionSId) { this.version = value; this.versionSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.Encoding)) { if (compiler.Stylesheetid <= this.encodingSId) { try { this.encoding = System.Text.Encoding.GetEncoding(value); this.encodingSId = compiler.Stylesheetid; } catch (System.NotSupportedException) {} catch (System.ArgumentException) {} Debug.Assert(this.encoding != null); } } else if (Ref.Equal(name, compiler.Atoms.OmitXmlDeclaration)) { if (compiler.Stylesheetid <= this.omitXmlDeclSId) { this.omitXmlDecl = compiler.GetYesNo(value); this.omitXmlDeclSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.Standalone)) { if (compiler.Stylesheetid <= this.standaloneSId) { this.standalone = compiler.GetYesNo(value); this.standaloneSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.DocTypePublic)) { if (compiler.Stylesheetid <= this.doctypePublicSId) { this.doctypePublic = value; this.doctypePublicSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.DocTypeSystem)) { if (compiler.Stylesheetid <= this.doctypeSystemSId) { this.doctypeSystem = value; this.doctypeSystemSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.Indent)) { if (compiler.Stylesheetid <= this.indentSId) { this.indent = compiler.GetYesNo(value); this.indentSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.MediaType)) { if (compiler.Stylesheetid <= this.mediaTypeSId) { this.mediaType = value; this.mediaTypeSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.CDataSectionElements)) { string[] qnames = XmlConvert.SplitString(value); if (this.cdataElements == null) { this.cdataElements = new Hashtable(qnames.Length); } for (int i = 0; i < qnames.Length; i++) { XmlQualifiedName qname = compiler.CreateXmlQName(qnames[i]); this.cdataElements[qname] = qname; } } else { return false; } return true; }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Method)) { if (compiler.Stylesheetid <= this.methodSId) { this.method = ParseOutputMethod(value, compiler); this.methodSId = compiler.Stylesheetid; if (this.indentSId == int.MaxValue) { this.indent = (this.method == OutputMethod.Html); } } } else if (Ref.Equal(name, compiler.Atoms.Version)) { if (compiler.Stylesheetid <= this.versionSId) { this.version = value; this.versionSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.Encoding)) { if (compiler.Stylesheetid <= this.encodingSId) { try { this.encoding = System.Text.Encoding.GetEncoding(value); this.encodingSId = compiler.Stylesheetid; } catch (System.NotSupportedException) {} catch (System.ArgumentException) {} Debug.Assert(this.encoding != null); } } else if (Ref.Equal(name, compiler.Atoms.OmitXmlDeclaration)) { if (compiler.Stylesheetid <= this.omitXmlDeclSId) { this.omitXmlDecl = compiler.GetYesNo(value); this.omitXmlDeclSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.Standalone)) { if (compiler.Stylesheetid <= this.standaloneSId) { this.standalone = compiler.GetYesNo(value); this.standaloneSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.DocTypePublic)) { if (compiler.Stylesheetid <= this.doctypePublicSId) { this.doctypePublic = value; this.doctypePublicSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.DocTypeSystem)) { if (compiler.Stylesheetid <= this.doctypeSystemSId) { this.doctypeSystem = value; this.doctypeSystemSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.Indent)) { if (compiler.Stylesheetid <= this.indentSId) { this.indent = compiler.GetYesNo(value); this.indentSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.MediaType)) { if (compiler.Stylesheetid <= this.mediaTypeSId) { this.mediaType = value; this.mediaTypeSId = compiler.Stylesheetid; } } else if (Ref.Equal(name, compiler.Atoms.CDataSectionElements)) { string[] qnames = XmlConvert.SplitString(value); if (this.cdataElements == null) { this.cdataElements = new Hashtable(qnames.Length); } for (int i = 0; i < qnames.Length; i++) { XmlQualifiedName qname = compiler.CreateXmlQName(qnames[i]); this.cdataElements[qname] = qname; } } else { return(false); } return(true); }
private void ProcessAttribute(XPathNavigator nav) { // skip attributes from non-default namespace if (nav.NamespaceURI != string.Empty) { return; } string value = nav.Value; switch (nav.LocalName) { case "cdata-section-elements": if (value.Length > 0) { cdSectsList.AddRange(XslNameUtil.FromListString(value, nav)); } break; case "method": if (value.Length == 0) { break; } switch (value) { case "xml": method = OutputMethod.XML; break; case "html": omitXmlDeclaration = true; method = OutputMethod.HTML; break; case "text": omitXmlDeclaration = true; method = OutputMethod.Text; break; default: method = OutputMethod.Custom; customMethod = XslNameUtil.FromString(value, nav); if (customMethod.Namespace == String.Empty) { IXmlLineInfo li = nav as IXmlLineInfo; throw new XsltCompileException(new ArgumentException( "Invalid output method value: '" + value + "'. It" + " must be either 'xml' or 'html' or 'text' or QName."), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); } break; } break; case "version": if (value.Length > 0) { this.version = value; } break; case "encoding": if (value.Length > 0) { try { this.encoding = System.Text.Encoding.GetEncoding(value); } catch (ArgumentException) { // MS.NET just leaves the default encoding when encoding is unknown } catch (NotSupportedException) { // Workaround for a bug in System.Text, it throws invalid exception } } break; case "standalone": switch (value) { case "yes": this.standalone = StandaloneType.YES; break; case "no": this.standalone = StandaloneType.NO; break; default: if (stylesheetVersion != "1.0") { break; } IXmlLineInfo li = nav as IXmlLineInfo; throw new XsltCompileException(new XsltException( "'" + value + "' is an invalid value for 'standalone'" + " attribute.", (Exception)null), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); } break; case "doctype-public": this.doctypePublic = value; break; case "doctype-system": this.doctypeSystem = value; break; case "media-type": if (value.Length > 0) { this.mediaType = value; } break; case "omit-xml-declaration": switch (value) { case "yes": this.omitXmlDeclaration = true; break; case "no": this.omitXmlDeclaration = false; break; default: if (stylesheetVersion != "1.0") { break; } IXmlLineInfo li = nav as IXmlLineInfo; throw new XsltCompileException(new XsltException( "'" + value + "' is an invalid value for 'omit-xml-declaration'" + " attribute.", (Exception)null), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); } break; case "indent": indent = value; if (stylesheetVersion != "1.0") { break; } switch (value) { case "yes": case "no": break; default: switch (method) { case OutputMethod.Custom: break; default: throw new XsltCompileException(String.Format("Unexpected 'indent' attribute value in 'output' element: '{0}'", value), null, nav); } break; } break; default: if (stylesheetVersion != "1.0") { break; } IXmlLineInfo xli = nav as IXmlLineInfo; throw new XsltCompileException(new XsltException( "'" + nav.LocalName + "' is an invalid attribute for 'output'" + " element.", (Exception)null), nav.BaseURI, xli != null ? xli.LineNumber : 0, xli != null ? xli.LinePosition : 0); } }
public OutputMethod OutputFunc = null; //在主程序设置这个, 就有输出,不设置就没输出 public Server(int port = 8080, OutputMethod output = null) { this.Port = port; this.OutputFunc = output; }
public string GetOutputData(OutputMethod method) { var data = GetData(); if (data == null) return null; switch (method) { case OutputMethod.Raw: return data.ToString(); case OutputMethod.Text: return HttpUtility.HtmlEncode(data); case OutputMethod.Html: return SenseNet.Portal.Security.Sanitize(data.ToString()); case OutputMethod.Default: return GetOutputData(this.OutputMethod); default: throw new NotImplementedException("Unknown OutputMethod: " + this.Field.FieldSetting.OutputMethod); } }
public void PrintWarnings(OutputMethod output) { foreach (string warning in _warnings) output(warning); }
public uint Open(OutputMethod OutMethd) { var newlog = new LogOut_Method(OutMethd); return(this.add(newlog)); }
internal XsltOutput CreateDerivedOutput(OutputMethod method) { XsltOutput output = (XsltOutput) MemberwiseClone(); output.method = method; if (method == OutputMethod.Html && this.indentSId == int.MaxValue) { // HTML output and Ident wasn't specified output.indent = true; } return output; }
public static OutputMethod GetOutputMethod() { OutputMethod format = (OutputMethod)Enum.Parse <OutputMethod>(ConfigurationManager.AppSettings["EXPORT_FORMAT"]); return(format); }
private void ProcessAttribute(XPathNavigator nav) { if (nav.NamespaceURI != string.Empty) { return; } string value = nav.Value; string localName = nav.LocalName; switch (localName) { case "cdata-section-elements": if (value.Length > 0) { this.cdSectsList.AddRange(XslNameUtil.FromListString(value, nav)); } return; case "method": { if (value.Length == 0) { return; } string text = value; switch (text) { case "xml": this.method = OutputMethod.XML; goto IL_269; case "html": this.omitXmlDeclaration = true; this.method = OutputMethod.HTML; goto IL_269; case "text": this.omitXmlDeclaration = true; this.method = OutputMethod.Text; goto IL_269; } this.method = OutputMethod.Custom; this.customMethod = XslNameUtil.FromString(value, nav); if (this.customMethod.Namespace == string.Empty) { IXmlLineInfo xmlLineInfo = nav as IXmlLineInfo; throw new XsltCompileException(new ArgumentException("Invalid output method value: '" + value + "'. It must be either 'xml' or 'html' or 'text' or QName."), nav.BaseURI, (xmlLineInfo == null) ? 0 : xmlLineInfo.LineNumber, (xmlLineInfo == null) ? 0 : xmlLineInfo.LinePosition); } IL_269: return; } case "version": if (value.Length > 0) { this.version = value; } return; case "encoding": if (value.Length > 0) { try { this.encoding = Encoding.GetEncoding(value); } catch (ArgumentException) { } catch (NotSupportedException) { } } return; case "standalone": { string text = value; if (text != null) { if (XslOutput.< > f__switch$map20 == null) { XslOutput.< > f__switch$map20 = new Dictionary <string, int>(2) { { "yes", 0 }, { "no", 1 } }; } int num2; if (XslOutput.< > f__switch$map20.TryGetValue(text, out num2)) { if (num2 == 0) { this.standalone = StandaloneType.YES; goto IL_397; } if (num2 == 1) { this.standalone = StandaloneType.NO; goto IL_397; } } } if (!(this.stylesheetVersion != "1.0")) { IXmlLineInfo xmlLineInfo2 = nav as IXmlLineInfo; throw new XsltCompileException(new XsltException("'" + value + "' is an invalid value for 'standalone' attribute.", null), nav.BaseURI, (xmlLineInfo2 == null) ? 0 : xmlLineInfo2.LineNumber, (xmlLineInfo2 == null) ? 0 : xmlLineInfo2.LinePosition); } IL_397: return; } case "doctype-public": this.doctypePublic = value; return; case "doctype-system": this.doctypeSystem = value; return; case "media-type": if (value.Length > 0) { this.mediaType = value; } return; case "omit-xml-declaration": { string text = value; if (text != null) { if (XslOutput.< > f__switch$map21 == null) { XslOutput.< > f__switch$map21 = new Dictionary <string, int>(2) { { "yes", 0 }, { "no", 1 } }; } int num2; if (XslOutput.< > f__switch$map21.TryGetValue(text, out num2)) { if (num2 == 0) { this.omitXmlDeclaration = true; goto IL_4AF; } if (num2 == 1) { this.omitXmlDeclaration = false; goto IL_4AF; } } } if (!(this.stylesheetVersion != "1.0")) { IXmlLineInfo xmlLineInfo3 = nav as IXmlLineInfo; throw new XsltCompileException(new XsltException("'" + value + "' is an invalid value for 'omit-xml-declaration' attribute.", null), nav.BaseURI, (xmlLineInfo3 == null) ? 0 : xmlLineInfo3.LineNumber, (xmlLineInfo3 == null) ? 0 : xmlLineInfo3.LinePosition); } IL_4AF: return; } case "indent": { this.indent = value; if (this.stylesheetVersion != "1.0") { return; } string text = value; if (text != null) { if (XslOutput.< > f__switch$map22 == null) { XslOutput.< > f__switch$map22 = new Dictionary <string, int>(2) { { "yes", 0 }, { "no", 0 } }; } int num2; if (XslOutput.< > f__switch$map22.TryGetValue(text, out num2)) { if (num2 == 0) { goto IL_568; } } } OutputMethod outputMethod = this.method; if (outputMethod != OutputMethod.Custom) { throw new XsltCompileException(string.Format("Unexpected 'indent' attribute value in 'output' element: '{0}'", value), null, nav); } IL_568: return; } } if (!(this.stylesheetVersion != "1.0")) { IXmlLineInfo xmlLineInfo4 = nav as IXmlLineInfo; throw new XsltCompileException(new XsltException("'" + nav.LocalName + "' is an invalid attribute for 'output' element.", null), nav.BaseURI, (xmlLineInfo4 == null) ? 0 : xmlLineInfo4.LineNumber, (xmlLineInfo4 == null) ? 0 : xmlLineInfo4.LinePosition); } }
private void ProcessAttribute (XPathNavigator nav) { // skip attributes from non-default namespace if (nav.NamespaceURI != string.Empty) { return; } string value = nav.Value; switch (nav.LocalName) { case "cdata-section-elements": if (value.Length > 0) { cdSectsList.AddRange (XslNameUtil.FromListString (value, nav)); } break; case "method": if (value.Length == 0) { break; } switch (value) { case "xml": method = OutputMethod.XML; break; case "html": omitXmlDeclaration = true; method = OutputMethod.HTML; break; case "text": omitXmlDeclaration = true; method = OutputMethod.Text; break; default: method = OutputMethod.Custom; customMethod = XslNameUtil.FromString (value, nav); if (customMethod.Namespace == String.Empty) { IXmlLineInfo li = nav as IXmlLineInfo; throw new XsltCompileException (new ArgumentException ( "Invalid output method value: '" + value + "'. It" + " must be either 'xml' or 'html' or 'text' or QName."), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); } break; } break; case "version": if (value.Length > 0) { this.version = value; } break; case "encoding": if (value.Length > 0) { try { this.encoding = System.Text.Encoding.GetEncoding (value); } catch (ArgumentException) { // MS.NET just leaves the default encoding when encoding is unknown } catch (NotSupportedException) { // Workaround for a bug in System.Text, it throws invalid exception } } break; case "standalone": switch (value) { case "yes": this.standalone = StandaloneType.YES; break; case "no": this.standalone = StandaloneType.NO; break; default: if (stylesheetVersion != "1.0") break; IXmlLineInfo li = nav as IXmlLineInfo; throw new XsltCompileException (new XsltException ( "'" + value + "' is an invalid value for 'standalone'" + " attribute.", (Exception) null), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); } break; case "doctype-public": this.doctypePublic = value; break; case "doctype-system": this.doctypeSystem = value; break; case "media-type": if (value.Length > 0) { this.mediaType = value; } break; case "omit-xml-declaration": switch (value) { case "yes": this.omitXmlDeclaration = true; break; case "no": this.omitXmlDeclaration = false; break; default: if (stylesheetVersion != "1.0") break; IXmlLineInfo li = nav as IXmlLineInfo; throw new XsltCompileException (new XsltException ( "'" + value + "' is an invalid value for 'omit-xml-declaration'" + " attribute.", (Exception) null), nav.BaseURI, li != null ? li.LineNumber : 0, li != null ? li.LinePosition : 0); } break; case "indent": indent = value; if (stylesheetVersion != "1.0") break; switch (value) { case "yes": case "no": break; default: switch (method) { case OutputMethod.Custom: break; default: throw new XsltCompileException (String.Format ("Unexpected 'indent' attribute value in 'output' element: '{0}'", value), null, nav); } break; } break; default: if (stylesheetVersion != "1.0") break; IXmlLineInfo xli = nav as IXmlLineInfo; throw new XsltCompileException (new XsltException ( "'" + nav.LocalName + "' is an invalid attribute for 'output'" + " element.", (Exception) null), nav.BaseURI, xli != null ? xli.LineNumber : 0, xli != null ? xli.LinePosition : 0); } }
/// <summary> /// Gets a the specified property belonging to the Content of the View in a safe way. /// </summary> /// <param name="name">The property name. Can be hierarchical.</param> /// <returns>String value of the property specified</returns> internal static string GetValue(string name, SNC.Content parentContent, OutputMethod outputMethod) { switch (outputMethod) { case OutputMethod.Default: throw new NotSupportedException("OutputMethod cannot be Default"); case OutputMethod.Raw: return GetValue(name, parentContent); case OutputMethod.Text: return System.Web.HttpUtility.HtmlEncode(GetValue(name, parentContent)); case OutputMethod.Html: return SenseNet.Portal.Security.Sanitize(GetValue(name, parentContent)); default: throw new NotImplementedException("Unknown OutputMethod: " + outputMethod); } }