| 
					
				 | 
			
			
				@@ -4,6 +4,7 @@ using UnityEngine; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using GFGEditor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using OfficeOpenXml; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace GFGEditor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -13,7 +14,7 @@ namespace GFGEditor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static void ReadExcel(RowCollectionHandler rowCollectionHandler) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            string[] files = Directory.GetFiles(ExcelConfig.excelsFolderPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string[] files = Directory.GetFiles(ExcelConfig.excelsCacheFolderPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int totalCount = files.Length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string strCfgArrayDispose = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string strCfgArrayInit = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -96,5 +97,165 @@ namespace GFGEditor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return configManagerName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public static void WriteExcle() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DeleteExcle(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string[] files = Directory.GetFiles(ExcelConfig.excelsFolderPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int totalCount = files.Length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = 0; i < totalCount; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string filePath = files[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string fileName = Path.GetFileNameWithoutExtension(filePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!fileName.Contains("~")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string newPath = ExcelConfig.excelsCacheFolderPath + fileName + ".xlsx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Stream newStream = new FileStream(newPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ExcelPackage newExcelPackage = new ExcelPackage(newStream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ExcelWorksheets newWorksheets = newExcelPackage.Workbook.Worksheets; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ExcelPackage excelPackage = new ExcelPackage(stream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ExcelWorksheets Worksheets = excelPackage.Workbook.Worksheets; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int j = 1; j <= Worksheets.Count; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ExcelWorksheet worksheet = Worksheets[j]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        string[] names = worksheet.Name.Split('_'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (names.Length < 2) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ExcelWorksheet newWorksheet = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (int k = 1; k <= newWorksheets.Count; k++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            string[] newNames = newWorksheets[k].Name.Split('_'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (names.Length < 2 || names.Length != newNames.Length) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (int h = 1; h < names.Length; h++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (newNames[h] == names[h]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    newWorksheet = newWorksheets[k]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    newWorksheet = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (newWorksheet == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            newWorksheets.Add(worksheet.Name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            newWorksheet = newWorksheets[newWorksheets.Count]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        WriteTitle(newWorksheet, worksheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // Debug.Log(worksheet.Name + "写入完成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newExcelPackage.Save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    excelPackage.Save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newStream.Close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stream.Close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newStream.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stream.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Debug.Log(fileName + "写入完成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private static void WriteTitle(ExcelWorksheet newWorksheet, ExcelWorksheet worksheet) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int newColumnNum = newWorksheet.Dimension == null ? 0 : newWorksheet.Dimension.End.Column; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int columnNum = worksheet.Dimension.End.Column; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = 1; i <= columnNum; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string name = worksheet.Cells[3, i].Text.Trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string type = worksheet.Cells[2, i].Text.Trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (name.Length == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bool needWriteColumn = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int j = 1; j <= newColumnNum; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string newName = newWorksheet.Cells[3, j].Text.Trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string newType = newWorksheet.Cells[2, i].Text.Trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (name == newName && type == newType) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        needWriteColumn = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (needWriteColumn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newColumnNum = newWorksheet.Dimension == null ? 0 : newWorksheet.Dimension.End.Column; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newWorksheet.InsertColumn(newColumnNum + 1, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int k = 1; k <= 4; k++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        newWorksheet.Cells[k, newColumnNum + 1].Value = worksheet.Cells[k, i].Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            WriteCell(newWorksheet, worksheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private static void WriteCell(ExcelWorksheet newWorksheet, ExcelWorksheet worksheet) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int newRowNum = newWorksheet.Dimension == null ? 0 : newWorksheet.Dimension.End.Row; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newWorksheet.InsertRow(newRowNum + 1, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int newColumnNum = newWorksheet.Dimension == null ? 0 : newWorksheet.Dimension.End.Column; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int rowNum = worksheet.Dimension.End.Row; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int columnNum = worksheet.Dimension.End.Column; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = 5; i <= rowNum; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newRowNum = newWorksheet.Dimension == null ? 0 : newWorksheet.Dimension.End.Row; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newWorksheet.InsertRow(newRowNum + 1, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int column = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int j = 1; j <= columnNum; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string title = worksheet.Cells[3, j].Text.Trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (string.IsNullOrEmpty(title)) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int k = column + 1; k <= newColumnNum; k++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        string newTitle = newWorksheet.Cells[3, k].Text.Trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (newTitle == title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            column = k; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newWorksheet.Cells[newRowNum + 1, column].Value = worksheet.Cells[i, j].Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newRowNum = newWorksheet.Dimension == null ? 0 : newWorksheet.Dimension.End.Row; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newWorksheet.InsertRow(newRowNum + 1, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private static void DeleteExcle() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string path = ExcelConfig.excelsCacheFolderPath; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (Directory.Exists(path) == false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ET.Log.Debug("Path is not Existed!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DirectoryInfo dir = new DirectoryInfo(path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // FileInfo[] files = dir.GetFiles(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string[] files = Directory.GetFiles(path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in files) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    File.Delete(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch (Exception) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ET.Log.Debug("Delete Failed!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |