/// <summary> /// Returns a <see cref="System.String"/> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> public override string ToString() { StringBuilder toolTipInfo = new StringBuilder(); toolTipInfo.AppendLine(string.Format("Resource Id: {0}", Id.ToString())); toolTipInfo.AppendLine(string.Format("Name: {0}", Name)); if (!string.IsNullOrEmpty(TypeName)) { toolTipInfo.AppendLine(string.Format("Type Name: {0}", TypeName)); } else { toolTipInfo.AppendLine(string.Format("Type Id: {0}", TypeId.ToString())); } if (!string.IsNullOrEmpty(SolutionName)) { toolTipInfo.AppendLine(string.Format("Solution Name: {0}", SolutionName)); } else { toolTipInfo.AppendLine(string.Format("Solution Id: {0}", SolutionId.ToString())); } if (!string.IsNullOrEmpty(TenantName)) { toolTipInfo.AppendLine(string.Format("Tenant Name: {0}", TenantName)); } else { toolTipInfo.AppendLine(string.Format("Tenant Id: {0}", TenantId.ToString())); } return(toolTipInfo.ToString()); }
/// <summary> /// 获取网站列表 /// </summary> /// <returns></returns> private SiteEntity GetSiteList() { _status.Text = @"正在登录中"; var body = new SiteListRequestEntity(_btToken) { Tojs = "site.get_list", Table = "sites", Limit = SelectNum.ToString(), P = "1", Search = "", Order = "id desc", Type = TypeId.ToString() }; var client = new RestClient(_btAddress + "/data?action=getData"); var request = new RestRequest(Method.POST); request.AddParameter("tojs", body.Tojs); request.AddParameter("table", body.Table); request.AddParameter("limit", body.Limit); request.AddParameter("p", body.P); request.AddParameter("search", body.Search); request.AddParameter("order", body.Order); request.AddParameter("type", body.Type); SetTokenParam(request, body); Console.WriteLine(body); var jsonResult = client.Execute(request).Content; jsonResult = CheckJsonResultIsNull(jsonResult, client, request); var siteEntity = JsonConvert.DeserializeObject <SiteEntity>(jsonResult); return(siteEntity); }
protected string FormatBase(string value, FormattingOptions options) { if ((options & FormattingOptions.Compact) == FormattingOptions.Compact) { return(value); } else { return(TypeId.ToString() + "(" + value + ")"); } }
public string GetClassDeclareString() { var sb = new StringBuilder(128); sb.AppendAccessModifier(AccessModifier); sb.AppendVariableDeclareModifier(Modifier); sb.Append(TypeId.ToString().ToLower()); sb.Append(' '); sb.Append(TypeName); return(sb.ToString()); }
/// <summary> /// Convert to XML element /// </summary> internal XElement ToXml(string elementName) { var element = new XElement(elementName, new XAttribute("sl", Start.Line.ToString()), new XAttribute("sc", Start.Column.ToString())); if (Start.Line != End.Line) { element.Add(new XAttribute("el", End.Line.ToString())); } if (Start.Column != End.Column) { element.Add(new XAttribute("ec", End.Column.ToString())); } element.Add(new XAttribute("ti", TypeId.ToString())); element.Add(new XAttribute("mi", MethodId.ToString())); element.Add(new XAttribute("mo", MethodOffset.ToString())); return(element); }
public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("ProjectName:" + ProjectName); sb.AppendLine("Version:" + Version); sb.AppendLine(); sb.AppendLine("ProductName:" + ProductName); sb.AppendLine("ThermoProductType:" + ThermoProductType.ToString()); sb.AppendLine("TypeId:" + TypeId.ToString()); sb.AppendLine("PartID:" + PartID); sb.AppendLine("Height:" + Height.ToString("F2")); sb.AppendLine(); foreach (var spcItem in SPCItems) { sb.AppendLine(spcItem.ToString()); } return(sb.ToString()); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var result = ValidationResult.Success; if (value == null) { return(new ValidationResult(string.Format(ErrorPattern, TypeId.ToString(), validationContext.MemberName, "NULL"))); } int tmp = (int)value; if (WeekDay == EnWeekDay.Sunday) { result = base.IsValid(value, validationContext); if (result != ValidationResult.Success) { result.ErrorMessage = string.Format(ErrorPattern, TypeId.ToString(), validationContext.MemberName, value.ToString()); //validationContext.Items.Add(new KeyValuePair<object, object>("err-"+validationContext.MemberName, value)); } } return(result); }
public ConstantsType(TypeId typeId, ConstantsTypeFlags flags, string?documentation, Constant[] constants) : this(typeId.ToString(), typeId, flags, documentation, constants) { }
public EnumType(TypeId typeId, string?documentation, EnumValue[] values, EnumTypeFlags flags) : this(typeId.ToString(), typeId, documentation, values, flags) { }
private void Strategy(ExecutionStrategy executionStrategy, FlameCodeRulesGenerator rulesGenerator) { Dictionary <StrategyOperator, int> strategyNumber = new Dictionary <StrategyOperator, int>(); StrategyNumberCreate(strategyNumber); Function function = new Function(Name, JoinStrings(Name, "show"), JoinStrings(Name, "show"), JoinStrings(Name, "start")); AddFunction(function); function = new Function(Name, JoinStrings(Name, "initialization"), JoinStrings(Name, "start"), JoinStrings(Name, "initialization")); function.Condition = new Condition("a.structure_rule", Condition.RelationalOperators.EQ, "-1"); AddFunction(function); function = new Function(Name, "idle", JoinStrings(Name, "start"), JoinStrings(Name, "end")); function.Condition = new Condition("a.structure_rule", Condition.RelationalOperators.NEQ, "-1"); AddFunction(function); int ruleNumber = 0; string previousState = JoinStrings(Name, "initialization"); string functionName = ""; string currentState = ""; string nextState = ""; bool b = false; ExecutionStrategy strategy = membraneType.ExecutionStrategy; while (strategy != null) { RulesNumber += strategy.Rules.Count; strategyNumber[strategy.Operator]++; functionName = Name; currentState = previousState; StrategyFunction strategyFunction = new StrategyFunction(Name, Name, currentState, nextState, strategyNumber[strategy.Operator]); strategyFunction.StrategyType = strategy.Operator; strategyFunction.Rules = rulesGenerator.Rules(strategy); strategyFunction.Guards = rulesGenerator.Guards(strategy); if (strategy.Next != null) { nextState = strategyFunction.Name; strategyFunction.NextState = nextState; } else { nextState = JoinStrings(Name, "execution_completed"); strategyFunction.NextState = nextState; } strategyFunction.Add(ruleNumber, strategy.Rules.Count); ruleNumber += strategy.Rules.Count; strategyFunction.Outputs = new Outputs(); strategyFunction.Outputs.AddMessage("msgSendObject"); if (b) { strategyFunction.Condition = new Condition("a.stop", Condition.RelationalOperators.EQ, "0"); AddFunction(strategyFunction); function = new Function(Name, "idle", currentState, JoinStrings(Name, "execution_completed")); function.Condition = new Condition("a.stop", Condition.RelationalOperators.NEQ, "0"); AddFunction(function); } else { AddFunction(strategyFunction); } previousState = nextState; b = true; strategy = strategy.Next; } function = new Function(Name, JoinStrings(Name, "PrepareTheNewMembrane"), JoinStrings(Name, "execution_completed"), JoinStrings(Name, "prepare_the_new_membrane")); function.Condition = new Condition("a.rule_type_selected", Condition.RelationalOperators.EQ, "2"); function.Outputs = new Outputs(); function.Outputs.AddMessage("msgRequestId"); AddFunction(function); function = new Function(Name, JoinStrings(Name, "CreateNewMembrane"), JoinStrings(Name, "prepare_the_new_membrane"), JoinStrings(Name, "remove_membrane")); function.Inputs = new Inputs(); function.Inputs.AddMessage("msgReceiveId"); function.Inputs.Messages[0].AddCondition(new Condition(Condition.LogicOperators.AND, TypeId.ToString(), Condition.RelationalOperators.EQ, "m.type_id")); function.Inputs.Messages[0].AddCondition(new Condition("a.instanceId", Condition.RelationalOperators.EQ, "m.instance_id")); AddFunction(function); function = new Function(Name, JoinStrings(Name, "removeMembrane"), JoinStrings(Name, "remove_membrane"), JoinStrings(Name, "applyChanges")); AddFunction(function); function = new Function(Name, "idle", JoinStrings(Name, "execution_completed"), JoinStrings(Name, "remove_membrane")); function.Condition = new Condition("a.rule_type_selected", Condition.RelationalOperators.EQ, "3"); AddFunction(function); function = new Function(Name, "idle", JoinStrings(Name, "execution_completed"), JoinStrings(Name, "applyChanges")); function.Condition = new Condition("a.rule_type_selected", Condition.RelationalOperators.LEQ, "1"); AddFunction(function); function = new Function(Name, JoinStrings(Name, "applyChanges"), JoinStrings(Name, "applyChanges"), JoinStrings(Name, "receive")); AddFunction(function); function = new Function(Name, JoinStrings(Name, "receive"), JoinStrings(Name, "receive"), JoinStrings(Name, "end")); function.Inputs = new Inputs(); function.Inputs.AddMessage("msgSendObject"); function.Inputs.Messages[0].AddCondition(new Condition(Condition.LogicOperators.AND, "a.id", Condition.RelationalOperators.EQ, "m.idTo")); function.Inputs.Messages[0].AddCondition(new Condition("a.instanceId", Condition.RelationalOperators.EQ, "m.instanceIdTo")); AddFunction(function); }
public override string ToString() { return(TypeId.ToString()); }
// called to extract text from a file // passed - sourceFileName - full path of file to extract text from // returns - // indexText - text that will be used for Lucene indexing, includes metadata // analysisText - text that will be used for clustering and LSA // errorFlag - false if an unrecoverable error occurred, else true // errorText - text of error if one occurred public void extractText(string docID, string sourceFileName, string title, ref string indexText, ref string analysisText, List <ErrorDataObject> errObjs, out bool errorFlag) { Options dtOptions; FileConverter fileConverter; StringBuilder outStringIndex = new StringBuilder(); StringBuilder outStringAnalysis = new StringBuilder(); errorFlag = true; indexText = ""; analysisText = ""; try { // construct temporary file name for xml file output by dtSearch string targetFileNameDTSearch = @"C:\temp\_DTSearch.txt"; File.Delete(targetFileNameDTSearch); dtOptions = new Options(); dtOptions.FieldFlags = FieldFlags.dtsoFfOfficeSkipHiddenContent; dtOptions.BinaryFiles = BinaryFilesSettings.dtsoIndexSkipBinary; dtOptions.Save(); fileConverter = new FileConverter(); fileConverter.InputFile = sourceFileName; fileConverter.OutputFile = targetFileNameDTSearch; fileConverter.OutputFormat = OutputFormats.it_ContentAsXml; fileConverter.Flags = ConvertFlags.dtsConvertInlineContainer; fileConverter.Execute(); //check for image file type TypeId deType = fileConverter.DetectedTypeId; if (imageTypes.Contains(deType)) { errObjs.Add(new ErrorDataObject("1002", "Image File Type: " + deType.ToString(), "Warning")); } // return if there is a dtSearch error other than file corrupt (10) or file encrypted (17) JobErrorInfo errorInfo = fileConverter.Errors; bool fatalError = false; bool fileMissingOrNoText = false; int dtErCode = 0; if (errorInfo != null && errorInfo.Count > 0) { for (int i = 0; i < errorInfo.Count; i++) { dtErCode = errorInfo.Code(i); string errorCode = ""; if (dtErCode != 9 && dtErCode != 10 && dtErCode != 17 && dtErCode != 207 && dtErCode != 16 && dtErCode != 21) { errObjs.Add(new ErrorDataObject("1005", "Text extraction Error occurred during processing of the document. " + errorInfo.Message(i), "Error")); fatalError = true; } else { string errText = ""; if (dtErCode == 10) // dtsErFileCorrupt { errorCode = "1013"; errText = "Document is corrupted."; } if (dtErCode == 17) // dtsErFileEncrypted { errorCode = "1007"; errText = "A component of the document is encrypted."; } if (dtErCode == 207) // dtsErContainerItemEncrypted, internal error code { errorCode = "1014"; errText = "The document is encrypted."; string text = errorInfo.Message(i); if (text != null) { int index = text.IndexOf("->"); if (index >= 0) { errText = "A component of the document is encrypted. " + text.Substring(index); } } } if (dtErCode == 9) // dtsErAccFile { errorCode = "1010"; errText = "The system cannot access the file specified."; } if (dtErCode == 16) // dtsErFileNotFound { errorCode = "1011"; errText = "Document file does not exist."; } if (dtErCode == 21) // dtsErFileEmpty { errorCode = "1012"; errText = "Document file is empty"; } if (dtErCode == 9 || dtErCode == 10 || dtErCode == 207 || dtErCode == 16 || dtErCode == 21) { fileMissingOrNoText = true; // file missing, no text, corrupt or encrypted } if (errText == "") { errText = errorInfo.Message(i); } errObjs.Add(new ErrorDataObject(errorCode, "Text extraction error: " + errText, "Warning")); } } } if (fatalError) { errorFlag = false; return; } else { if (fileMissingOrNoText) { return; } if (dtErCode == 17) { FileInfo fi = new FileInfo(targetFileNameDTSearch); if (fi.Length == 0) { errObjs.Clear(); // remove error "1007" errObjs.Add(new ErrorDataObject("1014", "Text extraction error: document is encrypted.", "Warning")); return; } } //load the dtSearch XML output file into an XML document XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(targetFileNameDTSearch); } catch { //try cleaning up the metadata tags and loading again cleanMetadataTags(targetFileNameDTSearch); xmlDoc.Load(targetFileNameDTSearch); } //start with the document node XmlNode docNode = xmlDoc.DocumentElement; //initialize the output strings outStringIndex.Length = 0; outStringIndex.AppendLine("DocID: " + docID); if (title != null && title.Length > 0) { outStringIndex.AppendLine("Filename: " + title); } outStringAnalysis.Length = 0; //start outputting with the document node outputNode(docNode, outStringIndex, outStringAnalysis, errObjs); indexText = outStringIndex.ToString(); analysisText = outStringAnalysis.ToString(); //signal error if no analysis text if (analysisText.Length == 0) { errObjs.Add(new ErrorDataObject("1003", "No text to analyze", "Warning")); } return; } } catch (Exception ex) { errObjs.Add(new ErrorDataObject("1001", "Text extraction Error occurred during processing of the document. " + ex.Message, "Error")); errorFlag = false; return; } }
public virtual void Load(Utility utility) { CGFXDebug.LoadStart(this, utility); TypeId = utility.ReadU32(); if (!VerifyTypeId(TypeId)) { throw new InvalidOperationException($"ChunkDICTObject Load: ERROR reading DICT -- unexpected type ID '{TypeId.ToString("X8")}'"); } var magic = utility.ReadMagic(); if (magic != Utility.MakeMagic(Magic)) { throw new InvalidOperationException($"ChunkDICTObject Load: ERROR reading DICT -- expected magic '{Magic}', got '{Utility.GetMagicString(magic)}'"); } Revision = utility.ReadU32(); Name = utility.ReadString(); MetaDatas = utility.LoadDICTFromOffset <ChunkDICTMetaData>(); }
/// <summary> /// Navigates the click. /// </summary> private void NavigateClick( ) { EntityNotificationService.NavigateTo(TypeId.ToString(CultureInfo.InvariantCulture), TenantId); }
} // SPICA doesn't note this, unknown, found through testing public override void Load(Utility utility) { // NOT caling base.Load() as this doesn't use the usual header CGFXDebug.LoadStart(this, utility); TypeId = utility.ReadU32(); if (TypeId != 0x80000000) { throw new InvalidOperationException($"DICTObjAnimGroup: Unexpected TypeId {TypeId.ToString("X8")}"); } Flags = utility.ReadU32(); Name = utility.ReadString(); MemberType = utility.ReadI32(); Elements = utility.LoadDICTFromOffset <ChunkDICTAnimGroupElement>(); var count = utility.ReadU32(); BlendOperationTypes = utility.ReadInts(count); EvaluationTiming = (AnimEvaluationTiming)utility.ReadU32(); Unknown = utility.ReadU32(); }