private void UpdateNameDisplay() { string template = "Current Class:\n{0}"; string newName = currentClass.ToString(); string newText = string.Format(template, newName); displayName.text = newText; }
/// <summary> /// /// </summary> /// <param name="modelNamespace"></param> /// <param name="outputDirectory"></param> /// <param name="generateCustomFields">eg, TSA fields</param> public void GenerateModelsCode(string modelNamespace, string outputDirectory, bool generateCustomFields, bool generateUDC = false) { #region validate input if (modelNamespace == null || modelNamespace.Trim().Length == 0) { throw new PepperiException("Invalid argument. The model namespace can not be empty."); } bool directoryExists = Directory.Exists(outputDirectory); if (directoryExists == false) { throw new PepperiException("The directory " + outputDirectory == null ? "null" : outputDirectory + "does not exist."); } #endregion #region Generate Code Dictionary <string, string> fileName_To_ClassCode = new Dictionary <string, string>(); foreach (eModelClassName ClassName in Enum.GetValues(typeof(eModelClassName))) { IEnumerable <Field_MetaData> Fields_MetaData = GetFieldsMetadataByClassName(ClassName); List <string> HardCodedFields = ModelClassNameToHardCodedFields[ClassName]; string ClassNameAsString = ClassName.ToString(); string ClassCode = GenerateClassCode(modelNamespace, ClassNameAsString, Fields_MetaData, HardCodedFields, generateCustomFields); string FileName = ClassNameAsString + ".cs"; fileName_To_ClassCode.Add(FileName, ClassCode); } #region User Defined Collections if (generateUDC) { var userDefinedCollectionsCode = GenerateCodeForUserDefinedCollections(modelNamespace); fileName_To_ClassCode.Add("UserDefinedCollections.cs", userDefinedCollectionsCode); } #endregion #endregion #region Save Files foreach (string fileName in fileName_To_ClassCode.Keys) { string classCode = fileName_To_ClassCode[fileName]; SaveFile(outputDirectory, classCode, fileName); } #endregion }
/// <summary> /// Gets a string representation of the object /// </summary> /// <returns>Returns the full path to the class (namespace + class name)</returns> public override string ToString() { if (Type != null) { return(Type.FullName); } if (string.IsNullOrWhiteSpace(Namespace)) { return(ClassName.ToString()); } return($"{Namespace}.{ClassName}"); }
public string[] GetGroup() //Get User's Group List. { Array ClassList = this.user_Info.GetGroups().ToArray(); //Get group list and transfer it to be an array. int ClassCount = 0; //for loop function to count the class' number. string[] ClassGroup = new string[ClassCount]; //claim a string array with length. foreach (object ClassName in ClassList) { if (ClassName.ToString().Length == 4) //User's Class only have 4 word { Array.Resize(ref ClassGroup, ClassGroup.Length + 1); //extends the array length with copy itself before add new data. ClassGroup[ClassCount] = ClassName.ToString(); //add class data ClassCount++; } } ; return(ClassGroup); }
public override string ToString() { return(ClassName.ToString()); }
/// <summary> /// Saves the class. /// </summary> /// <returns>Class Object</returns> public Class SaveClass() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_Class"; command.Parameters.Add(dbconn.GenerateParameterObj("@ClassID", SqlDbType.Int, ClassID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ClassName", SqlDbType.VarChar, ClassName.ToString(), 1000)); command.Parameters.Add(dbconn.GenerateParameterObj("@IsPrestige", SqlDbType.Bit, IsPrestige.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@StartingSkills", SqlDbType.Int, StartingSkills.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@HitDieType", SqlDbType.Int, HitDieType.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@StartCreditDie", SqlDbType.Int, StartCreditDie.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@StartCreditDieNumber", SqlDbType.Int, StartCreditDieNumber.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@StartingSkillNumber", SqlDbType.Int, StartingSkillNumber.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@StartCreditDieModifier", SqlDbType.Int, StartCreditDieModifier.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@PrestigeRequiredTalents", SqlDbType.Int, PrestigeRequiredTalents.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@PrestigeRequiredForceTech", SqlDbType.Int, PrestigeRequiredForceTech.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@PrestigeRequiredDarkside", SqlDbType.Int, PrestigeRequiredDarkside.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@PrestigeRequiredFeats", SqlDbType.Int, PrestigeRequiredFeats.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@PrestigeRequiredBaseAttack", SqlDbType.Int, PrestigeRequiredBaseAttack.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@PrestigeRequiredLevel", SqlDbType.Int, PrestigeRequiredLevel.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }