public PrimeNumbers(OutputSettings desiredSettings) { primes = new List<int>(); classLogger = null; errors = null; if ((desiredSettings & OutputSettings.ErrorLogOn) == 0) { errors = new List<ErrorBase>(); } if (((desiredSettings & OutputSettings.ConsoleOutputOn) == 0) || ((desiredSettings & OutputSettings.LogFileOn)==0)) { classLogger = new DataReporter(); if ((desiredSettings & OutputSettings.LogFileOn) == 0) { classLogger.LogOn = true; } if ((desiredSettings & OutputSettings.ConsoleOutputOn) == 0) { classLogger.ConsoleOn = true; } } }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); CoreConfiguration config = IniConfig.GetIniSection<CoreConfiguration>(); OutputSettings outputSettings = new OutputSettings(); string file = FilenameHelper.GetFilename(OutputFormat.png, null); string filePath = Path.Combine(config.OutputFilePath, file); using (FileStream stream = new FileStream(filePath, FileMode.Create)) { using (Image image = surface.GetImageForExport()) { ImageOutput.SaveToStream(image, stream, outputSettings); } } exportInformation.Filepath = filePath; exportInformation.ExportMade = true; ProcessExport(exportInformation, surface); return exportInformation; }
string InternalGetMethodString(IMethod method, OutputSettings settings, string methodName, bool getReturnType) { if (method == null) { return(""); } var result = new StringBuilder(); AppendModifiers(result, settings, method); if (!settings.CompletionListFomat && settings.IncludeReturnType && getReturnType) { result.Append(GetTypeReferenceString(method.ReturnType, settings)); result.Append(settings.Markup(" ")); } if (!settings.IncludeReturnType && settings.UseFullName) { result.Append(GetTypeReferenceString(method.DeclaringTypeDefinition, new OutputSettings(OutputFlags.UseFullName))); result.Append(settings.Markup(".")); } AppendExplicitInterfaces(result, method, settings); if (method.SymbolKind == SymbolKind.Operator) { result.Append("operator "); result.Append(settings.Markup(GetOperator(methodName))); } else { result.Append(methodName); } if (settings.IncludeGenerics) { if (method.TypeParameters.Count > 0) { result.Append(settings.Markup("<")); for (int i = 0; i < method.TypeParameters.Count; i++) { if (i > 0) { result.Append(settings.Markup(settings.HideGenericParameterNames ? "," : ", ")); } if (!settings.HideGenericParameterNames) { AppendVariance(result, method.TypeParameters [i].Variance); result.Append(NetToCSharpTypeName(method.TypeParameters [i].Name)); } } result.Append(settings.Markup(">")); } } if (settings.IncludeParameters) { // CSharpFormattingPolicy policy = GetPolicy (settings); // if (policy.BeforeMethodCallParentheses) // result.Append (settings.Markup (" ")); result.Append(settings.Markup("(")); AppendParameterList(result, settings, method.Parameters); result.Append(settings.Markup(")")); } if (settings.CompletionListFomat && settings.IncludeReturnType && getReturnType) { result.Append(settings.Markup(" : ")); result.Append(GetTypeReferenceString(method.ReturnType, settings)); } // OutputConstraints (result, settings, method.TypeParameters); return(result.ToString()); }
public static OutputSettings GetOrNewInstance() { return(_classInstance ?? (_classInstance = new OutputSettings())); }
public SiteLocationData() { MeanSeaLevel = true; OutputSettings = new OutputSettings(); }
public void AppendType(StringBuilder sb, IType type, OutputSettings settings) { if (type.Kind == TypeKind.Unknown) { sb.Append(settings.IncludeMarkup ? settings.Markup(type.Name) : type.Name); return; } if (type.Kind == TypeKind.TypeParameter) { sb.Append(settings.IncludeMarkup ? settings.Markup(type.Name) : type.Name); return; } if (type.DeclaringType != null) { AppendType(sb, type.DeclaringType, settings); sb.Append(settings.Markup(".")); } if (type.Namespace == "System" && type.TypeParameterCount == 0) { switch (type.Name) { case "Object": sb.Append("object"); return; case "Boolean": sb.Append("bool"); return; case "Char": sb.Append("char"); return; case "SByte": sb.Append("sbyte"); return; case "Byte": sb.Append("byte"); return; case "Int16": sb.Append("short"); return; case "UInt16": sb.Append("ushort"); return; case "Int32": sb.Append("int"); return; case "UInt32": sb.Append("uint"); return; case "Int64": sb.Append("long"); return; case "UInt64": sb.Append("ulong"); return; case "Single": sb.Append("float"); return; case "Double": sb.Append("double"); return; case "Decimal": sb.Append("decimal"); return; case "String": sb.Append("string"); return; case "Void": sb.Append("void"); return; } } var typeWithElementType = type as TypeWithElementType; if (typeWithElementType != null) { AppendType(sb, typeWithElementType.ElementType, settings); if (typeWithElementType is PointerType) { sb.Append(settings.Markup("*")); } if (typeWithElementType is ArrayType) { sb.Append(settings.Markup("[")); sb.Append(settings.Markup(new string (',', ((ArrayType)type).Dimensions - 1))); sb.Append(settings.Markup("]")); } return; } if (type.TypeArguments.Count > 0) { if (type.Name == "Nullable" && type.Namespace == "System" && type.TypeParameterCount == 1) { AppendType(sb, type.TypeArguments [0], settings); sb.Append(settings.Markup("?")); return; } sb.Append(type.Name); if (type.TypeParameterCount > 0) { sb.Append(settings.Markup("<")); for (int i = 0; i < type.TypeParameterCount; i++) { if (i > 0) { sb.Append(settings.Markup(", ")); } AppendType(sb, type.TypeArguments [i], settings); } sb.Append(settings.Markup(">")); } return; } var typeDef = type as ITypeDefinition ?? type.GetDefinition(); if (typeDef != null) { if (settings.UseFullName) { sb.Append(settings.IncludeMarkup ? settings.Markup(typeDef.FullName) : typeDef.FullName); } else { sb.Append(settings.IncludeMarkup ? settings.Markup(typeDef.Name) : typeDef.Name); } if (typeDef.TypeParameterCount > 0) { sb.Append(settings.Markup("<")); for (int i = 0; i < typeDef.TypeParameterCount; i++) { if (i > 0) { sb.Append(settings.Markup(", ")); } AppendVariance(sb, typeDef.TypeParameters [i].Variance); AppendType(sb, typeDef.TypeParameters [i], settings); } sb.Append(settings.Markup(">")); } } }
public override void SetupForDevice(OutputSettings settings) { }
public string CreateTooltip(MonoDevelop.Ide.Gui.Document doc, int offset, ResolveResult result, string errorInformations, Gdk.ModifierType modifierState) { try { OutputSettings settings = new OutputSettings(OutputFlags.ClassBrowserEntries | OutputFlags.IncludeParameterName | OutputFlags.IncludeKeywords | OutputFlags.IncludeMarkup | OutputFlags.UseFullName); // Approximate value for usual case StringBuilder s = new StringBuilder(150); string documentation = null; if (result != null) { if (result is UnknownIdentifierResolveResult) { s.Append(String.Format(GettextCatalog.GetString("Unresolved identifier '{0}'"), ((UnknownIdentifierResolveResult)result).Identifier)); } else if (result.IsError) { s.Append(GettextCatalog.GetString("Resolve error.")); } else if (result is LocalResolveResult) { var lr = (LocalResolveResult)result; s.Append("<small><i>"); s.Append(lr.IsParameter ? paramStr : localStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(lr.Variable.Type, settings)); s.Append(" "); s.Append(lr.Variable.Name); } else if (result is MethodGroupResolveResult) { var mrr = (MethodGroupResolveResult)result; s.Append("<small><i>"); s.Append(methodStr); s.Append("</i></small>\n"); var allMethods = new List <IMethod> (mrr.Methods); foreach (var l in mrr.GetExtensionMethods()) { allMethods.AddRange(l); } var method = allMethods.FirstOrDefault(); if (method != null) { s.Append(GLib.Markup.EscapeText(CreateAmbience(doc, offset, method.Compilation).ConvertEntity(method))); if (allMethods.Count > 1) { int overloadCount = allMethods.Count - 1; s.Append(string.Format(GettextCatalog.GetPluralString(" (+{0} overload)", " (+{0} overloads)", overloadCount), overloadCount)); } documentation = AmbienceService.GetSummaryMarkup(method); } } else if (result is MemberResolveResult) { var member = ((MemberResolveResult)result).Member; s.Append("<small><i>"); s.Append(GetString(member)); s.Append("</i></small>\n"); var field = member as IField; if (field != null && field.IsConst) { s.Append(GLib.Markup.EscapeText(CreateAmbience(doc, offset, field.Compilation).ConvertType(field.Type))); s.Append(" "); s.Append(field.Name); s.Append(" = "); s.Append(GetConst(field.ConstantValue)); s.Append(";"); } else { s.Append(GLib.Markup.EscapeText(CreateAmbience(doc, offset, member.Compilation).ConvertEntity(member))); } documentation = AmbienceService.GetSummaryMarkup(member); } else if (result is NamespaceResolveResult) { s.Append("<small><i>"); s.Append(namespaceStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(((NamespaceResolveResult)result).NamespaceName, settings)); } else { var tr = result; var typeString = GetString(tr.Type); if (!string.IsNullOrEmpty(typeString)) { s.Append("<small><i>"); s.Append(typeString); s.Append("</i></small>\n"); } settings.OutputFlags |= OutputFlags.UseFullName; s.Append(ambience.GetString(tr.Type, settings)); documentation = AmbienceService.GetSummaryMarkup(tr.Type.GetDefinition()); } if (!string.IsNullOrEmpty(documentation)) { s.Append("\n<small>"); s.Append(documentation); s.Append("</small>"); } } if (!string.IsNullOrEmpty(errorInformations)) { if (s.Length != 0) { s.Append("\n\n"); } s.Append("<small>"); s.Append(errorInformations); s.Append("</small>"); } return(s.ToString()); } catch (Exception e) { return(e.ToString()); } }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { MainSettings _mainSettings = null; List <Configuration> otherSettings_ = new List <Configuration> (); bool _runIt = false; DA.GetData(0, ref _mainSettings); DA.GetDataList(1, otherSettings_); DA.GetData(2, ref _runIt); SimpleForcingSettings simpleForcingSettings = null; TThread tThread = null; TimeSteps timeSteps = null; ModelTiming modelTiming = null; SoilConfig soilConfig = null; Sources sources = null; Turbulence turbulence = null; OutputSettings outputSettings = null; Cloud cloud = null; Background background = null; SolarAdjust solarAdjust = null; BuildingSettings buildingSettings = null; IVS ivs = null; ParallelCPU parallelCPU = null; SOR sor = null; InflowAvg inflowAvg = null; Facades facades = null; PlantSetting plantSetting = null; LBC lbc = null; FullForcing fullForcing = null; if (_runIt) { try { foreach (Configuration o in otherSettings_) { Type obj = o.GetType(); if (obj == typeof(SimpleForcingSettings)) { simpleForcingSettings = o as SimpleForcingSettings; } else if (obj == typeof(TThread)) { tThread = o as TThread; } else if (obj == typeof(TimeSteps)) { timeSteps = o as TimeSteps; } else if (obj == typeof(ModelTiming)) { modelTiming = o as ModelTiming; } else if (obj == typeof(SoilConfig)) { soilConfig = o as SoilConfig; } else if (obj == typeof(Sources)) { sources = o as Sources; } else if (obj == typeof(Turbulence)) { turbulence = o as Turbulence; } else if (obj == typeof(OutputSettings)) { outputSettings = o as OutputSettings; } else if (obj == typeof(Cloud)) { cloud = o as Cloud; } else if (obj == typeof(Background)) { background = o as Background; } else if (obj == typeof(SolarAdjust)) { solarAdjust = o as SolarAdjust; } else if (obj == typeof(BuildingSettings)) { buildingSettings = o as BuildingSettings; } else if (obj == typeof(IVS)) { ivs = o as IVS; } else if (obj == typeof(ParallelCPU)) { parallelCPU = o as ParallelCPU; } else if (obj == typeof(SOR)) { sor = o as SOR; } else if (obj == typeof(InflowAvg)) { inflowAvg = o as InflowAvg; } else if (obj == typeof(Facades)) { facades = o as Facades; } else if (obj == typeof(PlantSetting)) { plantSetting = o as PlantSetting; } else if (obj == typeof(LBC)) { lbc = o as LBC; } else if (obj == typeof(FullForcing)) { fullForcing = o as FullForcing; } } Simx simx = new Simx(_mainSettings) { SimpleForcing = simpleForcingSettings, TThread = tThread, TimeSteps = timeSteps, ModelTiming = modelTiming, SoilSettings = soilConfig, Sources = sources, Turbulence = turbulence, OutputSettings = outputSettings, Cloud = cloud, Background = background, SolarAdjust = solarAdjust, BuildingSettings = buildingSettings, IVS = ivs, ParallelCPU = parallelCPU, SOR = sor, InflowAvg = inflowAvg, Facades = facades, PlantSetting = plantSetting, LBC = lbc, FullForcing = fullForcing }; simx.WriteSimx(); DA.SetData(0, Path.Combine(Path.GetDirectoryName(_mainSettings.Inx), _mainSettings.Name + ".simx")); } catch { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Please provide a valid mainSettings."); } } }
public abstract void SetupForDevice(OutputSettings settings);
public override void SetupForDevice(OutputSettings settings) { renderShadow = effect.GetTechnique("ShadowMap"); renderScene = effect.GetTechnique("std_basicDirLightSpecNoTexture"); renderLines = effect.GetTechnique("std_basicDirLightSpecNoTextureLine"); }
public bool Upload(ICaptureDetails captureDetails, Image image) { using (MemoryStream stream = new MemoryStream()) { OutputSettings outputSettings = new OutputSettings(); outputSettings.Format=config.UploadFormat; outputSettings.JPGQuality=config.UploadJpegQuality; host.SaveToStream(image, stream, outputSettings); byte[] buffer = stream.GetBuffer(); try { string filename = Path.GetFileName(host.GetFilename(config.UploadFormat, captureDetails)); string contentType = "image/" + config.UploadFormat.ToString(); TFSInfo tfsInfo = TFSUtils.UploadToTFS(buffer, captureDetails.DateTime.ToString(), filename, contentType); if (tfsInfo == null) { return false; } else { if (config.TfsUploadHistory == null) { config.TfsUploadHistory = new Dictionary<string, string>(); } if (tfsInfo.ID != null) { LOG.InfoFormat("Storing TFS upload for id {0}", tfsInfo.ID); config.TfsUploadHistory.Add(tfsInfo.ID, tfsInfo.ID); config.runtimeTfsHistory.Add(tfsInfo.ID, tfsInfo); } // Make sure the configuration is save, so we don't lose the deleteHash IniConfig.Save(); // Make sure the history is loaded, will be done only once TFSUtils.LoadHistory(); // Show if (config.AfterUploadOpenHistory) { TFSHistory.ShowHistory(); } if (config.AfterUploadLinkToClipBoard && ! string.IsNullOrEmpty(tfsInfo.WebEditUrl)) { Clipboard.SetText(tfsInfo.WebEditUrl); } if (config.AfterUploadOpenWorkItem && !string.IsNullOrEmpty(tfsInfo.WebEditUrl)) { System.Diagnostics.Process.Start(tfsInfo.WebEditUrl); } return true; } } catch (Exception e) { MessageBox.Show(Language.GetString("tfs", LangKey.upload_failure) + " " + e.ToString()); } finally { //backgroundForm.CloseDialog(); } } return false; }
/// <summary> /// Sets the defaults for a Site. /// </summary> public SiteData() { Location = new ServiceCartographic(); MeanSeaLevel = false; OutputSettings = new OutputSettings(); }
public string CreateTooltip(IParsedFile unit, ResolveResult result, string errorInformations, Ambience ambience, Gdk.ModifierType modifierState) { OutputSettings settings = new OutputSettings(OutputFlags.ClassBrowserEntries | OutputFlags.IncludeParameterName | OutputFlags.IncludeKeywords | OutputFlags.IncludeMarkup | OutputFlags.UseFullName); // if ((Gdk.ModifierType.ShiftMask & modifierState) == Gdk.ModifierType.ShiftMask) { // settings.EmitNameCallback = delegate(object domVisitable, ref string outString) { // // crop used namespaces. // if (unit != null) { // int len = 0; // foreach (var u in unit.Usings) { // foreach (string ns in u.Namespaces) { // if (outString.StartsWith (ns + ".")) { // len = Math.Max (len, ns.Length + 1); // } // } // } // string newName = outString.Substring (len); // int count = 0; // // check if there is a name clash. // if (dom.GetType (newName) != null) // count++; // foreach (IUsing u in unit.Usings) { // foreach (string ns in u.Namespaces) { // if (dom.GetType (ns + "." + newName) != null) // count++; // } // } // if (len > 0 && count == 1) // outString = newName; // } // }; // } // Approximate value for usual case StringBuilder s = new StringBuilder(150); string doc = null; if (result != null) { if (result is UnknownIdentifierResolveResult) { s.Append(String.Format(GettextCatalog.GetString("Unresolved identifier '{0}'"), ((UnknownIdentifierResolveResult)result).Identifier)); } else if (result.IsError) { s.Append(GettextCatalog.GetString("Resolve error.")); } else if (result is LocalResolveResult) { var lr = (LocalResolveResult)result; s.Append("<small><i>"); s.Append(lr.IsParameter ? paramStr : localStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(lr.Variable.Type, settings)); s.Append(" "); s.Append(lr.Variable.Name); } else if (result is MethodGroupResolveResult) { var mrr = (MethodGroupResolveResult)result; s.Append("<small><i>"); s.Append(methodStr); s.Append("</i></small>\n"); var allMethods = new List <IMethod> (mrr.Methods); foreach (var l in mrr.GetExtensionMethods()) { allMethods.AddRange(l); } var method = allMethods.FirstOrDefault(); if (method != null) { s.Append(ambience.GetString(method, settings)); if (allMethods.Count > 1) { int overloadCount = allMethods.Count - 1; s.Append(string.Format(GettextCatalog.GetPluralString(" (+{0} overload)", " (+{0} overloads)", overloadCount), overloadCount)); } doc = AmbienceService.GetDocumentationSummary(method); } } else if (result is MemberResolveResult) { var member = ((MemberResolveResult)result).Member; s.Append("<small><i>"); s.Append(GetString(member)); s.Append("</i></small>\n"); var field = member as IField; if (field != null && field.IsConst) { s.Append(ambience.GetString(field.Type, settings)); s.Append(" "); s.Append(field.Name); s.Append(" = "); s.Append(GetConst(field.ConstantValue)); s.Append(";"); } else { s.Append(ambience.GetString(member, settings)); } doc = AmbienceService.GetDocumentationSummary(member); } else if (result is NamespaceResolveResult) { s.Append("<small><i>"); s.Append(namespaceStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(((NamespaceResolveResult)result).NamespaceName, settings)); } else { var tr = result; var typeString = GetString(tr.Type); if (!string.IsNullOrEmpty(typeString)) { s.Append("<small><i>"); s.Append(typeString); s.Append("</i></small>\n"); } settings.OutputFlags |= OutputFlags.UseFullName; s.Append(ambience.GetString(tr.Type, settings)); doc = AmbienceService.GetDocumentationSummary(tr.Type.GetDefinition()); } if (!string.IsNullOrEmpty(doc)) { s.Append("\n<small>"); s.Append(AmbienceService.GetDocumentationMarkup("<summary>" + doc + "</summary>")); s.Append("</small>"); } } if (!string.IsNullOrEmpty(errorInformations)) { if (s.Length != 0) { s.Append("\n\n"); } s.Append("<small>"); s.Append(errorInformations); s.Append("</small>"); } return(s.ToString()); }
public string CreateTooltip(ResolveResult result, Ambience ambience) { OutputSettings settings = new OutputSettings(OutputFlags.ClassBrowserEntries | OutputFlags.IncludeParameterName | OutputFlags.IncludeKeywords | OutputFlags.IncludeMarkup | OutputFlags.UseFullName); // Approximate value for usual case StringBuilder s = new StringBuilder(150); string doc = null; if (result is UnknownIdentifierResolveResult) { s.Append(String.Format(GettextCatalog.GetString("Unresolved identifier '{0}'"), ((UnknownIdentifierResolveResult)result).Identifier)); } else if (result.IsError) { s.Append(GettextCatalog.GetString("Resolve error.")); } else if (result is LocalResolveResult) { var lr = (LocalResolveResult)result; s.Append("<small><i>"); s.Append(lr.IsParameter ? paramStr : localStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(lr.Variable.Type, settings)); s.Append(" "); s.Append(lr.Variable.Name); } else if (result is MethodGroupResolveResult) { var mrr = (MethodGroupResolveResult)result; s.Append("<small><i>"); s.Append(methodStr); s.Append("</i></small>\n"); var allMethods = new List <IMethod> (mrr.Methods); foreach (var l in mrr.GetExtensionMethods()) { allMethods.AddRange(l); } var method = allMethods.FirstOrDefault(); if (method != null) { s.Append(ambience.GetString(method, settings)); if (allMethods.Count > 1) { int overloadCount = allMethods.Count - 1; s.Append(string.Format(GettextCatalog.GetPluralString(" (+{0} overload)", " (+{0} overloads)", overloadCount), overloadCount)); } doc = AmbienceService.GetDocumentationSummary(method); } } else if (result is MemberResolveResult) { var member = ((MemberResolveResult)result).Member; s.Append("<small><i>"); s.Append(GetString(member)); s.Append("</i></small>\n"); var field = member as IField; if (field != null && field.IsConst) { s.Append(ambience.GetString(field.Type, settings)); s.Append(" "); s.Append(field.Name); s.Append(" = "); s.Append(GetConst(field.ConstantValue)); s.Append(";"); } else { s.Append(ambience.GetString(member, settings)); } doc = AmbienceService.GetDocumentationSummary(member); } else if (result is NamespaceResolveResult) { s.Append("<small><i>"); s.Append(namespaceStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(((NamespaceResolveResult)result).NamespaceName, settings)); } else { var tr = result; var typeString = GetString(tr.Type); if (!string.IsNullOrEmpty(typeString)) { s.Append("<small><i>"); s.Append(typeString); s.Append("</i></small>\n"); } settings.OutputFlags |= OutputFlags.UseFullName | OutputFlags.UseFullInnerTypeName; s.Append(ambience.GetString(tr.Type, settings)); doc = AmbienceService.GetDocumentationSummary(tr.Type.GetDefinition()); } if (!string.IsNullOrEmpty(doc)) { s.Append("\n<small>"); s.Append(AmbienceService.GetDocumentationMarkup("<summary>" + doc + "</summary>")); s.Append("</small>"); } return(s.ToString()); }
public string CreateTooltip(ProjectDom dom, ICompilationUnit unit, MonoDevelop.Projects.Dom.ResolveResult result, string errorInformations, Ambience ambience, Gdk.ModifierType modifierState) { OutputSettings settings = new OutputSettings(OutputFlags.ClassBrowserEntries | OutputFlags.IncludeParameterName | OutputFlags.IncludeKeywords | OutputFlags.IncludeMarkup | OutputFlags.UseFullName); if ((Gdk.ModifierType.ShiftMask & modifierState) == Gdk.ModifierType.ShiftMask) { settings.EmitNameCallback = delegate(INode domVisitable, ref string outString) { // crop used namespaces. if (unit != null) { int len = 0; foreach (IUsing u in unit.Usings) { foreach (string ns in u.Namespaces) { if (outString.StartsWith(ns + ".")) { len = Math.Max(len, ns.Length + 1); } } } string newName = outString.Substring(len); int count = 0; // check if there is a name clash. if (dom.GetType(newName) != null) { count++; } foreach (IUsing u in unit.Usings) { foreach (string ns in u.Namespaces) { if (dom.GetType(ns + "." + newName) != null) { count++; } } } if (len > 0 && count == 1) { outString = newName; } } }; } // Approximate value for usual case StringBuilder s = new StringBuilder(150); string doc = null; if (result != null) { if (result is AggregatedResolveResult) { result = ((AggregatedResolveResult)result).PrimaryResult; } if (result is ParameterResolveResult) { s.Append("<small><i>"); s.Append(paramStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(((ParameterResolveResult)result).Parameter, settings)); } else if (result is LocalVariableResolveResult) { s.Append("<small><i>"); s.Append(localStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(((LocalVariableResolveResult)result).ResolvedType, settings)); s.Append(" "); s.Append(((LocalVariableResolveResult)result).LocalVariable.Name); } else if (result is UnresolvedMemberResolveResult) { s.Append(String.Format(GettextCatalog.GetString("Unresolved member '{0}'"), ((UnresolvedMemberResolveResult)result).MemberName)); } else if (result is MethodResolveResult) { MethodResolveResult mrr = (MethodResolveResult)result; s.Append("<small><i>"); s.Append(methodStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(mrr.MostLikelyMethod, settings)); if (mrr.Methods.Count > 1) { int overloadCount = mrr.Methods.Count - 1; s.Append(string.Format(GettextCatalog.GetPluralString(" (+{0} overload)", " (+{0} overloads)", overloadCount), overloadCount)); } doc = AmbienceService.GetDocumentationSummary(((MethodResolveResult)result).MostLikelyMethod); } else if (result is MemberResolveResult) { IMember member = ((MemberResolveResult)result).ResolvedMember; if (member == null) { IReturnType returnType = ((MemberResolveResult)result).ResolvedType; if (returnType != null) { IType type = dom.GetType(returnType); if (type != null) { s.Append("<small><i>"); s.Append(typeStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(type, settings)); doc = AmbienceService.GetDocumentationSummary(type); } } } else { if (member is IField) { s.Append("<small><i>"); s.Append(fieldStr); s.Append("</i></small>\n"); } else if (member is IProperty) { s.Append("<small><i>"); s.Append(propertyStr); s.Append("</i></small>\n"); } s.Append(ambience.GetString(member, settings)); doc = AmbienceService.GetDocumentationSummary(member); } } else if (result is NamespaceResolveResult) { s.Append("<small><i>"); s.Append(namespaceStr); s.Append("</i></small>\n"); s.Append(ambience.GetString(new Namespace(((NamespaceResolveResult)result).Namespace), settings)); } else { s.Append(ambience.GetString(result.ResolvedType, settings)); } if (!string.IsNullOrEmpty(doc)) { s.Append("\n<small>"); s.Append(AmbienceService.GetDocumentationMarkup("<summary>" + doc + "</summary>")); s.Append("</small>"); } } if (!string.IsNullOrEmpty(errorInformations)) { if (s.Length != 0) { s.Append("\n\n"); } s.Append("<small>"); s.Append(errorInformations); s.Append("</small>"); } return(s.ToString()); }
protected override string GetMethodString(IMethod method, OutputSettings settings) { return(InternalGetMethodString(method, settings, settings.EmitName(method, Format(FilterName(method.EntityType == EntityType.Constructor || method.EntityType == EntityType.Destructor ? method.DeclaringTypeDefinition.Name : method.Name))), true)); }
public abstract void CheckDeviceCompatibility(OutputSettings settings);
protected override string GetOperatorString(IMethod method, OutputSettings settings) { return(InternalGetMethodString(method, settings, settings.EmitName(method, Format(FilterName(method.Name))), true)); }
public override void SetupForDevice(OutputSettings settings) { technique = effect.GetTechnique("outlinePerPixel"); }
public static void CreateSpoilerLog(RandomizedResult randomized, GameplaySettings settings, OutputSettings outputSettings) { var itemList = randomized.ItemList .Where(io => !io.Item.IsFake()) .Select(u => new SpoilerItem(u, ItemUtils.IsRequired(u.Item, randomized), ItemUtils.IsImportant(u.Item, randomized))); var settingsString = settings.ToString(); var directory = Path.GetDirectoryName(outputSettings.OutputROMFilename); var filename = $"{Path.GetFileNameWithoutExtension(outputSettings.OutputROMFilename)}"; var plainTextRegex = new Regex("[^a-zA-Z0-9' .\\-]+"); Spoiler spoiler = new Spoiler() { Version = Randomizer.AssemblyVersion, SettingsString = settingsString, Seed = randomized.Seed, RandomizeDungeonEntrances = settings.RandomizeDungeonEntrances, ItemList = itemList.Where(u => !u.Item.IsFake()).ToList(), NewDestinationIndices = randomized.NewDestinationIndices, Logic = randomized.Logic, GossipHints = randomized.GossipQuotes?.ToDictionary(me => (GossipQuote)me.Id, (me) => { var message = me.Message.Substring(1); var soundEffect = message.Substring(0, 2); message = message.Substring(2); if (soundEffect == "\x69\x0C") { // real } else if (soundEffect == "\x69\x0A") { // fake message = "FAKE - " + message; } else { // junk message = "JUNK - " + message; } return(plainTextRegex.Replace(message.Replace("\x11", " "), "")); }), }; if (outputSettings.GenerateHTMLLog) { using (StreamWriter newlog = new StreamWriter(Path.Combine(directory, filename + "_Tracker.html"))) { Templates.HtmlSpoiler htmlspoiler = new Templates.HtmlSpoiler(spoiler); newlog.Write(htmlspoiler.TransformText()); } } if (outputSettings.GenerateSpoilerLog) { CreateTextSpoilerLog(spoiler, Path.Combine(directory, filename + "_SpoilerLog.txt")); } }
protected override string GetDestructorString(IMethod method, OutputSettings settings) { return(InternalGetMethodString(method, settings, settings.EmitName(method, settings.Markup("~") + Format(FilterName(method.DeclaringTypeDefinition != null ? method.DeclaringTypeDefinition.Name : method.Name))), false)); }
public static void CreateSpoilerLog(RandomizedResult randomized, GameplaySettings settings, OutputSettings outputSettings) { var itemList = randomized.ItemList .Where(io => !io.Item.IsFake() && io.NewLocation.HasValue) .Select(u => new SpoilerItem(u, ItemUtils.IsRequired(u.Item, randomized), ItemUtils.IsImportant(u.Item, randomized), settings.ProgressiveUpgrades)); Dictionary <Item, Item> dungeonEntrances = new Dictionary <Item, Item>(); if (settings.RandomizeDungeonEntrances) { var entrances = new List <Item> { Item.AreaWoodFallTempleAccess, Item.AreaSnowheadTempleAccess, Item.AreaGreatBayTempleAccess, Item.AreaInvertedStoneTowerTempleAccess, }; foreach (var entrance in entrances.OrderBy(e => entrances.IndexOf(randomized.ItemList[e].NewLocation.Value))) { dungeonEntrances.Add(randomized.ItemList[entrance].NewLocation.Value, entrance); } } var settingsString = settings.ToString(); var directory = Path.GetDirectoryName(outputSettings.OutputROMFilename); var filename = $"{Path.GetFileNameWithoutExtension(outputSettings.OutputROMFilename)}"; var plainTextRegex = new Regex("[^a-zA-Z0-9' .\\-]+"); Spoiler spoiler = new Spoiler() { Version = Randomizer.AssemblyVersion, SettingsString = settingsString, Seed = randomized.Seed, DungeonEntrances = dungeonEntrances, ItemList = itemList.ToList(), Logic = randomized.Logic, GossipHints = randomized.GossipQuotes?.ToDictionary(me => (GossipQuote)me.Id, (me) => { var message = me.Message.Substring(1); var soundEffect = message.Substring(0, 2); message = message.Substring(2); if (soundEffect == "\x69\x0C") { // real } else if (soundEffect == "\x69\x0A") { // fake message = "FAKE - " + message; } else { // junk message = "JUNK - " + message; } return(plainTextRegex.Replace(message.Replace("\x11", " "), "")); }), }; if (outputSettings.GenerateHTMLLog) { using (StreamWriter newlog = new StreamWriter(Path.Combine(directory, filename + "_Tracker.html"))) { Templates.HtmlSpoiler htmlspoiler = new Templates.HtmlSpoiler(spoiler); newlog.Write(htmlspoiler.TransformText()); } } if (outputSettings.GenerateSpoilerLog) { CreateTextSpoilerLog(spoiler, Path.Combine(directory, filename + "_SpoilerLog.txt")); } }
protected override string GetPropertyString(IProperty property, OutputSettings settings) { if (property == null) { return(""); } var result = new StringBuilder(); AppendModifiers(result, settings, property); if (!settings.CompletionListFomat && settings.IncludeReturnType) { result.Append(GetTypeReferenceString(property.ReturnType, settings)); result.Append(settings.Markup(" ")); } if (!settings.IncludeReturnType && settings.UseFullName) { result.Append(GetTypeReferenceString(property.DeclaringTypeDefinition, new OutputSettings(OutputFlags.UseFullName))); result.Append(settings.Markup(".")); } AppendExplicitInterfaces(result, property, settings); if (property.EntityType == EntityType.Indexer) { result.Append(settings.EmitName(property, "this")); } else { result.Append(settings.EmitName(property, Format(FilterName(property.Name)))); } if (settings.IncludeParameters && property.Parameters.Count > 0) { result.Append(settings.Markup("[")); AppendParameterList(result, settings, property.Parameters); result.Append(settings.Markup("]")); } if (settings.CompletionListFomat && settings.IncludeReturnType) { result.Append(settings.Markup(" : ")); result.Append(GetTypeReferenceString(property.ReturnType, settings)); } if (settings.IncludeAccessor) { result.Append(settings.Markup(" {")); if (property.CanGet) { result.Append(settings.Markup(" get;")); } if (property.CanSet) { result.Append(settings.Markup(" set;")); } result.Append(settings.Markup(" }")); } return(result.ToString()); }
public TextChunksStreamReader(IEnumerable <TextChunk> chunksSource) { _chunksSource = chunksSource; _outputSettings = new OutputSettings(); }
public override void CheckDeviceCompatibility(OutputSettings settings) { }
static int Main(string[] args) { var argsDictionary = DictionaryHelper.FromProgramArguments(args); var settings = new GameplaySettings(); var outputSettings = new OutputSettings(); settings.Update("fz1mr--16psr-lc-f"); settings.CustomItemListString = "81-80000000----3fff-ffffffff-ffffffff-fe000000-6619ff-7fffffff-f378ffff-ffffffff"; settings.CustomItemList = ConvertIntString(settings.CustomItemListString); settings.CustomStartingItemListString = "-3fc04000-"; settings.CustomStartingItemList = ConvertItemString(ItemUtils.StartingItems().Where(item => !item.Name().Contains("Heart")).ToList(), settings.CustomStartingItemListString); settings.CustomJunkLocationsString = "----------200000--f000"; settings.CustomJunkLocations = ConvertItemString(ItemUtils.AllLocations().ToList(), settings.CustomJunkLocationsString); outputSettings.GeneratePatch = argsDictionary.ContainsKey("-patch"); outputSettings.GenerateSpoilerLog = argsDictionary.ContainsKey("-spoiler"); outputSettings.GenerateHTMLLog = argsDictionary.ContainsKey("-html"); outputSettings.GenerateROM = argsDictionary.ContainsKey("-rom"); int seed; if (argsDictionary.ContainsKey("-seed")) { seed = int.Parse(argsDictionary["-seed"][0]); } else { seed = new Random().Next(); } var outputArg = argsDictionary.GetValueOrDefault("-output"); if (outputArg != null) { if (outputArg.Count > 1) { throw new ArgumentException("Invalid argument.", "-output"); } outputSettings.OutputROMFilename = outputArg.SingleOrDefault(); } outputSettings.OutputROMFilename ??= Path.Combine("output", FileUtils.MakeFilenameValid(DateTime.UtcNow.ToString("o"))); var inputArg = argsDictionary.GetValueOrDefault("-input"); if (inputArg != null) { if (inputArg.Count > 1) { throw new ArgumentException("Invalid argument.", "-input"); } outputSettings.InputROMFilename = inputArg.SingleOrDefault(); } outputSettings.InputROMFilename ??= "input.z64"; var validationResult = settings.Validate(); if (validationResult != null) { Console.WriteLine(validationResult); return(-1); } try { string result; using (var progressBar = new ProgressBar()) { //var progressReporter = new TextWriterProgressReporter(Console.Out); var progressReporter = new ProgressBarProgressReporter(progressBar); result = ConfigurationProcessor.Process(new Configuration { GameplaySettings = settings, OutputSettings = outputSettings, }, seed, progressReporter); } if (result != null) { Console.Error.WriteLine(result); } else { Console.WriteLine("Generation complete!"); } return(result == null ? 0 : -1); } catch (Exception e) { Console.Error.Write(e.Message); Console.Error.Write(e.StackTrace); return(-1); } }
protected override string GetParameterString(IParameterizedMember member, IParameter parameter, OutputSettings settings) { if (parameter == null) { return(""); } var result = new StringBuilder(); if (settings.IncludeParameterName) { if (settings.IncludeModifiers) { if (parameter.IsOut) { result.Append(settings.EmitKeyword("out")); } if (parameter.IsRef) { result.Append(settings.EmitKeyword("ref")); } if (parameter.IsParams) { result.Append(settings.EmitKeyword("params")); } } result.Append(GetTypeReferenceString(parameter.Type, settings)); result.Append(" "); if (settings.HighlightName) { result.Append(settings.EmitName(parameter, settings.Highlight(Format(FilterName(parameter.Name))))); } else { result.Append(settings.EmitName(parameter, Format(FilterName(parameter.Name)))); } } else { result.Append(GetTypeReferenceString(parameter.Type, settings)); } return(result.ToString()); }
public static void CreateSpoilerLog(RandomizedResult randomized, GameplaySettings settings, OutputSettings outputSettings) { var itemList = randomized.ItemList .Where(io => (io.IsRandomized && io.NewLocation.Value.Region().HasValue) || (io.Item.MainLocation().HasValue&& randomized.ItemList[io.Item.MainLocation().Value].IsRandomized)) .Select(io => new { ItemObject = io.Item.MainLocation().HasValue ? randomized.ItemList.Find(x => x.NewLocation == io.Item.MainLocation().Value) : io, LocationForImportance = io.NewLocation ?? io.Item, Region = io.IsRandomized ? io.NewLocation.Value.Region().Value : io.Item.Region().Value, }) .Select(u => new SpoilerItem( u.ItemObject, u.Region, ItemUtils.IsRequired(u.ItemObject.Item, u.LocationForImportance, randomized), ItemUtils.IsImportant(u.ItemObject.Item, u.LocationForImportance, randomized), randomized.ImportantSongLocations?.Contains(u.LocationForImportance) == true, settings.ProgressiveUpgrades )); randomized.Logic.ForEach((il) => { if (il.ItemId >= 0) { var io = randomized.ItemList[il.ItemId]; il.IsFakeItem = !io.IsRandomized || (io.Item.IsFake() && io.Item.Entrance() == null); il.IsItemRemoved = io.ItemOverride.HasValue; } }); Dictionary <Item, Item> dungeonEntrances = new Dictionary <Item, Item>(); if (settings.RandomizeDungeonEntrances) { var entrances = new List <Item> { Item.AreaWoodFallTempleAccess, Item.AreaSnowheadTempleAccess, Item.AreaGreatBayTempleAccess, Item.AreaInvertedStoneTowerTempleAccess, }; foreach (var entrance in entrances.OrderBy(e => entrances.IndexOf(randomized.ItemList[e].NewLocation.Value))) { dungeonEntrances.Add(randomized.ItemList[entrance].NewLocation.Value, entrance); } } var settingsString = settings.ToString(); var directory = Path.GetDirectoryName(outputSettings.OutputROMFilename); var filename = $"{Path.GetFileNameWithoutExtension(outputSettings.OutputROMFilename)}"; var plainTextRegex = new Regex("[^a-zA-Z0-9' .\\-]+"); Spoiler spoiler = new Spoiler() { Version = Randomizer.AssemblyVersion, SettingsString = settingsString, Seed = randomized.Seed, DungeonEntrances = dungeonEntrances, ItemList = itemList.ToList(), Logic = randomized.Logic, GossipHints = randomized.GossipQuotes?.ToDictionary(me => (GossipQuote)me.Id, (me) => { var message = me.Message.Substring(1); var soundEffect = message.Substring(0, 2); message = message.Substring(2); if (soundEffect == "\x69\x0C") { // real } else if (soundEffect == "\x69\x0A") { // fake message = "FAKE - " + message; } else { // junk message = "JUNK - " + message; } return(plainTextRegex.Replace(message.Replace("\x11", " "), "")); }), MessageCosts = randomized.MessageCosts.Select((mc, i) => { if (!mc.HasValue) { return(((string, ushort)?)null); } var messageCost = MessageCost.MessageCosts[i]; var name = messageCost.Name; if (string.IsNullOrWhiteSpace(name)) { if (messageCost.LocationsAffected.Count > 0) { var location = messageCost.LocationsAffected[0]; var mainLocation = location.MainLocation(); if (mainLocation.HasValue) { name = $"{mainLocation.Value.Location()} ({location.ToString().Replace(mainLocation.Value.ToString(), "")})"; } else { name = location.Location(); } } else { name = $"Message Cost [{i}]"; } } return(name, mc.Value); }).Where(mc => mc != null).Select(mc => mc.Value).ToList(), }; if (outputSettings.GenerateHTMLLog) { using (StreamWriter newlog = new StreamWriter(Path.Combine(directory, filename + "_Tracker.html"))) { Templates.HtmlSpoiler htmlspoiler = new Templates.HtmlSpoiler(spoiler); newlog.Write(htmlspoiler.TransformText()); } } if (outputSettings.GenerateSpoilerLog) { CreateTextSpoilerLog(spoiler, Path.Combine(directory, filename + "_SpoilerLog.txt")); } }
protected override string GetTypeString(IType t, OutputSettings settings) { if (t.Kind == TypeKind.Unknown) { return(settings.IncludeMarkup ? settings.Markup(t.Name) : t.Name); } if (t.Kind == TypeKind.TypeParameter) { return(settings.IncludeMarkup ? settings.Markup(t.FullName) : t.FullName); } var typeWithElementType = t as TypeWithElementType; if (typeWithElementType != null) { var sb = new StringBuilder(); if (typeWithElementType is PointerType) { sb.Append(settings.Markup("*")); } AppendType(sb, typeWithElementType.ElementType, settings); if (typeWithElementType is ArrayType) { sb.Append(settings.Markup("[")); sb.Append(settings.Markup(new string (',', ((ArrayType)t).Dimensions - 1))); sb.Append(settings.Markup("]")); } return(sb.ToString()); } ITypeDefinition type = t.GetDefinition(); if (type == null) { return(""); } if (!settings.UseNETTypeNames && type.Namespace == "System" && type.TypeParameterCount == 0) { switch (type.Name) { case "Object": return("object"); case "Boolean": return("bool"); case "Char": return("char"); case "SByte": return("sbyte"); case "Byte": return("byte"); case "Int16": return("short"); case "UInt16": return("ushort"); case "Int32": return("int"); case "UInt32": return("uint"); case "Int64": return("long"); case "UInt64": return("ulong"); case "Single": return("float"); case "Double": return("double"); case "Decimal": return("decimal"); case "String": return("string"); case "Void": return("void"); } } // output anonymous type if (type.IsSynthetic && type.Name == "$Anonymous$") { return(GetTypeReferenceString(type, settings)); } var result = new StringBuilder(); var def = type; AppendModifiers(result, settings, def); if (settings.IncludeKeywords) { result.Append(GetString(def.Kind)); } if (result.Length > 0 && !result.ToString().EndsWith(" ")) { result.Append(settings.Markup(" ")); } if (type.Kind == TypeKind.Delegate && settings.ReformatDelegates && settings.IncludeReturnType) { var invoke = type.GetDelegateInvokeMethod(); result.Append(GetTypeReferenceString(invoke.ReturnType, settings)); result.Append(settings.Markup(" ")); } if (settings.UseFullName && !string.IsNullOrEmpty(type.Namespace)) { result.Append((settings.IncludeMarkup ? settings.Markup(t.Namespace) : type.Namespace) + "."); } if (settings.UseFullInnerTypeName && type.DeclaringTypeDefinition != null) { bool includeGenerics = settings.IncludeGenerics; settings.OutputFlags |= OutputFlags.IncludeGenerics; string typeString = GetTypeReferenceString(type.DeclaringTypeDefinition, settings); if (!includeGenerics) { settings.OutputFlags &= ~OutputFlags.IncludeGenerics; } result.Append(typeString); result.Append(settings.Markup(".")); } result.Append(settings.EmitName(type, settings.IncludeMarkup ? settings.Markup(t.Name) : type.Name)); if (settings.IncludeGenerics && type.TypeParameterCount > 0) { result.Append(settings.Markup("<")); for (int i = 0; i < type.TypeParameterCount; i++) { if (i > 0) { result.Append(settings.Markup(settings.HideGenericParameterNames ? "," : ", ")); } if (!settings.HideGenericParameterNames) { if (t.TypeArguments.Count > 0) { result.Append(GetTypeReferenceString(t.TypeArguments [i], settings)); } else { AppendVariance(result, type.TypeParameters [i].Variance); result.Append(NetToCSharpTypeName(type.TypeParameters [i].FullName)); } } } result.Append(settings.Markup(">")); } if (t.Kind == TypeKind.Delegate && settings.ReformatDelegates) { // var policy = GetPolicy (settings); // if (policy.BeforeMethodCallParentheses) // result.Append (settings.Markup (" ")); result.Append(settings.Markup("(")); var invoke = type.GetDelegateInvokeMethod(); if (invoke != null) { AppendParameterList(result, settings, invoke.Parameters); } result.Append(settings.Markup(")")); return(result.ToString()); } if (settings.IncludeBaseTypes && type.DirectBaseTypes.Any()) { bool first = true; foreach (var baseType in type.DirectBaseTypes) { // if (baseType.FullName == "System.Object" || baseType.FullName == "System.Enum") // continue; result.Append(settings.Markup(first ? " : " : ", ")); first = false; result.Append(GetTypeReferenceString(baseType, settings)); } } // OutputConstraints (result, settings, type.TypeParameters); return(result.ToString()); }
/// <summary> /// Get safe HTML from untrusted input HTML, by parsing input HTML and filtering it through a white-list of /// permitted tags and attributes. /// </summary> /// <param name="bodyHtml">Input untrusted HTML (body fragment)</param> /// <param name="baseUri">URL to resolve relative URLs against</param> /// <param name="whitelist">White-list of permitted HTML elements</param> /// <param name="outputSettings">Document output settings; use to control pretty-printing and entity escape modes</param> /// <returns>Safe HTML (body fragment)</returns> /// <see cref="Cleaner.Clean(Document)"/> public static string Clean(string bodyHtml, string baseUri, Whitelist whitelist, OutputSettings outputSettings) { Document dirty = ParseBodyFragment(bodyHtml, baseUri); Cleaner cleaner = new Cleaner(whitelist); Document clean = cleaner.Clean(dirty); clean.OutputSettings(outputSettings); return(clean.Body.Html()); }
public Sgp4RouteData() { OutputSettings = new OutputSettings(); }
public PointToPointRouteData() { Waypoints = new List <ServiceCartographicWithTime>(); IncludeWaypointsInRoute = false; OutputSettings = new OutputSettings(); }