// Respond to mouse wheel over a control private void Text_MouseWheel(object sender, MouseEventArgs e) { TextBox t = (TextBox)sender; // Tag contains control number and attribute byte n = ((byte[])t.Tag)[0]; ClassCode cc = (ClassCode)((byte[])t.Tag)[1]; byte at = ((byte[])t.Tag)[2]; AttrData attr = EIP.AttrDict[cc, at]; // Only decimal values are allowed. Set to Min if in error int len = attr.Data.Len; if (!long.TryParse(t.Text, out long val)) { val = attr.Set.Min; } if (e.Delta > 0) { val = Math.Min(val + 1, attr.Set.Max); } else { val = Math.Max(val - 1, attr.Set.Min); } t.Text = val.ToString(); t.BackColor = Color.LightYellow; }
public ClassCode Generate(XamlDocument document) { var result = new ClassCode { Name = document.Name, CodeBlocks = new List <Code>(), UsingNamespaces = new List <string>(), Namespace = document.Namespace }; IEnumerable <XElement> children = document.Elements; foreach (var child in children) { string name = child.Name.LocalName; switch (name) { case "Members": result.CodeBlocks.AddRange(GetProperties(child)); break; case "TextExpression.NamespacesForImplementation": result.UsingNamespaces.AddRange(GetNamespaces(child)); break; case "Sequence": result.CodeBlocks.Add(methodGenerator.Generate(child)); break; } } customMethodAlocator.Allocate(result.CodeBlocks); return(result); }
private void AddCode(StringBuilder sb) { foreach (var c in ClassCode.Split('\n')) { sb.AppendLine(c.Contains("\t") || c.Contains(" ") ? $"\t{c}" : $"\t\t{c}"); } }
static void Main(string[] args) { ClassCode classCode1 = new ClassCode(); classCode1.GetHashCode(); System.Console.WriteLine(classCode1.GetHashCode()); Car car1 = new Car(); Car car2 = new Car(); System.Console.WriteLine(car1.GetHashCode()); System.Console.WriteLine(car2.GetHashCode()); car1.Go(); car2.Go(); Car car3 = new Car(); car3.Go(); System.Console.WriteLine(car1); // Static memory ClassOne.Hi(); // Instance memory // ClassTwo.Hi(); // Can NOT use ClassTwo two = new ClassTwo(); two.Hi(); }
private static IEnumerable <Account> CreateAccounts(IEnumerable <Customer> customers, AccountType[] types, ClassCode[] classCodes, Currency[] currencies) { const int seed = 42; Random r = new Random(seed); //reusable List <Account> accounts = new List <Account>(); foreach (var c in customers) { for (int i = 0; i < 1 + r.Next(5); i++) { AccountType accountType = types[r.Next(3)]; ClassCode classCode = classCodes[r.Next(classCodes.Length)]; accounts.Add(new Account() { CustomerId = c.Id, Balance = (decimal)((2000 * r.Next(1, 5)) + (1000 * r.NextDouble())), CurrencyISO = currencies[r.Next(currencies.Length)].ISO, AccountType = accountType.Type, ClassCode = classCode.Code, }); } } return(accounts); }
public string Convert(string workflowXaml) { XamlDocument document = xamlParser.Parse(workflowXaml); ClassCode classCode = classGenerator.Generate(document); return(classCodeToCSharp.Convert(classCode)); }
// Update the printer with the value of an Extra control private void SetExtras_Click(object sender, EventArgs e) { Button b = (Button)sender; // Tag contains control number and attribute byte n = ((byte[])b.Tag)[0]; ClassCode cc = (ClassCode)((byte[])b.Tag)[1]; byte at = ((byte[])b.Tag)[2]; AttrData attr = EIP.AttrDict[cc, at]; // Only decimal values are allowed. Set to Min if in error int len = attr.Set.Len; if (!int.TryParse(ExtraText[n].Text, out int val)) { val = (int)attr.Set.Min; } // Write the value to the printer byte[] data = EIP.FormatOutput(attr.Set, val); if (EIP.SetAttribute(cc, attr.Val, data)) { // It worked, set normal on the control and update the full display ExtraText[n].BackColor = Color.LightGreen; GetAll_Click(null, null); } SetButtonEnables(); }
protected override void Save() { dgv.EndEdit(); if (!IsValid(dgv)) { MsgBox.Show("請先修正錯誤"); return; } List <ClassCode> newList = new List <ClassCode>(); foreach (DataGridViewRow row in dgv.Rows) { if (row.IsNewRow) { continue; } ClassCode cc = new ClassCode(); cc.ClassName = "" + row.Cells[chClassName.Index].Value; cc.Code = "" + row.Cells[chCode.Index].Value; newList.Add(cc); } _accessHelper.DeletedValues(_list.ToArray()); _accessHelper.InsertValues(newList.ToArray()); ClassCodeMapper.Instance.Reload(); this.DialogResult = DialogResult.OK; }
public TP145214GB01_DocumentParticipantUniversal(ClassCode classCode) : base() { string classCodeString = StringEnum.GetStringValue(classCode); ParticipationRole = new r_associatedEntity(classCodeString); ParticipationRole.templateId = TEMPLATEID; ParticipationRole.templateText = TEMPLATETEXT; }
/// <summary> /// Initialize a new message /// </summary> /// <param name="severity">The severity of the message</param> /// <param name="elementClass">The corresponding element class</param> /// <param name="elementId">The corresponding element ID</param> /// <param name="message">A message</param> /// <param name="commandDescription">The command description (optional), typically the output of the <code>ToString()</code> method for the command</param> public Message(Severity severity, ClassCode elementClass, int elementId, string message, string commandDescription) { Severity = severity; ElementClass = elementClass; ElementId = elementId; Text = message; CommandDescription = commandDescription; }
public void Generate() { NamespaceCode orCreateNamespace = this._codeGenerationContext.FindOrCreateNamespace(this.DefaultNamespace); ClassCode classCode = new ClassCode(); classCode.AccessModifier = ClassCodeAccessModifier.Internal; classCode.Name = "AutoGeneratedSaveManager"; classCode.AddInterface("global::TaleWorlds.SaveSystem.Definition.IAutoGeneratedSaveManager"); MethodCode methodCode = new MethodCode(); methodCode.IsStatic = false; methodCode.AccessModifier = MethodCodeAccessModifier.Public; methodCode.Name = "Initialize"; methodCode.MethodSignature = "(global::TaleWorlds.SaveSystem.Definition.DefinitionContext definitionContext)"; classCode.AddMethod(methodCode); this._managerMethod = methodCode; this._managerClass = classCode; ClassCode clasCode = classCode; orCreateNamespace.AddClass(clasCode); foreach (TypeDefinition definition in this._definitions) { this.GenerateForClassOrStruct(definition); } foreach (TypeDefinition structDefinition in this._structDefinitions) { this.GenerateForClassOrStruct(structDefinition); } foreach (ContainerDefinition containerDefinition in this._containerDefinitions) { ContainerType containerType; if (containerDefinition.Type.IsContainer(out containerType)) { switch (containerType) { case ContainerType.List: this.GenerateForList(containerDefinition); continue; case ContainerType.Dictionary: this.GenerateForDictionary(containerDefinition); continue; case ContainerType.Array: this.GenerateForArray(containerDefinition); continue; case ContainerType.Queue: this.GenerateForQueue(containerDefinition); continue; default: continue; } } } }
public string Convert(ClassCode classCode) { var writer = new StringWriter(); fieldManager.ParseAndInitialize(classCode.CodeBlocks); WriteUsingNamespaces(writer, classCode.UsingNamespaces); WriteClass(writer, classCode); return(writer.ToString()); }
public MethodCode(ClassCode prnt, string methodName) { if (string.IsNullOrEmpty(methodName)) { throw new ArgumentNullException(nameof(methodName)); } parent = prnt ?? throw new ArgumentNullException(nameof(prnt)); name = methodName; }
static void Main() { //[2] 특정 클래스로부터 objectCode1, objectCode2 이름의 개체(Object) 만들기 ClassCode objectCode1 = new ClassCode(); Console.WriteLine(objectCode1.GetHashCode()); var objectCode2 = new ClassCode(); Console.WriteLine(objectCode2.GetHashCode()); }
private void WriteClass(StringWriter writer, ClassCode classCode) { writer.WriteLine(); writer.WriteLine("namespace " + classCode.Namespace); writer.WriteLine("{"); writer.WriteLineTabs("public class " + classCode.Name, 1); writer.WriteLineTabs("{", 1); WriteCodeBlocks(writer, classCode.CodeBlocks, 2); writer.WriteLineTabs("}", 1); writer.WriteLine("}"); }
public override bool Equals(Object other) { if (other == null) { return(false); } if (other is Class Class) { return(Id.Equals(Class.Id) && ClassCode.Equals(Class.ClassCode)); } return(false); }
/// <summary> /// A factory method to create a new instance of an /// <c>AuthzCredentialGenerator</c> /// for the given <c>ClassCode</c>. Caller /// is supposed to invoke /// <see cref="AuthzCredentialGenerator.init"/> immediately /// after obtaining the instance. /// </summary> /// <param name="classCode"> /// the <c>ClassCode</c> of the <c>AuthzCredentialGenerator</c> /// implementation /// </param> /// <returns> /// an instance of <c>AuthzCredentialGenerator</c> for /// the given class code /// </returns> public static AuthzCredentialGenerator Create(ClassCode classCode) { switch (classCode) { case ClassCode.Dummy: //return new DummyAuthzCredentialGenerator(); return(null); case ClassCode.XML: return(new XmlAuthzCredentialGenerator()); } return(null); }
public async Task <ActionResult> ChangeCode() { var thisClass = db.EClasses.Find(Convert.ToInt32(Session["eClassId"])); string newCode; do { newCode = new ClassCode().GetNewCode(); } while (await CodeUsed(newCode)); thisClass.code = newCode; db.Entry(thisClass).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Details", new { id = Convert.ToInt32(Session["eClassId"]) })); }
public override int GetHashCode() { unchecked { var hashCode = ProgrammeNo; hashCode = (hashCode * 397) ^ EpisodeNo; hashCode = (hashCode * 397) ^ SalesAreaNo; hashCode = (hashCode * 397) ^ TregNo; hashCode = (hashCode * 397) ^ (TxDate != null ? TxDate.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ScheduledStartTime != null ? ScheduledStartTime.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ScheduledEndTime != null ? ScheduledEndTime.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ProgCategoryNo; hashCode = (hashCode * 397) ^ (ClassCode != null ? ClassCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LiveBroadcast != null ? LiveBroadcast.GetHashCode() : 0); return(hashCode); } }
public Attributes(Browser parent, EIP EIP, TabPage tab, ClassCode cc, int Extras = 0) { this.parent = parent; this.EIP = EIP; this.tab = tab; this.cc = cc; this.ccAttribute = ((t1[])typeof(t1).GetEnumValues()).Select(x => Convert.ToByte(x)).ToArray(); this.Extras = Extras; extrasUsed = AddExtraControls(); BuildControls(); // Substitution has extra controls if (cc == ClassCode.Substitution_rules) { // Assumes only one extra control Substitution = new Substitution(parent, EIP, tab); Substitution.BuildControls(); } // UserPattern has extra controls if (cc == ClassCode.User_pattern) { UserPattern = new UserPattern(parent, EIP, tab); UserPattern.BuildControls(); } // IJP operation has extra controls if (cc == ClassCode.IJP_operation) { Errors = new Errors(parent, EIP, tab); Errors.BuildControls(); } // Print data management has extra controls if (cc == ClassCode.Print_data_management) { PrintManagement = new PrintManagement(parent, EIP, tab); PrintManagement.BuildControls(); } }
public void DeriveFareDesc() { switch (ClassCode.ToUpper()) { case "EK": ClassDesc = "Economy"; break; case "BS": ClassDesc = "Business"; break; case "FR": ClassDesc = "First Class"; break; default: break; } }
/// <summary> /// A factory method to create a new instance of a /// <c>CredentialGenerator</c> for the given <c>ClassCode</c>. Caller is /// supposed to invoke <see cref="CredentialGenerator.init"/> immediately /// after obtaining the instance. /// </summary> /// <param name="classCode"> /// the <c>ClassCode</c> of the <c>CredentialGenerator</c> implementation /// </param> /// <returns> /// an instance of <c>CredentialGenerator</c> for the given class code /// </returns> public static CredentialGenerator Create(ClassCode classCode, bool isMultiUser) { switch (classCode) { case ClassCode.None: return(null); case ClassCode.Dummy: // return new DummyCredentialGenerator(); return(null); case ClassCode.LDAP: return(new LDAPCredentialGenerator()); case ClassCode.SSL: // return new SSLCredentialGenerator(); return(null); } return(null); }
public override IClassCode ToModel() { var model = new ClassCode { Id = Id, Code = Code, Description = Description, IsGeneralInclusion = IsGeneralInclusion, ClientId = Clientid, State = State == null ? State : State.TrimEnd(), ExposureBasis = (ExposureBasisEnum)ExposureBasis, AuditType = (AuditTypeEnum)AuditTypeId, CreatedOn = CreatedOn, CreatedById = CreatedById, LastModifiedOn = LastModifiedOn, LastModifiedById = LastModifiedById }; return(model); }
public async Task <ActionResult> Create([Bind(Include = "ID,EClassName,year,grade,UserID,description")] EClass eClass) { if (ModelState.IsValid) { Course newCourse = db.Courses.Find(Convert.ToInt32(Session["courseId"])); eClass.course = db.Courses.Find(Convert.ToInt32(Session["courseId"])); string newCode; do { newCode = new ClassCode().GetNewCode(); } while (await CodeUsed(newCode)); eClass.code = newCode; db.EClasses.Add(eClass); await db.SaveChangesAsync(); return(RedirectToAction("Index", new { courseId = eClass.course.ID })); } return(View(eClass)); }
private ClassCode ParseFileContent(string fileName, List<string> fileContent) { ClassCode code = new ClassCode(fileName); bool fileKeyWordRead = false; bool insideComment = false; foreach (string line in fileContent) { string trimmedLine = line.Trim(); if (insideComment) { if (trimmedLine.Contains(END_COMMENT)) { insideComment = false; string remainingCode = trimmedLine.Substring(trimmedLine.IndexOf(END_COMMENT) + END_COMMENT.Length); if (!string.IsNullOrEmpty(remainingCode.Trim())) { fileKeyWordRead = addLineToCode(code, fileKeyWordRead, remainingCode); } } // We can skip comments since generated file size might be // limited } else if (string.IsNullOrEmpty(trimmedLine)) { // We don't need empty lines } else if (trimmedLine.StartsWith("//")) { // We can skip comments since generated file size might be // limited } else if (trimmedLine.StartsWith("#region")) { // We can skip comments since generated file size might be // limited } else if (trimmedLine.StartsWith("#endregion")) { // We can skip comments since generated file size might be // limited } else if (trimmedLine.StartsWith("/*")) { // We can skip comments since generated file size might be // limited if (!trimmedLine.Contains(END_COMMENT)) { insideComment = true; } } else { fileKeyWordRead = addLineToCode(code, fileKeyWordRead, line); } } //Remove closing brace from namespace declaration if (code.HasNamespace) { code.afterClassContent.RemoveAt(code.afterClassContent.Count - 1); } return code; }
/// <summary> /// This part differs from the java version. Since C# won't let you import individual /// classfiles, we pull the whole namespace. /// All files of a namespace are assumed to be in a folder named for the namespace. All /// .cs files in that folder will be imported. /// TODO: Code parsing to only grab the classfiles that are needed? /// </summary> /// <param name="code"></param> /// <param name="directoryName"></param> private void addDirectory(ClassCode code, string directoryName) { Console.Error.WriteLine("addDirectory {0}", directoryName); foreach (string fileName in Directory.GetFiles(directoryName).Where(e => e.EndsWith(".cs"))) { var className = Path.GetFileNameWithoutExtension(fileName); Console.Error.WriteLine("className {0}", className); if (!innerClasses.Keys.Contains(className)) { Console.WriteLine("Adding {0}", fileName); innerClasses.Add(className, processFile(fileName)); } } }
private void write(ClassCode treated) { string className = treated.className.Split()[0]; string outputFile = rootDirectory + @"\\upload\\" + className + ".cs"; List<string> lines = new List<string>(); lines.AddRange(imports); foreach (string line in treated.beforeClassContent) { lines.Add(line); } lines.Add("class " + treated.className + " {"); foreach (ClassCode innerClass in innerClasses.Values) { foreach (string line in innerClass.beforeClassContent) { lines.Add("\t" + line); } lines.Add("\t" + innerClass.declaration() + " {"); foreach (string line in innerClass.afterClassContent) { lines.Add(line); } } foreach (string line in treated.afterClassContent) { lines.Add(line); } try { Console.WriteLine("Writing output file {0}", outputFile); File.WriteAllLines(outputFile, lines); } catch (IOException e) { Console.Error.WriteLine(e.StackTrace); } }
public override int GetHashCode() { return(ClassGroupCode.GetHashCode() ^ ClassCode.GetHashCode() ^ InstanceCode.GetHashCode()); }
public override int GetHashCode() { return(Id.GetHashCode() ^ ClassCode.GetHashCode()); }
private void GenerateForClassOrStruct(TypeDefinition typeDefinition) { Type type1 = typeDefinition.Type; bool isClass = type1.IsClass; bool flag1 = !isClass; bool flag2 = this.CheckIfBaseTypeDefind(type1); string name1 = type1.Namespace; string str1 = type1.FullName.Replace('+', '.'); string fullClassName = str1.Substring(name1.Length + 1, str1.Length - name1.Length - 1).Replace('+', '.'); string[] nestedClasses = this.GetNestedClasses(fullClassName); NamespaceCode orCreateNamespace = this._codeGenerationContext.FindOrCreateNamespace(name1); string str2 = nestedClasses[nestedClasses.Length - 1]; ClassCode classCode = (ClassCode)null; for (int index = 0; index < nestedClasses.Length; ++index) { string className = nestedClasses[index]; ClassCode clasCode = new ClassCode(); clasCode.IsPartial = true; if (index + 1 == nestedClasses.Length) { clasCode.IsClass = isClass; } clasCode.AccessModifier = ClassCodeAccessModifier.DoNotMention; int genericInformation = this.GetClassGenericInformation(className); if (genericInformation >= 0) { clasCode.IsGeneric = true; clasCode.GenericTypeCount = genericInformation; className = className.Substring(0, className.Length - 2); } clasCode.Name = className; if (classCode != null) { classCode.AddNestedClass(clasCode); } else { orCreateNamespace.AddClass(clasCode); } classCode = clasCode; } TypeSaveId saveId = (TypeSaveId)typeDefinition.SaveId; int delegateCount = this._delegateCount; ++this._delegateCount; this._managerMethod.AddLine("var typeDefinition" + (object)delegateCount + " = (global::TaleWorlds.SaveSystem.Definition.TypeDefinition)definitionContext.TryGetTypeDefinition(new global::TaleWorlds.SaveSystem.Definition.TypeSaveId(" + (object)saveId.Id + "));"); if (!type1.IsGenericTypeDefinition && !type1.IsAbstract) { MethodCode methodCode = new MethodCode(); methodCode.IsStatic = true; methodCode.AccessModifier = flag1 ? MethodCodeAccessModifier.Public : MethodCodeAccessModifier.Internal; methodCode.Name = "AutoGeneratedStaticCollectObjects" + str2; methodCode.MethodSignature = "(object o, global::System.Collections.Generic.List<object> collectedObjects)"; methodCode.AddLine("var target = (global::" + str1 + ")o;"); methodCode.AddLine("target.AutoGeneratedInstanceCollectObjects(collectedObjects);"); classCode.AddMethod(methodCode); this._managerMethod.AddLine("TaleWorlds.SaveSystem.Definition.CollectObjectsDelegate d" + (object)delegateCount + " = global::" + name1 + "." + fullClassName + "." + methodCode.Name + ";"); this._managerMethod.AddLine(nameof(typeDefinition) + (object)delegateCount + ".InitializeForAutoGeneration(d" + (object)delegateCount + ");"); } this._managerMethod.AddLine(""); MethodCode methodCode1 = new MethodCode(); if (flag2) { methodCode1.PolymorphismInfo = MethodCodePolymorphismInfo.Override; methodCode1.AccessModifier = MethodCodeAccessModifier.Protected; } else if (!type1.IsSealed) { methodCode1.PolymorphismInfo = MethodCodePolymorphismInfo.Virtual; methodCode1.AccessModifier = MethodCodeAccessModifier.Protected; } else { methodCode1.PolymorphismInfo = MethodCodePolymorphismInfo.None; methodCode1.AccessModifier = MethodCodeAccessModifier.Private; } methodCode1.Name = "AutoGeneratedInstanceCollectObjects"; methodCode1.MethodSignature = "(global::System.Collections.Generic.List<object> collectedObjects)"; if (flag2) { methodCode1.AddLine("base.AutoGeneratedInstanceCollectObjects(collectedObjects);"); methodCode1.AddLine(""); } foreach (MemberDefinition memberDefinition in typeDefinition.MemberDefinitions) { if (memberDefinition is FieldDefinition) { FieldInfo fieldInfo = (memberDefinition as FieldDefinition).FieldInfo; Type fieldType = fieldInfo.FieldType; string name2 = fieldInfo.Name; if (fieldType.IsClass || fieldType.IsInterface) { if (fieldType != typeof(string)) { bool flag3 = false; Type declaringType = fieldInfo.DeclaringType; if (declaringType != type1) { flag3 = this.CheckIfTypeDefined(declaringType); } string str3 = ""; if (flag3) { str3 += "//"; } string line = str3 + "collectedObjects.Add(this." + name2 + ");"; methodCode1.AddLine(line); } } else if (!fieldType.IsClass && this._definitionContext.GetStructDefinition(fieldType) != null) { string str3 = ""; bool flag3 = false; Type declaringType = fieldInfo.DeclaringType; if (declaringType != type1) { flag3 = this.CheckIfTypeDefined(declaringType); } if (flag3) { str3 += "//"; } string str4 = fieldType.FullName.Replace('+', '.'); string line = str3 + "global::" + str4 + ".AutoGeneratedStaticCollectObjects" + fieldType.Name + "(this." + name2 + ", collectedObjects);"; methodCode1.AddLine(line); } } } methodCode1.AddLine(""); foreach (MemberDefinition memberDefinition in typeDefinition.MemberDefinitions) { if (memberDefinition is PropertyDefinition) { PropertyDefinition propertyDefinition = memberDefinition as PropertyDefinition; PropertyInfo propertyInfo = propertyDefinition.PropertyInfo; Type propertyType = propertyDefinition.PropertyInfo.PropertyType; string name2 = propertyInfo.Name; if (propertyType.IsClass || propertyType.IsInterface) { if (propertyType != typeof(string)) { bool flag3 = false; Type declaringType = propertyInfo.DeclaringType; if (declaringType != type1) { flag3 = this.CheckIfTypeDefined(declaringType); } string str3 = ""; if (flag3) { str3 += "//"; } string line = str3 + "collectedObjects.Add(this." + name2 + ");"; methodCode1.AddLine(line); } } else if (!propertyType.IsClass && this._definitionContext.GetStructDefinition(propertyType) != null) { bool flag3 = false; Type declaringType = propertyInfo.DeclaringType; if (declaringType != type1) { flag3 = this.CheckIfTypeDefined(declaringType); } string str3 = ""; if (flag3) { str3 += "//"; } string str4 = propertyType.FullName.Replace('+', '.'); string line = str3 + "global::" + str4 + ".AutoGeneratedStaticCollectObjects" + propertyType.Name + "(this." + name2 + ", collectedObjects);"; methodCode1.AddLine(line); } } } classCode.AddMethod(methodCode1); foreach (MemberDefinition memberDefinition in typeDefinition.MemberDefinitions) { if (!type1.IsGenericTypeDefinition) { MethodCode methodCode2 = new MethodCode(); string str3 = ""; Type type2 = (Type)null; switch (memberDefinition) { case PropertyDefinition _: PropertyDefinition propertyDefinition = memberDefinition as PropertyDefinition; str3 = propertyDefinition.PropertyInfo.Name; type2 = propertyDefinition.PropertyInfo.DeclaringType; break; case FieldDefinition _: FieldDefinition fieldDefinition = memberDefinition as FieldDefinition; str3 = fieldDefinition.FieldInfo.Name; type2 = fieldDefinition.FieldInfo.DeclaringType; break; } bool flag3 = false; if (type2 != type1) { flag3 = this.CheckIfTypeDefined(type2); } if (!flag3) { methodCode2.Name = "AutoGeneratedGetMemberValue" + str3; methodCode2.MethodSignature = "(object o)"; methodCode2.IsStatic = true; methodCode2.AccessModifier = MethodCodeAccessModifier.Internal; methodCode2.PolymorphismInfo = MethodCodePolymorphismInfo.None; methodCode2.ReturnParameter = "object"; methodCode2.AddLine("var target = (global::" + str1 + ")o;"); methodCode2.AddLine("return (object)target." + str3 + ";"); classCode.AddMethod(methodCode2); string str4 = "GetPropertyDefinitionWithId"; if (memberDefinition is FieldDefinition) { str4 = "GetFieldDefinitionWithId"; } this._managerMethod.AddLine("{"); this._managerMethod.AddLine("var memberDefinition = typeDefinition" + (object)delegateCount + "." + str4 + "(new global::TaleWorlds.SaveSystem.Definition.MemberTypeId(" + (object)memberDefinition.Id.TypeLevel + "," + (object)memberDefinition.Id.LocalSaveId + "));"); this._managerMethod.AddLine("memberDefinition.InitializeForAutoGeneration(" + ("global::" + name1 + "." + fullClassName + "." + methodCode2.Name) + ");"); this._managerMethod.AddLine("}"); this._managerMethod.AddLine(""); } } } }
private bool addLineToCode(ClassCode code, bool fileKeyWordRead, string line) { if (line.StartsWith("namespace ")) { code.HasNamespace = true; } else if (line.StartsWith("using ")) { string importedClassPath = importToPath(line); Console.WriteLine("Looking for {0}", importedClassPath); if (!knownFiles.Contains(importedClassPath)) { if (Directory.Exists(importedClassPath)) { addDirectory(code, importedClassPath); } else { Console.WriteLine("Standard import:" + line); imports.Add(line); } } } else { if (fileKeyWordRead) { code.afterClassContent.Add(line); } else { if (line.Contains("class ")) { code.declaration(line, "class "); fileKeyWordRead = true; } else if (line.Contains("interface ")) { code.declaration(line, "interface "); fileKeyWordRead = true; } else if (line.Contains("enum ")) { code.declaration(line, "enum "); fileKeyWordRead = true; } else if (line.Contains("struct ")) { code.declaration(line, "struct "); fileKeyWordRead = true; } else { code.beforeClassContent.Add(line); } } } return fileKeyWordRead; }
public override int GetHashCode() => Id + ((ClassCode?.GetHashCode() * 17) + ClassName?.GetHashCode()).GetValueOrDefault();
protected Command(CommandConstructorArguments arguments) { _elementClass = arguments.ElementClass; _elementId = arguments.ElementId; _container = arguments.Container; }
public Instrument(ClassCode classCode, Ticker ticker) { ClassCode = classCode; Ticker = ticker }