public static void getExportProperty(PropertyInfo property, object classObj, ref XmlTextWriter writer, ref List <string> loadImageList, ref List <ExportItem> exportImageList, string envCutDir) { MethodInfo getMethod = property.GetGetMethod(); Type returnType = getMethod.ReturnType; if (MainForm.m_mainForm.m_package == Package.Normal) { if (property.GetCustomAttributes(typeof(PkgNormalHideAttribute), true).Length != 0) { return; } } else if (Package.VitaPreInstall == MainForm.m_mainForm.m_package && property.GetCustomAttributes(typeof(PkgVitaPreInstallHideAttribute), true).Length != 0) { return; } if (typeof(string) == returnType) { string text = (string)getMethod.Invoke(classObj, null); if (text == null) { return; } if (property.GetCustomAttributes(typeof(FilePathAttribute), true).Length != 0) { string fullPath = Path.Combine(envCutDir, text); fullPath = Path.GetFullPath(fullPath); ExportItem exportItem = new ExportItem(); exportItem.m_exportFile = Path.GetFileName(fullPath); if (loadImageList.Exists((string x) => fullPath == x)) { int index = loadImageList.IndexOf(fullPath); if (property.GetCustomAttributes(typeof(ThumbnailAttribute), true).Length != 0 && string.IsNullOrEmpty(exportImageList[index].m_exportThumbnailFile)) { exportImageList[index].m_exportThumbnailFile = getThumbnailFilePath(ref exportImageList, exportImageList[index].m_exportFile); } exportItem = exportImageList[index]; } else { int num = loadImageList.Count + 1; while (exportImageList.Exists((ExportItem x) => exportItem.m_exportFile == x.m_exportFile || exportItem.m_exportFile == x.m_exportThumbnailFile)) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(exportItem.m_exportFile); string extension = Path.GetExtension(exportItem.m_exportFile); exportItem.m_exportFile = fileNameWithoutExtension + num + extension; } if (property.GetCustomAttributes(typeof(ThumbnailAttribute), true).Length != 0) { exportItem.m_exportThumbnailFile = getThumbnailFilePath(ref exportImageList, exportItem.m_exportFile); } if (checkFilepathLength(property, classObj, exportItem)) { loadImageList.Add(fullPath); exportImageList.Add(exportItem); } } text = exportItem.m_exportFile; if (property.GetCustomAttributes(typeof(ThumbnailAttribute), true).Length != 0) { writer.WriteElementString("m_thumbnailFilePath", exportItem.m_exportThumbnailFile); } } writer.WriteElementString(property.Name, text); } else if (typeof(int) == returnType) { int num2 = (int)getMethod.Invoke(classObj, null); if (0 <= num2) { writer.WriteElementString(property.Name, getMethod.Invoke(classObj, null).ToString()); } } else if (typeof(Color) == returnType) { writer.WriteElementString(property.Name, ((Color)getMethod.Invoke(classObj, null)).ToArgb().ToString("x8")); } else if (returnType.IsEnum) { int num3 = (int)getMethod.Invoke(classObj, null); if (property.GetCustomAttributes(typeof(WaveAttribute), true).Length != 0) { num3 = (int)BackgroundParam.s_nativeWaveType[num3]; } writer.WriteElementString(property.Name, num3.ToString()); } else if (returnType.IsArray) { Array array = (Array)getMethod.Invoke(classObj, null); writer.WriteStartElement(property.Name); foreach (object item in array) { getExportClass(item, ref writer, ref loadImageList, ref exportImageList, envCutDir); } writer.WriteEndElement(); } else if (returnType.IsClass) { object classObj2 = getMethod.Invoke(classObj, null); writer.WriteStartElement(property.Name); getInternalExportClass(classObj2, ref writer, ref loadImageList, ref exportImageList, envCutDir); writer.WriteEndElement(); } }
public static bool checkFilepathLength(PropertyInfo property, object classObj, ExportItem exportItem) { bool result = true; string text = string.Empty; object[] customAttributes = property.GetCustomAttributes(typeof(PropertyCategoryAttribute), false); if (0 < customAttributes.Length) { PropertyCategoryAttribute propertyCategoryAttribute = customAttributes[0] as PropertyCategoryAttribute; if (!string.IsNullOrEmpty(propertyCategoryAttribute.PropertyCategory)) { text = text + "[" + propertyCategoryAttribute.PropertyCategory + "] -> "; } } customAttributes = property.GetCustomAttributes(typeof(PropertyDisplayNameAttribute), false); if (0 < customAttributes.Length) { PropertyDisplayNameAttribute propertyDisplayNameAttribute = customAttributes[0] as PropertyDisplayNameAttribute; if (!string.IsNullOrEmpty(propertyDisplayNameAttribute.PropertyDisplayName)) { text = text + "[" + propertyDisplayNameAttribute.PropertyDisplayName + "] : "; } } else { text = text + "[" + property.Name + "] : "; } switch (property.Name) { case "m_bgmFilePath": case "m_imageFilePath": case "m_filePath": case "m_iconFilePath": if (32 < exportItem.m_exportFile.Length) { result = false; text = text + "\"" + exportItem.m_exportFile + "\""; text += "\n"; text += ErrorMsg.GetString(ErrorMsg.DEFINES.OVER_PATH_LENGTH); object obj = text; text = string.Concat(obj, " ", exportItem.m_exportFile.Length.ToString(), "/", 32, "(chars)\n"); Dialog.AddMsg(text); } if (!string.IsNullOrEmpty(exportItem.m_exportThumbnailFile) && 32 < exportItem.m_exportThumbnailFile.Length) { result = false; text = text + "\"" + exportItem.m_exportThumbnailFile + "\""; text += "\n"; text += ErrorMsg.GetString(ErrorMsg.DEFINES.OVER_PATH_LENGTH); object obj2 = text; text = string.Concat(obj2, " ", exportItem.m_exportThumbnailFile.Length.ToString(), "/", 32, "(chars)\n"); Dialog.AddMsg(text); } break; } return(result); }