public static FunctionInputOutput GetFunctionInputOutput(string func) { try { FunctionInputOutput fio = new FunctionInputOutput(); string signature = GetFunctionSignature(func); int openBraceIndex = signature.IndexOf('('); int closeBraceIndex = signature.IndexOf(')'); if (openBraceIndex == -1 || closeBraceIndex == -1) { return(fio); } string variableString = signature.Substring(openBraceIndex + 1, (closeBraceIndex - openBraceIndex) - 1).Trim(); string[] variables = variableString.Trim().Split(','); foreach (string s in variables) { bool input = false; bool output = false; string type = string.Empty; string[] parts = s.Trim().Split(' '); foreach (string p in parts) { if (p == "IN") { input = true; } else if (p == "OUT") { output = true; } else if (type == string.Empty) { type = p; if (type == "nmprk_conn_handle_t") { continue; } if (input == true) { string stru = GetStructure(type); if (stru == null) { fio.Input += (s.Substring(s.IndexOf(type)) + Environment.NewLine); } else { fio.Input += (stru + Environment.NewLine); } } if (output == true) { string stru = GetStructure(type); if (stru == null) { fio.Output += (s.Substring(s.IndexOf(type)) + Environment.NewLine); } else { fio.Output += (stru + Environment.NewLine); } } break; } } } return(fio); } catch (Exception ex) { throw; } }
public static FunctionInputOutput GetFunctionInputOutput(string func) { try { FunctionInputOutput fio = new FunctionInputOutput(); string signature = GetFunctionSignature(func); int openBraceIndex = signature.IndexOf('('); int closeBraceIndex = signature.IndexOf(')'); if (openBraceIndex == -1 || closeBraceIndex == -1) return fio; string variableString = signature.Substring(openBraceIndex + 1, (closeBraceIndex - openBraceIndex) - 1).Trim(); string[] variables = variableString.Trim().Split(','); foreach (string s in variables) { bool input = false; bool output = false; string type = string.Empty; string[] parts = s.Trim().Split(' '); foreach (string p in parts) { if (p == "IN") input = true; else if (p == "OUT") output = true; else if (type == string.Empty) { type = p; if (type == "nmprk_conn_handle_t") continue; if (input == true) { string stru = GetStructure(type); if (stru == null) fio.Input += (s.Substring(s.IndexOf(type)) + Environment.NewLine); else fio.Input += (stru + Environment.NewLine); } if (output == true) { string stru = GetStructure(type); if (stru == null) fio.Output += (s.Substring(s.IndexOf(type)) + Environment.NewLine); else fio.Output += (stru + Environment.NewLine); } break; } } } return fio; } catch (Exception ex) { throw; } }