From 17ff1d8649a4d23f5269706eafb531d4220a71dd Mon Sep 17 00:00:00 2001 From: leonard Wu <364452445@qq.com> Date: 星期二, 07 八月 2018 14:06:01 +0800 Subject: [PATCH] 初始化版本库 --- Assets/Editor/Tool/TableTool.cs | 904 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 452 insertions(+), 452 deletions(-) diff --git a/Assets/Editor/Tool/TableTool.cs b/Assets/Editor/Tool/TableTool.cs index 0e87b8c..e4a206a 100644 --- a/Assets/Editor/Tool/TableTool.cs +++ b/Assets/Editor/Tool/TableTool.cs @@ -1,452 +1,452 @@ -锘縰sing System; -using System.CodeDom; -using System.Collections.Generic; -using System.IO; -using System.Security.Cryptography; -using System.Text; -using System.Windows.Forms; -using UnityEditor; -using UnityEngine; - -public class TableTool : EditorWindow -{ - - public static string configOutPutPath = UnityEngine.Application.dataPath + "/StreamingAssets/Config"; - - [UnityEditor.MenuItem("绛栧垝宸ュ叿/瀵煎嚭绛栧垝琛ㄥ埌娓告垙宸ョ▼")] - static void Init() - { - window = GetWindow(typeof(TableTool), true, "绛栧垝瀵艰〃宸ュ叿") as TableTool; - window.position = new Rect(UnityEngine.Screen.width / 2, UnityEngine.Screen.height / 2, 300, 700); - window.Show(); - PathCache(); - } - - public class FileToggleInfo - { - public FileToggleInfo(FileInfo file, bool sel) - { - fileInfo = file; - isSelect = sel; - } - - public FileInfo fileInfo = null; - public bool isSelect = false; - } - - private static TableTool window = null; - private Vector2 scrollPosition; - private static string _tablePath = ""; - private static List<FileToggleInfo> _tableNameLst = new List<FileToggleInfo>(); //鎵�鏈夎〃鍚嶅瓧鍒楄〃 - private void OnGUI() - { - GUILayout.BeginVertical(); - GUILayout.TextArea("绛栧垝閰嶈〃璺緞锛�" + _tablePath); - - GUILayout.Box(new GUIContent("璺緞涓嬬殑鎵�鏈夎〃锛�")); - - scrollPosition = GUILayout.BeginScrollView(scrollPosition); - ShowTableNames(); - GUILayout.EndScrollView(); - - GUILayout.FlexibleSpace(); - - GUILayout.BeginHorizontal(); - if (GUILayout.Button("鍒锋柊")) - { - GetDicFiles(); - } - if (GUILayout.Button("鍏ㄩ��")) - { - SelectAll(); - } - GUILayout.EndHorizontal(); - - GUILayout.BeginHorizontal(); - if (GUILayout.Button("瀵煎嚭琛�")) - { - ReadAllTxt(); - GenAllClass(); - MessageBox.Show("瀵煎嚭琛ㄦ垚鍔燂紒"); - AssetDatabase.Refresh(); - } - GUILayout.EndHorizontal(); - - GUILayout.EndVertical(); - - if (GUILayout.Button("閫夋嫨璺緞")) - { -#if UNITY_EDITOR - FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); - - if (folderBrowserDialog.ShowDialog() == DialogResult.OK || folderBrowserDialog.ShowDialog() == DialogResult.Yes) - { - _tablePath = folderBrowserDialog.SelectedPath + "\\"; - PathCache(_tablePath); - } - - folderBrowserDialog.Dispose(); -#endif - - } - } - - private void ShowTableNames() - { - if (_tableNameLst == null) - { - return; - } - for (int i = 0; i < _tableNameLst.Count; i++) - { - string tableName = _tableNameLst[i].fileInfo.Name; - - _tableNameLst[i].isSelect = GUILayout.Toggle(_tableNameLst[i].isSelect, tableName); - - } - } - - private void GetDicFiles() - { - if (string.IsNullOrEmpty(_tablePath)) - { - MessageBox.Show("璇烽�夋嫨绛栧垝琛ㄨ矾寰勶紒"); - return; - } - _tableNameLst.Clear(); - DirectoryInfo folder = new DirectoryInfo(@_tablePath); - if (folder != null) - { - FileInfo[] fileInfoArr = folder.GetFiles("*.txt"); - if (fileInfoArr == null || fileInfoArr.Length <= 0) - { - return; - } - for (int i = 0, length = fileInfoArr.Length; i < length; i++) - { - _tableNameLst.Add(new FileToggleInfo(fileInfoArr[i], false)); - } - } - } - - /// <summary> - /// 閫変腑鎵�鏈夎〃 - /// </summary> - private void SelectAll() - { - if (_tableNameLst == null) - { - MessageBox.Show("褰撳墠娌℃湁琛ㄥ彲閫夛紒"); - return; - } - for (int i = 0; i < _tableNameLst.Count; i++) - { - if (_tableNameLst[i] == null) - { - continue; - } - if (_tableNameLst[i].fileInfo == null) - { - continue; - } - _tableNameLst[i].isSelect = true; - } - } - - [UnityEditor.MenuItem("Assets/鐢熸垚閰嶇疆瑙f瀽绫诲瀷")] - public static void GenerateConfigClass() - { - _tableNameLst.Clear(); - - if (UnityEditor.Selection.objects != null) - { - foreach (var o in UnityEditor.Selection.objects) - { - var objectName = AssetDatabase.GetAssetPath(o.GetInstanceID()); - if (objectName.EndsWith(".txt") || objectName.EndsWith(".TXT")) - { - _tableNameLst.Add(new FileToggleInfo(new FileInfo(objectName), true)); - } - } - - GenAllClass(); - AssetDatabase.Refresh(); - } - - _tableNameLst.Clear(); - - MessageBox.Show("瀵煎嚭鎴愬姛锛�"); - } - - public static void ReadAllTxtToBytes(string _outPath) - { - configOutPutPath = _outPath; - var rootPath = UnityEngine.Application.dataPath + "/ResourcesOut/Refdata/Config"; - var configFiles = FileExtersion.GetFileInfos(rootPath, new string[] { "*.txt", "*.TXT" }); - foreach (var file in configFiles) - { - var fileInfo = new System.IO.FileInfo(file.FullName); - ReadTxtToBytes(fileInfo); - } - } - - /// <summary> - /// 瀵煎嚭鎵�鏈夎〃 - /// </summary> - private void ReadAllTxt() - { - if (string.IsNullOrEmpty(_tablePath)) - { - MessageBox.Show("璇烽�夋嫨绛栧垝琛ㄨ矾寰勶紒"); - return; - } - if (_tableNameLst == null) - { - MessageBox.Show("褰撳墠璺緞涓嬫病鏈夊彲璇诲彇鐨勭瓥鍒掕〃锛�"); - return; - } - for (int i = 0; i < _tableNameLst.Count; i++) - { - if (!_tableNameLst[i].isSelect) - { - continue; - } - ReadTxtToBytes(_tableNameLst[i].fileInfo); - } - } - - /// <summary> - /// 璇籺xt杞簩杩涘埗鏂囦欢 - /// </summary> - /// <param name="fileInfo"></param> - private static void ReadTxtToBytes(FileInfo fileInfo) - { - string fileName = fileInfo.Name.Split('.')[0]; - - if (!Directory.Exists(configOutPutPath)) - { - Directory.CreateDirectory(configOutPutPath); - } - - string filePath = configOutPutPath + "/" + fileName + ".bytes"; - if (File.Exists(filePath)) - { - File.Delete(filePath); - } - FileStream fileStream = fileInfo.OpenRead(); - StreamReader streamStream = new StreamReader(fileStream, Encoding.UTF8); - - TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider(); - des.Key = Convert.FromBase64String(ConfigManager.CustomKey); - des.IV = Convert.FromBase64String(ConfigManager.CustomIV); - des.Mode = System.Security.Cryptography.CipherMode.CBC; - des.Padding = System.Security.Cryptography.PaddingMode.PKCS7; - - FileStream fs = new FileStream(filePath, FileMode.Create); - CryptoStream cs = new CryptoStream(fs, des.CreateEncryptor(), CryptoStreamMode.Write); - BinaryWriter bw = new BinaryWriter(cs); - try - { - bw.Write(streamStream.ReadToEnd()); - bw.Flush(); - bw.Close(); - streamStream.Dispose(); - streamStream.Close(); - } - catch (IOException e) - { - DesignDebug.Log(e.Message); - } - } - - /// <summary> - /// 鐢熸垚鎵�鏈夎〃妯″瀷 - /// </summary> - private static void GenAllClass() - { - if (_tableNameLst == null) - { - return; - } - - for (int i = 0; i < _tableNameLst.Count; i++) - { - if (!_tableNameLst[i].isSelect) - { - continue; - } - FileStream fileStream = _tableNameLst[i].fileInfo.OpenRead(); - StreamReader sr = new StreamReader(fileStream, Encoding.Default); - CreateConfigData.CreateConfigClass(_tableNameLst[i].fileInfo); - sr.Dispose(); - sr.Close(); - } - } - - /// <summary> - /// 璺緞缂撳瓨 - /// </summary> - /// <param name="setPath"></param> - private static void PathCache(string setPath = "") - { - string configPath = UnityEngine.Application.dataPath; - configPath = configPath + "/ResourcesOut/Refdata/Config/PathCache/TablePath.txt"; - FileStream configPathTxt = File.Open(configPath, FileMode.Open); - if (string.IsNullOrEmpty(setPath)) - { - StreamReader sr = new StreamReader(configPathTxt); - string path = sr.ReadToEnd(); - _tablePath = path; - sr.Dispose(); - sr.Close(); - } - else - { - StreamWriter sw = new StreamWriter(configPathTxt); - sw.Write(setPath); - sw.Dispose(); - sw.Close(); - } - } -} - -public class Param -{ - public int Paramindex; - public string AttType; - public Type SysType; - public List<string> ParmValue = null; - public string SampleValue; - public string parmName; - public string SrcParmName; - public string parmComment; - - public Param(string attType, string attName, string attcomment, string samValue, int index) - { - ParmValue = new List<string>(); - Paramindex = index; - SetParmName(attName); - parmComment = attcomment; - SampleValue = samValue; - - StringBuilder valueSb = new StringBuilder(); - valueSb.Append("modelDetails["); - valueSb.Append(index.ToString()); - valueSb.Append("].Trim()"); - string value = valueSb.ToString(); - attType = attType.Trim(); - - switch (attType) - { - case "int": - { - SysType = typeof(System.Int32); - SetSigleValue("int", value); - } - break; - case "Int64": - { - SysType = typeof(System.Int64); - SetSigleValue("Int64", value); - } - break; - case "string": - { - SysType = typeof(System.String); - ParmValue.Add(value + ";"); - } - break; - - case "bool": - { - SysType = typeof(System.Boolean); - ParmValue.Add(value + ";"); - } - break; - case "float": - { - SysType = typeof(System.Double); - SetSigleValue("float", value); - } - break; - case "byte": - { - SysType = typeof(System.Byte); - SetSigleValue("byte", value); - } - break; - case "double": - { - SysType = typeof(System.Double); - SetSigleValue("double", value); - } - break; - case "int[]": - SysType = Type.GetType("System.Int32[]"); - SetValue("int", value, SampleValue); - break; - case "string[]": - SysType = Type.GetType("System.String[]"); - SetValue("string", value, SampleValue); - break; - case "double[]": - SysType = Type.GetType("System.Double[]"); - SetValue("double", value, SampleValue); - break; - default: SysType = null; break; - } - } - - private void SetValue(string paramType, string value, string sampleValue) - { - string[] valueSpArray = sampleValue.Split('|'); - if (valueSpArray == null) - { - return; - } - - StringBuilder arrayName = new StringBuilder(); - arrayName.Append(parmName); - arrayName.Append("SplitArray"); - - StringBuilder firstValue = new StringBuilder(); - firstValue.Append("string[] "); - firstValue.Append(arrayName.ToString()); - firstValue.Append(" = "); - firstValue.Append(value); - firstValue.Append(".Split('|');"); - ParmValue.Add(firstValue.ToString()); - - StringBuilder secondValue = new StringBuilder(); - secondValue.Append(parmName); - secondValue.Append(" = new "); - secondValue.Append(paramType); - secondValue.Append("[" + valueSpArray.Length + "];"); - ParmValue.Add(secondValue.ToString()); - - ParmValue.Add(string.Format("for (int i = 0; i < {0}.Length; i++) {", parmName)); - ParmValue.Add(string.Format(" {0}[i] = IsNumeric({1}SplitArray[i]) ? double.Parse({2}SplitArray[i]) : (double)0;", parmName, parmName, parmName)); - ParmValue.Add("}"); - } - - private void SetSigleValue(string paramType, string value) - { - StringBuilder strBld = new StringBuilder(); - strBld.Append("IsNumeric("); - strBld.Append(value); - strBld.Append(string.Format(")? {0}.Parse(", paramType)); - strBld.Append(value); - strBld.Append(string.Format("):({0})0;", paramType)); - ParmValue.Add(strBld.ToString()); - } - - public void SetParmName(string fieldName) - { - string fName = fieldName.Replace(" ", ""); - fName = fName.Split('[')[0]; - SrcParmName = fName; - fName = "_" + fName.ToLower(); - parmName = fName; - } - -} +锘縰sing System; +using System.CodeDom; +using System.Collections.Generic; +using System.IO; +using System.Security.Cryptography; +using System.Text; +using System.Windows.Forms; +using UnityEditor; +using UnityEngine; + +public class TableTool : EditorWindow +{ + + public static string configOutPutPath = UnityEngine.Application.dataPath + "/StreamingAssets/Config"; + + [UnityEditor.MenuItem("绛栧垝宸ュ叿/瀵煎嚭绛栧垝琛ㄥ埌娓告垙宸ョ▼")] + static void Init() + { + window = GetWindow(typeof(TableTool), true, "绛栧垝瀵艰〃宸ュ叿") as TableTool; + window.position = new Rect(UnityEngine.Screen.width / 2, UnityEngine.Screen.height / 2, 300, 700); + window.Show(); + PathCache(); + } + + public class FileToggleInfo + { + public FileToggleInfo(FileInfo file, bool sel) + { + fileInfo = file; + isSelect = sel; + } + + public FileInfo fileInfo = null; + public bool isSelect = false; + } + + private static TableTool window = null; + private Vector2 scrollPosition; + private static string _tablePath = ""; + private static List<FileToggleInfo> _tableNameLst = new List<FileToggleInfo>(); //鎵�鏈夎〃鍚嶅瓧鍒楄〃 + private void OnGUI() + { + GUILayout.BeginVertical(); + GUILayout.TextArea("绛栧垝閰嶈〃璺緞锛�" + _tablePath); + + GUILayout.Box(new GUIContent("璺緞涓嬬殑鎵�鏈夎〃锛�")); + + scrollPosition = GUILayout.BeginScrollView(scrollPosition); + ShowTableNames(); + GUILayout.EndScrollView(); + + GUILayout.FlexibleSpace(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("鍒锋柊")) + { + GetDicFiles(); + } + if (GUILayout.Button("鍏ㄩ��")) + { + SelectAll(); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("瀵煎嚭琛�")) + { + ReadAllTxt(); + GenAllClass(); + MessageBox.Show("瀵煎嚭琛ㄦ垚鍔燂紒"); + AssetDatabase.Refresh(); + } + GUILayout.EndHorizontal(); + + GUILayout.EndVertical(); + + if (GUILayout.Button("閫夋嫨璺緞")) + { +#if UNITY_EDITOR + FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); + + if (folderBrowserDialog.ShowDialog() == DialogResult.OK || folderBrowserDialog.ShowDialog() == DialogResult.Yes) + { + _tablePath = folderBrowserDialog.SelectedPath + "\\"; + PathCache(_tablePath); + } + + folderBrowserDialog.Dispose(); +#endif + + } + } + + private void ShowTableNames() + { + if (_tableNameLst == null) + { + return; + } + for (int i = 0; i < _tableNameLst.Count; i++) + { + string tableName = _tableNameLst[i].fileInfo.Name; + + _tableNameLst[i].isSelect = GUILayout.Toggle(_tableNameLst[i].isSelect, tableName); + + } + } + + private void GetDicFiles() + { + if (string.IsNullOrEmpty(_tablePath)) + { + MessageBox.Show("璇烽�夋嫨绛栧垝琛ㄨ矾寰勶紒"); + return; + } + _tableNameLst.Clear(); + DirectoryInfo folder = new DirectoryInfo(@_tablePath); + if (folder != null) + { + FileInfo[] fileInfoArr = folder.GetFiles("*.txt"); + if (fileInfoArr == null || fileInfoArr.Length <= 0) + { + return; + } + for (int i = 0, length = fileInfoArr.Length; i < length; i++) + { + _tableNameLst.Add(new FileToggleInfo(fileInfoArr[i], false)); + } + } + } + + /// <summary> + /// 閫変腑鎵�鏈夎〃 + /// </summary> + private void SelectAll() + { + if (_tableNameLst == null) + { + MessageBox.Show("褰撳墠娌℃湁琛ㄥ彲閫夛紒"); + return; + } + for (int i = 0; i < _tableNameLst.Count; i++) + { + if (_tableNameLst[i] == null) + { + continue; + } + if (_tableNameLst[i].fileInfo == null) + { + continue; + } + _tableNameLst[i].isSelect = true; + } + } + + [UnityEditor.MenuItem("Assets/鐢熸垚閰嶇疆瑙f瀽绫诲瀷")] + public static void GenerateConfigClass() + { + _tableNameLst.Clear(); + + if (UnityEditor.Selection.objects != null) + { + foreach (var o in UnityEditor.Selection.objects) + { + var objectName = AssetDatabase.GetAssetPath(o.GetInstanceID()); + if (objectName.EndsWith(".txt") || objectName.EndsWith(".TXT")) + { + _tableNameLst.Add(new FileToggleInfo(new FileInfo(objectName), true)); + } + } + + GenAllClass(); + AssetDatabase.Refresh(); + } + + _tableNameLst.Clear(); + + MessageBox.Show("瀵煎嚭鎴愬姛锛�"); + } + + public static void ReadAllTxtToBytes(string _outPath) + { + configOutPutPath = _outPath; + var rootPath = UnityEngine.Application.dataPath + "/ResourcesOut/Refdata/Config"; + var configFiles = FileExtersion.GetFileInfos(rootPath, new string[] { "*.txt", "*.TXT" }); + foreach (var file in configFiles) + { + var fileInfo = new System.IO.FileInfo(file.FullName); + ReadTxtToBytes(fileInfo); + } + } + + /// <summary> + /// 瀵煎嚭鎵�鏈夎〃 + /// </summary> + private void ReadAllTxt() + { + if (string.IsNullOrEmpty(_tablePath)) + { + MessageBox.Show("璇烽�夋嫨绛栧垝琛ㄨ矾寰勶紒"); + return; + } + if (_tableNameLst == null) + { + MessageBox.Show("褰撳墠璺緞涓嬫病鏈夊彲璇诲彇鐨勭瓥鍒掕〃锛�"); + return; + } + for (int i = 0; i < _tableNameLst.Count; i++) + { + if (!_tableNameLst[i].isSelect) + { + continue; + } + ReadTxtToBytes(_tableNameLst[i].fileInfo); + } + } + + /// <summary> + /// 璇籺xt杞簩杩涘埗鏂囦欢 + /// </summary> + /// <param name="fileInfo"></param> + private static void ReadTxtToBytes(FileInfo fileInfo) + { + string fileName = fileInfo.Name.Split('.')[0]; + + if (!Directory.Exists(configOutPutPath)) + { + Directory.CreateDirectory(configOutPutPath); + } + + string filePath = configOutPutPath + "/" + fileName + ".bytes"; + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + FileStream fileStream = fileInfo.OpenRead(); + StreamReader streamStream = new StreamReader(fileStream, Encoding.UTF8); + + TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider(); + des.Key = Convert.FromBase64String(ConfigManager.CustomKey); + des.IV = Convert.FromBase64String(ConfigManager.CustomIV); + des.Mode = System.Security.Cryptography.CipherMode.CBC; + des.Padding = System.Security.Cryptography.PaddingMode.PKCS7; + + FileStream fs = new FileStream(filePath, FileMode.Create); + CryptoStream cs = new CryptoStream(fs, des.CreateEncryptor(), CryptoStreamMode.Write); + BinaryWriter bw = new BinaryWriter(cs); + try + { + bw.Write(streamStream.ReadToEnd()); + bw.Flush(); + bw.Close(); + streamStream.Dispose(); + streamStream.Close(); + } + catch (IOException e) + { + DesignDebug.Log(e.Message); + } + } + + /// <summary> + /// 鐢熸垚鎵�鏈夎〃妯″瀷 + /// </summary> + private static void GenAllClass() + { + if (_tableNameLst == null) + { + return; + } + + for (int i = 0; i < _tableNameLst.Count; i++) + { + if (!_tableNameLst[i].isSelect) + { + continue; + } + FileStream fileStream = _tableNameLst[i].fileInfo.OpenRead(); + StreamReader sr = new StreamReader(fileStream, Encoding.Default); + CreateConfigData.CreateConfigClass(_tableNameLst[i].fileInfo); + sr.Dispose(); + sr.Close(); + } + } + + /// <summary> + /// 璺緞缂撳瓨 + /// </summary> + /// <param name="setPath"></param> + private static void PathCache(string setPath = "") + { + string configPath = UnityEngine.Application.dataPath; + configPath = configPath + "/ResourcesOut/Refdata/Config/PathCache/TablePath.txt"; + FileStream configPathTxt = File.Open(configPath, FileMode.Open); + if (string.IsNullOrEmpty(setPath)) + { + StreamReader sr = new StreamReader(configPathTxt); + string path = sr.ReadToEnd(); + _tablePath = path; + sr.Dispose(); + sr.Close(); + } + else + { + StreamWriter sw = new StreamWriter(configPathTxt); + sw.Write(setPath); + sw.Dispose(); + sw.Close(); + } + } +} + +public class Param +{ + public int Paramindex; + public string AttType; + public Type SysType; + public List<string> ParmValue = null; + public string SampleValue; + public string parmName; + public string SrcParmName; + public string parmComment; + + public Param(string attType, string attName, string attcomment, string samValue, int index) + { + ParmValue = new List<string>(); + Paramindex = index; + SetParmName(attName); + parmComment = attcomment; + SampleValue = samValue; + + StringBuilder valueSb = new StringBuilder(); + valueSb.Append("modelDetails["); + valueSb.Append(index.ToString()); + valueSb.Append("].Trim()"); + string value = valueSb.ToString(); + attType = attType.Trim(); + + switch (attType) + { + case "int": + { + SysType = typeof(System.Int32); + SetSigleValue("int", value); + } + break; + case "Int64": + { + SysType = typeof(System.Int64); + SetSigleValue("Int64", value); + } + break; + case "string": + { + SysType = typeof(System.String); + ParmValue.Add(value + ";"); + } + break; + + case "bool": + { + SysType = typeof(System.Boolean); + ParmValue.Add(value + ";"); + } + break; + case "float": + { + SysType = typeof(System.Double); + SetSigleValue("float", value); + } + break; + case "byte": + { + SysType = typeof(System.Byte); + SetSigleValue("byte", value); + } + break; + case "double": + { + SysType = typeof(System.Double); + SetSigleValue("double", value); + } + break; + case "int[]": + SysType = Type.GetType("System.Int32[]"); + SetValue("int", value, SampleValue); + break; + case "string[]": + SysType = Type.GetType("System.String[]"); + SetValue("string", value, SampleValue); + break; + case "double[]": + SysType = Type.GetType("System.Double[]"); + SetValue("double", value, SampleValue); + break; + default: SysType = null; break; + } + } + + private void SetValue(string paramType, string value, string sampleValue) + { + string[] valueSpArray = sampleValue.Split('|'); + if (valueSpArray == null) + { + return; + } + + StringBuilder arrayName = new StringBuilder(); + arrayName.Append(parmName); + arrayName.Append("SplitArray"); + + StringBuilder firstValue = new StringBuilder(); + firstValue.Append("string[] "); + firstValue.Append(arrayName.ToString()); + firstValue.Append(" = "); + firstValue.Append(value); + firstValue.Append(".Split('|');"); + ParmValue.Add(firstValue.ToString()); + + StringBuilder secondValue = new StringBuilder(); + secondValue.Append(parmName); + secondValue.Append(" = new "); + secondValue.Append(paramType); + secondValue.Append("[" + valueSpArray.Length + "];"); + ParmValue.Add(secondValue.ToString()); + + ParmValue.Add(string.Format("for (int i = 0; i < {0}.Length; i++) {", parmName)); + ParmValue.Add(string.Format(" {0}[i] = IsNumeric({1}SplitArray[i]) ? double.Parse({2}SplitArray[i]) : (double)0;", parmName, parmName, parmName)); + ParmValue.Add("}"); + } + + private void SetSigleValue(string paramType, string value) + { + StringBuilder strBld = new StringBuilder(); + strBld.Append("IsNumeric("); + strBld.Append(value); + strBld.Append(string.Format(")? {0}.Parse(", paramType)); + strBld.Append(value); + strBld.Append(string.Format("):({0})0;", paramType)); + ParmValue.Add(strBld.ToString()); + } + + public void SetParmName(string fieldName) + { + string fName = fieldName.Replace(" ", ""); + fName = fName.Split('[')[0]; + SrcParmName = fName; + fName = "_" + fName.ToLower(); + parmName = fName; + } + +} -- Gitblit v1.8.0