private Status(CodeEnum code, Slice msg, Slice msg2) { Debug.Assert(code != CodeEnum.kOk); int len1 = msg.Size; int len2 = 0; if (msg2 != null) { len2 = msg2.Size; } int size = len1 + (len2 != 0 ? (2 + len2) : 0); byte[] result = new byte[size + 5]; Buffer.BlockCopy(BitConverter.GetBytes(size), 0, result, 0, 4); result[4] = (byte) Code; msg.Data.CopyTo(result,5, len1); if (len2!=0) { result[5 + len1] = (byte)':'; result[6 + len1] = (byte)' '; msg2.Data.CopyTo(result, 7 + len1, len2); } m_state = result; }
protected override void VisitEnum(CodeEnum codeEnum) { if (codeEnum.FullName == _classFullName) { _result = codeEnum.ProjectItem; } }
public EnumTraverser(CodeEnum codeEnum, Action<CodeVariable, int> withVariable) { if (codeEnum == null) throw new ArgumentNullException("codeEnum"); if (withVariable == null) throw new ArgumentNullException("withVariable"); CodeEnum = codeEnum; WithVariable = withVariable; if (codeEnum.Members != null) Traverse(codeEnum.Members); }
/// <summary> /// Initializes a new instance of the <see cref="EnumInfo"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="item">The item.</param> public EnumInfo(NodeItem parent, CodeEnum item) : base(null, item as CodeElement2) { this._enum = item as CodeEnum; this.IsEnum = true; this.Namespace = item.Namespace.FullName; this.DocComment = this._enum.DocComment; IsPublic = this.IsPublic_Impl(this._enum.Access); IsPrivate = this.IsPrivate_Impl(this._enum.Access); IsProtected = this.IsProtected_Impl(this._enum.Access); IsFamilyOrProtected = this.IsFamilyOrProtected_Impl(this._enum.Access); this.IsStruct = true; this.IsStatic = true; GetFields(); }
/// <summary> /// Initializes a new instance of the <see cref="TransactionAlreadyInLedger" /> class. /// </summary> /// <param name="message">Occurs when attempting to delete a transaction which is neither pending nor expired. (required).</param> /// <param name="code">code (required).</param> public TransactionAlreadyInLedger(string message = default(string), CodeEnum code = default(CodeEnum)) { // to ensure "message" is required (not null) if (message == null) { throw new InvalidDataException("message is a required property for TransactionAlreadyInLedger and cannot be null"); } else { this.Message = message; } // to ensure "code" is required (not null) if (code == null) { throw new InvalidDataException("code is a required property for TransactionAlreadyInLedger and cannot be null"); } else { this.Code = code; } }
/// <summary> /// Initializes a new instance of the <see cref="NoSuchWallet" /> class. /// </summary> /// <param name="message">May occur when a given walletId does not match with any known wallets (because it has been deleted, or has never existed). (required).</param> /// <param name="code">code (required).</param> public NoSuchWallet(string message = default(string), CodeEnum code = default(CodeEnum)) { // to ensure "message" is required (not null) if (message == null) { throw new InvalidDataException("message is a required property for NoSuchWallet and cannot be null"); } else { this.Message = message; } // to ensure "code" is required (not null) if (code == null) { throw new InvalidDataException("code is a required property for NoSuchWallet and cannot be null"); } else { this.Code = code; } }
private string EnumToString(CodeEnum codeEnum) { try { string s = ""; for (int i = 1; i <= codeEnum.Members.Count; i++) { CodeElement c = codeEnum.Members.Item(i); s = s + c.Name; if (i != codeEnum.Members.Count) { s = s + ", "; } } return(s); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message, "AS VS Expert: EnumToString"); return(""); } }
/// <summary> /// Initializes a new instance of the <see cref="ApiError" /> class. /// </summary> /// <param name="Code">Code (required).</param> /// <param name="ErrorList">ErrorList (required).</param> /// <param name="Message">Message (required).</param> /// <param name="ErrorId">ErrorId (required).</param> public ApiError(CodeEnum Code = default(CodeEnum), List <ApiError> ErrorList = default(List <ApiError>), string Message = default(string), string ErrorId = default(string)) { // to ensure "Code" is required (not null) if (Code == null) { throw new InvalidDataException("Code is a required property for ApiError and cannot be null"); } else { this.Code = Code; } // to ensure "ErrorList" is required (not null) if (ErrorList == null) { throw new InvalidDataException("ErrorList is a required property for ApiError and cannot be null"); } else { this.ErrorList = ErrorList; } // to ensure "Message" is required (not null) if (Message == null) { throw new InvalidDataException("Message is a required property for ApiError and cannot be null"); } else { this.Message = Message; } // to ensure "ErrorId" is required (not null) if (ErrorId == null) { throw new InvalidDataException("ErrorId is a required property for ApiError and cannot be null"); } else { this.ErrorId = ErrorId; } }
internal ShellCodeEnum(CodeEnum @enum) : base(@enum as CodeElement) { _enum = @enum; }
private CodeDomEnumMetadata(CodeEnum codeEnum, CodeDomFileMetadata file) { _codeEnum = codeEnum; _file = file; }
public void createComponentBySectionList(CodeEnum codeName, Dictionary <CodeEnum, string> dict) { var mainSection = new Section(); switch (codeName) { case CodeEnum.AdverseReactions: case CodeEnum.DrugInteractions: case CodeEnum.AboutThisMedication: case CodeEnum.ProperUseOfThisMedication: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); switch (kvp.Key) { case CodeEnum.AdverseReactions: case CodeEnum.DrugInteractions: case CodeEnum.AboutThisMedication: case CodeEnum.ProperUseOfThisMedication: mainSection = createSection(kvp.Key, kvp.Value, true, 0); break; default: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; } } break; case CodeEnum.DosageAndAdministration: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); if (kvp.Key == CodeEnum.DosageAndAdministration) { mainSection = createSection(CodeEnum.DosageAndAdministration, kvp.Value, true, 0); } else { if (kvp.Key == CodeEnum.OralSolutions || kvp.Key == CodeEnum.ParenteralProducts) { firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.Reconstitution].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(kvp.Key, kvp.Value, true, 1); } if (firstSection != null && firstSection.subSectionList != null) { var secondSection = createSection(kvp.Key, kvp.Value, true, 2); firstSection.subSectionList.Add(secondSection); } } else { firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); } } } break; case CodeEnum.IndicationsAndClinicalUse: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); if (kvp.Key == CodeEnum.IndicationsAndClinicalUse) { mainSection = createSection(CodeEnum.IndicationsAndClinicalUse, kvp.Value, true, 0); } else { if (kvp.Key == CodeEnum.Geriatrics || kvp.Key == CodeEnum.Pediatrics) { firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.PatientSubsets].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(kvp.Key, kvp.Value, true, 1); } if (firstSection != null && firstSection.subSectionList != null) { var secondSection = createSection(kvp.Key, kvp.Value, true, 2); firstSection.subSectionList.Add(secondSection); } } else { firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); } } } break; case CodeEnum.WarningsAndPrecautions: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); if (kvp.Key == CodeEnum.WarningsAndPrecautions) { mainSection = createSection(CodeEnum.WarningsAndPrecautions, kvp.Value, true, 0); } else { switch (kvp.Key) { case CodeEnum.SpecialPopulations: firstSection = createSection(kvp.Key, string.Empty, false, 1); mainSection.subSectionList.Add(firstSection); break; case CodeEnum.PregnantWomen: case CodeEnum.NursingWomen: case CodeEnum.SpecialPopulationsGeriatrics: case CodeEnum.SpecialPopulationsPediatrics: firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.SpecialPopulations].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(CodeEnum.SpecialPopulations, string.Empty, false, 1); mainSection.subSectionList.Add(firstSection); } if (firstSection != null && firstSection.subSectionList != null) { var secondSection = createSection(kvp.Key, kvp.Value, true, 2); firstSection.subSectionList.Add(secondSection); } break; case CodeEnum.SpecialPopulationsMisc: var tempKeys = kvp.Value.Split(new char[] { '|' }); if (tempKeys.Length > 0) { foreach (var key in tempKeys) { firstSection = new Section(); var tempValues = key.Split(new char[] { ':' }); if (tempValues.Length > 0) { var codeElement = new Code(); firstSection.sectionID = Guid.NewGuid().ToString().ToLower(); firstSection.rootID = mainSection.sectionID; codeElement.code = CodeCollection.codes[CodeEnum.SpecialPopulationsMisc].Code; codeElement.displayName = CodeCollection.codes[CodeEnum.SpecialPopulationsMisc].DisplayName; codeElement.codeSystem = Constants.oid_SectionIdentifier; firstSection.allowText = true; firstSection.allowTitle = true; firstSection.title = tempValues[0]; firstSection.subSectionLevel = 1; firstSection.text = tempValues[1]; firstSection.effectiveTime = UtilityHelper.TodayDate; firstSection.code = codeElement; mainSection.subSectionList.Add(firstSection); } } } break; default: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; } } } break; case CodeEnum.ClinicalTrials: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); if (kvp.Key == CodeEnum.ClinicalTrials) { mainSection = createSection(CodeEnum.ClinicalTrials, kvp.Value, true, 0); } else { if (kvp.Key == CodeEnum.StudyDemographicsAndTrialDesign || kvp.Key == CodeEnum.StudyResults) { firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.EfficacyandSafetyStudies].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(CodeEnum.EfficacyandSafetyStudies, string.Empty, true, 1); mainSection.subSectionList.Add(firstSection); } if (firstSection != null && firstSection.subSectionList != null) { var secondSection = createSection(kvp.Key, kvp.Value, true, 2); firstSection.subSectionList.Add(secondSection); } } else { firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); } } } break; case CodeEnum.ActionAndClinicalPharmacology: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); var secondSection = new Section(); if (kvp.Key == CodeEnum.ActionAndClinicalPharmacology) { mainSection = createSection(CodeEnum.ActionAndClinicalPharmacology, kvp.Value, true, 0); } else { switch (kvp.Key) { case CodeEnum.Pharmacokinetics: firstSection = createSection(kvp.Key, string.Empty, false, 1); mainSection.subSectionList.Add(firstSection); break; case CodeEnum.Absorption: case CodeEnum.Distribution: case CodeEnum.Metabolism: case CodeEnum.Excretion: case CodeEnum.SpecialPopulationsAndConditions: firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.Pharmacokinetics].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(CodeEnum.Pharmacokinetics, string.Empty, false, 1); mainSection.subSectionList.Add(firstSection); } if (firstSection != null && firstSection.subSectionList != null) { if (kvp.Key == CodeEnum.SpecialPopulationsAndConditions) { secondSection = createSection(CodeEnum.SpecialPopulationsAndConditions, string.Empty, false, 2); } else { secondSection = createSection(kvp.Key, kvp.Value, true, 2); } firstSection.subSectionList.Add(secondSection); } break; case CodeEnum.ActionAndClinicalPediatrics: case CodeEnum.ActionAndClinicalGeriatrics: case CodeEnum.Gender: case CodeEnum.Race: case CodeEnum.HepaticInsufficiency: case CodeEnum.RenalInsufficiency: case CodeEnum.GeneticPolymorphism: firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.Pharmacokinetics].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(CodeEnum.Pharmacokinetics, string.Empty, false, 1); mainSection.subSectionList.Add(firstSection); } if (firstSection != null && firstSection.subSectionList != null) { secondSection = firstSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.SpecialPopulationsAndConditions].Code).FirstOrDefault(); if (secondSection == null) { secondSection = createSection(CodeEnum.SpecialPopulationsAndConditions, string.Empty, false, 2); firstSection.subSectionList.Add(secondSection); } if (secondSection != null && secondSection.subSectionList != null) { var thirdSection = createSection(kvp.Key, kvp.Value, true, 3); secondSection.subSectionList.Add(thirdSection); } } break; default: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; } } } break; case CodeEnum.PharmaceuticalInformation: foreach (KeyValuePair <CodeEnum, string> kvp in dict) { var firstSection = new Section(); if (kvp.Key == CodeEnum.PharmaceuticalInformation) { mainSection = createSection(CodeEnum.PharmaceuticalInformation, kvp.Value, true, 0); } else { switch (kvp.Key) { case CodeEnum.DrugSubstance: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; case CodeEnum.DrugProperName: case CodeEnum.ChemicalName: case CodeEnum.MolecularFormulaAndMolecularMass: case CodeEnum.StructuralformulaIncludingrelative: case CodeEnum.PhysicochemicalProperties: firstSection = mainSection.subSectionList.Where(x => x.code.code == CodeCollection.codes[CodeEnum.DrugSubstance].Code).FirstOrDefault(); if (firstSection == null) { firstSection = createSection(CodeEnum.DrugSubstance, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); } if (firstSection != null && firstSection.subSectionList != null) { var secondSection = createSection(kvp.Key, kvp.Value, true, 2); firstSection.subSectionList.Add(secondSection); } break; default: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; } } } break; default: break; } if (mainSection != null) { comPlaceholder.CreateComponent(mainSection); saveXMLToSession(SessionHelper.current.saveForm); } }
protected override void VisitEnum(CodeEnum codeEnum) { _currentEnum = new EnumType(); _currentEnum.CodeElement = codeEnum; _currentEnum.Name = codeEnum.Name; _currentEnum.TypeFullName = codeEnum.FullName; base.VisitEnum(codeEnum); _enumTypes.Add(_currentEnum); _currentEnum = null; }
private CodeDomEnumMetadata(CodeEnum codeEnum, CodeDomFileMetadata file) { this.codeEnum = codeEnum; this.file = file; }
private static string GetSummary(CodeEnum property) { return GetSummary(property.InfoLocation, property.DocComment, property.Comment, property.FullName); }
private static string GetSummary(CodeEnum property) { return(GetSummary(property.InfoLocation, property.DocComment, property.Comment, property.FullName)); }
/// <summary> /// Contructor /// </summary> /// <param name="code">Codigo de excepcion</param> public DataAccessException(CodeEnum code) : base(code.ToString(), null) { Code = code; }
/// <summary> /// Constructor /// </summary> /// <param name="code">Codigo de la excepcion</param> /// <param name="innerException">Excepcion interna</param> public DataAccessException(CodeEnum code, Exception innerException) : base(code.ToString(), innerException) { Code = code; }
private CodeVariable2[] GetEnumFields(CodeEnum codeEnum) { return(codeEnum.Members.Cast <CodeElement>().Where(x => x.Kind == vsCMElement.vsCMElementVariable).Cast <CodeVariable2>().ToArray()); }
public List <Codevalue> GetCode(CodeEnum code) { return(new CommonRal().GetCode(code)); }
/// <summary> /// /// </summary> public virtual EnumInfo CreateEnum(NodeItem parent, CodeEnum item) { return new EnumInfo(parent, item); }
/// <summary> /// /// </summary> public virtual bool AcceptEnum(CodeEnum e) { return true; }
protected virtual void VisitEnum(CodeEnum codeEnum) { this.Visit(codeEnum.Members); }
protected override void BuildEnum(CodeNamespace ns, CppEnum @enum) { var decl = new CodeEnum(GetClassName(@enum.Name)); decl.Type = @enum.IntegerType.GetDisplayName(); if (decl.Type != "int" && decl.Type != "unsigned int") { Console.WriteLine(decl.Type); throw new NotImplementedException(); } decl.Attributes = CodeAttributes.Public; decl.Comments.AddVSDocComment(@enum.Comment, "summary"); //bool first = true; //string pattern = @enum.Items.FirstOrDefault()?.Name ?? string.Empty; //foreach (CppEnumItem item in @enum.Items) //{ // while (!item.Name.StartsWith(pattern) && pattern.Length > 0) // { // pattern = pattern.Remove(pattern.Length - 1); // } // if (!first && char.IsDigit(item.Name[pattern.Length])) // { // pattern = null; // break; // } // first = false; //} bool first = true; string pattern = @enum.Items.FirstOrDefault()?.Name ?? string.Empty; foreach (CppEnumItem item in @enum.Items) { while (pattern != null && !item.Name.StartsWith(pattern) && pattern.Length > 0) { //pattern = pattern.Remove(pattern.Length - 1); int split = pattern.TrimEnd('_').LastIndexOf('_') + 1; if (split == 0) { pattern = null; break; } pattern = pattern.Remove(split); } if (pattern != null && !first && char.IsDigit(item.Name[pattern.Length])) { pattern = null; break; } first = false; } foreach (CppEnumItem item in @enum.Items) { string name = pattern != null?item.Name.Substring(pattern.Length).ToLowerInvariant().ToUpperCamel() : item.Name; string value = item.ValueExpression?.ToString(); value = (string.IsNullOrEmpty(value) || value.StartsWith("(")) ? item.Value.ToString() : value; if (pattern != null) { string[] combined = value.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (combined.Length > 1) { for (int i = 0; i < combined.Length; i++) { string subVal = combined[i]; if (subVal.StartsWith(pattern)) { combined[i] = subVal.Substring(pattern.Length).ToLowerInvariant().ToUpperCamel(); } } value = string.Join(' ', combined); } else if (value.StartsWith(pattern)) { value = value.Substring(pattern.Length).ToLowerInvariant().ToUpperCamel(); } } if (Regex.IsMatch(value, @"\d<<\d")) { value = value.Replace("<<", " << "); } var itemDecl = new CodeEnumItem(name, value); itemDecl.Comments.AddVSDocComment(item.Comment, "summary"); decl.Members.Add(itemDecl); } ns.Types.Add(decl); }
public CodeEnumNodeFactory(CodeEnum element) : base(element as CodeElement) { _enum = element; }
private static void ProcessEnum(CodeEnum element, List<IntellisenseObject> list) { IntellisenseObject data = new IntellisenseObject { Name = element.Name, IsEnum = element.Kind == vsCMElement.vsCMElementEnum, FullName = element.FullName, Namespace = GetNamespace(element), Summary = GetSummary(element) }; foreach (var codeEnum in element.Members.OfType<CodeVariable>()) { var prop = new IntellisenseProperty { Name = codeEnum.Name, Summary = GetSummary(codeEnum), InitExpression = GetInitializer(codeEnum.InitExpression) }; data.Properties.Add(prop); } if (data.Properties.Count > 0) list.Add(data); }
protected override void VisitEnum(CodeEnum codeEnum) { //忽略 Enum,不用遍历其中的字段。 //base.VisitEnum(codeEnum); }
public static List <BL.Codevalue> LoadCode(CodeEnum code) { return(new CodeBpl().GetCode(code)); }
protected override void VisitEnum(CodeEnum codeEnum) { _result.Add(codeEnum.FullName); }
public static ResultDto Err(string msg = "操作失败", CodeEnum code = CodeEnum.Fail) { return(new ResultDto { Msg = msg, Code = code }); }
private void SortFunctionsWithinClass(CodeElement codeElement) { EditPoint fieldInsertionPoint; EditPoint constructorInsertionPoint; EditPoint finalizerInsertionPoint; EditPoint delegateInsertionPoint; EditPoint eventInsertionPoint; EditPoint enumInsertionPoint; EditPoint interfaceInsertionPoint; EditPoint propertyInsertionPoint; EditPoint methodInsertionPoint; EditPoint structInsertionPoint; EditPoint classInsertionPoint; EditPoint origin = codeElement.StartPoint.CreateEditPoint(); EditPoint classPoint = codeElement.StartPoint.CreateEditPoint(); TextRanges trs = null; if (origin.FindPattern("{", (int)vsFindOptions.vsFindOptionsMatchCase, ref classPoint, ref trs)) { classPoint.Insert("\r\n"); origin = classPoint.CreateEditPoint(); fieldInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); constructorInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); finalizerInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); delegateInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); eventInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); enumInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); interfaceInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); propertyInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); methodInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); structInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); classInsertionPoint = classPoint.CreateEditPoint(); classPoint.Insert("\r\n\r\n"); Array accessLevels = Enum.GetValues(typeof(vsCMAccess)); foreach (vsCMAccess accessLevel in accessLevels) { for (int i = 1; i <= codeElement.Children.Count; i++) { CodeElement element = codeElement.Children.Item(i); EditPoint elementStartPoint = element.StartPoint.CreateEditPoint(); switch (element.Kind) { case vsCMElement.vsCMElementVariable: CodeVariable variable = element as CodeVariable; if (variable != null) { if (variable.Access == accessLevel) { MoveCodeBlock(codeElement, element, fieldInsertionPoint); } } else { Debug.WriteLine("CodeVariable " + element.Name + " null"); } break; case vsCMElement.vsCMElementFunction: // method, constructor, or finalizer CodeFunction function = element as CodeFunction; if (function != null) { if (function.Access == accessLevel) { if (function.FunctionKind == vsCMFunction.vsCMFunctionConstructor) { MoveCodeBlock(codeElement, element, constructorInsertionPoint); } else if (function.FunctionKind == vsCMFunction.vsCMFunctionDestructor) { MoveCodeBlock(codeElement, element, finalizerInsertionPoint); } else { MoveCodeBlock(codeElement, element, methodInsertionPoint); } } } else { Debug.WriteLine("CodeFunction " + element.Name + " null"); } break; case vsCMElement.vsCMElementDelegate: CodeDelegate delegateElement = element as CodeDelegate; if (delegateElement != null) { if (delegateElement.Access == accessLevel) { MoveCodeBlock(codeElement, element, delegateInsertionPoint); } } else { Debug.WriteLine("CodeDelegate " + element.Name + " null"); } break; case vsCMElement.vsCMElementEvent: MoveCodeBlock(codeElement, element, eventInsertionPoint); break; case vsCMElement.vsCMElementEnum: CodeEnum enumElement = element as CodeEnum; if (enumElement != null) { if (enumElement.Access == accessLevel) { MoveCodeBlock(codeElement, element, enumInsertionPoint); } } else { Debug.WriteLine("CodeEnum " + element.Name + " null"); } break; case vsCMElement.vsCMElementInterface: CodeInterface interfaceElement = element as CodeInterface; if (interfaceElement != null) { if (interfaceElement.Access == accessLevel) { MoveCodeBlock(codeElement, element, interfaceInsertionPoint); } } else { Debug.WriteLine("CodeInterface " + element.Name + " null"); } break; case vsCMElement.vsCMElementProperty: CodeProperty propertyElement = element as CodeProperty; if (propertyElement != null) { if (propertyElement.Access == accessLevel) { MoveCodeBlock(codeElement, element, propertyInsertionPoint); } } else { Debug.WriteLine("CodeProperty " + element.Name + " null"); } break; case vsCMElement.vsCMElementStruct: CodeStruct structElement = element as CodeStruct; if (structElement != null) { if (structElement.Access == accessLevel) { MoveCodeBlock(codeElement, element, structInsertionPoint); } } else { Debug.WriteLine("CodeStruct " + element.Name + " null"); } break; case vsCMElement.vsCMElementClass: CodeClass classElement = element as CodeClass; if (classElement != null) { if (classElement.Access == accessLevel) { MoveCodeBlock(codeElement, element, classInsertionPoint); } } else { Debug.WriteLine("CodeStruct " + element.Name + " null"); } break; default: Debug.WriteLine("unknown element: " + element.Name + " - " + element.Kind); break; } } for (int i = 1; i <= codeElement.Children.Count; i++) { CodeElement element = codeElement.Children.Item(i); if (element.Kind == vsCMElement.vsCMElementClass || element.Kind == vsCMElement.vsCMElementInterface || element.Kind == vsCMElement.vsCMElementStruct) { SortFunctionsWithinClass(element); } } } origin.DeleteWhitespace(vsWhitespaceOptions.vsWhitespaceOptionsVertical); classInsertionPoint.CreateEditPoint().DeleteWhitespace(vsWhitespaceOptions.vsWhitespaceOptionsVertical); } }
private static string GetEnumName(CodeEnum cc) { return(cc.Name); }
private TypeScriptEnumAttributeValues GetEnumValues(CodeEnum codeEnum, CodeAttribute interfaceAttribute) { var values = GetAttributeValues(interfaceAttribute); return new TypeScriptEnumAttributeValues { Name = values.ContainsKey("Name") ? values["Name"] : codeEnum.Name, Module = values.ContainsKey("Module") ? values["Module"] : Settings.DefaultModule ?? "T4TS", NamePrefix = values.ContainsKey("NamePrefix") ? values["NamePrefix"] : Settings.DefaultEnumNamePrefix ?? string.Empty }; }
public static ResultDto Suc(string msg = "操作成功", CodeEnum code = CodeEnum.Ok) { return(new ResultDto { Msg = msg, Code = code }); }
/// <summary> /// 范例 /// </summary> /// <param name="ce"></param> /// <returns></returns> public static CodeNameMap <CodeEnum, string, string> E2E(CodeEnum ce) { var result = TrainTicketStatusX.E2E(CodeEnum.Booking); return(result); }
private void ProcessCodeEnum(TypeContext typeContext, IDictionary <CodeEnum, TypeScriptEnum> tsEnumMap, IDictionary <string, TypeScriptModule> byModuleName, CodeEnum codeEnum) { EnumType enumType; if (typeContext.TryGetEnumType(codeEnum.FullName, out enumType)) { TypeScriptEnumAttributeValues values = enumType.AttributeValues; TypeScriptModule module; if (!byModuleName.TryGetValue(values.Module, out module)) { module = new TypeScriptModule { QualifiedName = values.Module }; byModuleName.Add(values.Module, module); } TypeScriptEnum tsEnum = BuildEnum(codeEnum, values, typeContext); tsEnumMap.Add(codeEnum, tsEnum); tsEnum.Module = module; module.Enums.Add(tsEnum); } }
public string GetEntityPreference(CodeEnum entityEnum) { object[] results = this.Invoke("GetEntityPreference", new object[] { entityEnum}); return ((string)(results[0])); }
public void createComponentBySectionList(CodeEnum codeName, List <Dictionary <CodeEnum, string> > list) { var mainSection = new Section(); switch (codeName) { case CodeEnum.PharmaceuticalInformation: foreach (var item in list) { var firstSection = new Section(); foreach (KeyValuePair <CodeEnum, string> kvp in item) { if (kvp.Key == CodeEnum.PharmaceuticalInformation) { if (mainSection.code == null) { mainSection = createSection(CodeEnum.PharmaceuticalInformation, kvp.Value, true, 0); } } else { switch (kvp.Key) { case CodeEnum.DrugSubstance: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; case CodeEnum.DrugProperName: case CodeEnum.ChemicalName: case CodeEnum.MolecularFormulaAndMolecularMass: case CodeEnum.StructuralformulaIncludingrelative: case CodeEnum.PhysicochemicalProperties: if (firstSection == null) { firstSection = createSection(CodeEnum.DrugSubstance, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); } if (firstSection != null && firstSection.subSectionList != null) { var secondSection = createSection(kvp.Key, kvp.Value, true, 2); firstSection.subSectionList.Add(secondSection); } break; default: firstSection = createSection(kvp.Key, kvp.Value, true, 1); mainSection.subSectionList.Add(firstSection); break; } } } } break; default: break; } if (mainSection != null) { comPlaceholder.CreateComponent(mainSection); saveXMLToSession(SessionHelper.current.saveForm); } }
/// <remarks/> public System.IAsyncResult BeginGetEntityPreference(CodeEnum entityEnum, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetEntityPreference", new object[] { entityEnum}, callback, asyncState); }
private void BuildCodeEnum(TypeContext typeContext, CodeEnum codeEnum, CodeClass owner = null) { if (codeEnum == null) return; CodeAttribute attribute; EnumType enumType = null; if (owner != null) { var tsType = typeContext.GetTypeScriptType(owner.FullName); if (tsType != null) enumType = new EnumType(codeEnum.Name); } if (TryGetAttribute(codeEnum.Attributes, EnumAttributeFullName, out attribute)) { var values = GetEnumValues(codeEnum, attribute); enumType = new EnumType(values); } if (enumType != null) { if (!typeContext.ContainsEnumType(codeEnum.FullName)) typeContext.AddEnumType(codeEnum.FullName, enumType); } }
public ParseAddressException(CodeEnum code, string message) : this(code, message, null) { }
/// <summary> /// Gets the declaration of the specified code enum as a string. /// </summary> /// <param name="codeEnum">The code enum.</param> /// <returns>The string declaration.</returns> internal static string GetEnumerationDeclaration(CodeEnum codeEnum) { // Get the start point after the attributes. var startPoint = codeEnum.GetStartPoint(vsCMPart.vsCMPartHeader); return TextDocumentHelper.GetTextToFirstMatch(startPoint, @"\{"); }
public ParseAddressException(CodeEnum code, string message, Exception innerException) : base(message, innerException) { Code = code; }
private static string GetNamespace(CodeEnum e) { return GetNamespace(e.Attributes); }
private TypeScriptEnum BuildEnum(CodeEnum codeEnum, TypeScriptEnumAttributeValues attributeValues, TypeContext typeContext) { var tsEnum = new TypeScriptEnum { FullName = codeEnum.FullName, Name = GetEnumName(attributeValues), Comment = codeEnum.Comment, DocComment = codeEnum.DocComment }; new EnumTraverser(codeEnum, (variable, index) => { TypeScriptEnumMember member; if (TryGetEnumMember(variable, typeContext, index, out member)) tsEnum.Members.Add(member); }); return tsEnum; }
private static string GetNamespace(CodeEnum cc) { return(GetDataContractName(cc, "Namespace") ?? GetNamespace(cc.Attributes)); }
private static string GetNamespace(CodeEnum cc) { return(GetNamespace(cc.Attributes)); }
private static string GetDataContractName(CodeEnum cc, string attrName) { IEnumerable <CodeAttribute> dataContractAttribute = cc.Attributes.Cast <CodeAttribute>().Where(a => a.Name == "DataContract"); return(GetDataContractNameInner(dataContractAttribute, attrName)); }
private string EnumToString(CodeEnum codeEnum) { try { string s = ""; for (int i = 1; i <= codeEnum.Members.Count; i++) { CodeElement c = codeEnum.Members.Item(i); s = s + c.Name; if (i != codeEnum.Members.Count) s = s + ", "; } return s; } catch(Exception e) { System.Diagnostics.Trace.WriteLine(e.Message, "AS VS Expert: EnumToString"); return ""; } }
private void ProcessCodeEnum(TypeContext typeContext, IDictionary<CodeEnum, TypeScriptEnum> tsEnumMap, IDictionary<string, TypeScriptModule> byModuleName, CodeEnum codeEnum) { EnumType enumType; if (typeContext.TryGetEnumType(codeEnum.FullName, out enumType)) { var values = enumType.AttributeValues; TypeScriptModule module; if (!byModuleName.TryGetValue(values.Module, out module)) { module = new TypeScriptModule { QualifiedName = values.Module }; byModuleName.Add(values.Module, module); } var tsEnum = BuildEnum(codeEnum, values, typeContext); tsEnumMap.Add(codeEnum, tsEnum); tsEnum.Module = module; module.Enums.Add(tsEnum); } }