private void writeToFile(PartData partData, string data) { if (partData != default) { string fileName = partData.id; List <string> stringList = new List <string>(); FieldInfo[] fieldInfoList = partData.GetType().GetFields(); foreach (FieldInfo fieldInfo in fieldInfoList) { if (fieldInfo.GetValue(partData) is string) { stringList.Add(fieldInfo.GetValue(partData).ToString()); } } string encryptionString = getEncryptionString(stringList); char encryptionCharacter = getEncryptionCharacter(encryptionString); int encryptionValue = getEncryptionValue(encryptionCharacter); encryptAndWrite(fileName, encryptionCharacter, encryptionValue, data); } }