Exemple #1
0
        public string toCTypeString()
        {
            // Loop SPDs in Packet
            // Add Opening Struct Text
            string       tempText       = "//\n// - " + PackDescription + " - //\n// \ntypedef struct\n{\n";
            int          tempInt        = 0;
            XPlatAutoGEN myXPlatAutoGEN = new XPlatAutoGEN(5);

            foreach (imsSerialParamData SPD in PacketSPDs)
            {
                myXPlatAutoGEN.AddLineTokens(SPD.toCTypeString(ref tempInt));
            }
            myXPlatAutoGEN.AlignColumnsInputTokens();
            tempText += myXPlatAutoGEN.ReturnOutputLines();


            // Add Closing Struct Text
            string tempString = "";

            foreach (char thisChar in PackDescription)
            {
                if (Char.IsLetterOrDigit(thisChar))
                {
                    tempString += thisChar;
                }
            }
            if (!Char.IsLetter(tempString[0]))
            {
                tempString = string.Concat("pck", tempString);
            }
            tempText += "}XPLAT_DLL_API " + tempString + "struct;\t// Export - " + PackDescription + " - //\n";
            tempText += "#define\tPckSize_" + tempString + "\t\t" + tempInt.ToString() + "\t\t// ( 0x" + tempInt.ToString("X2") + " )\n";
            tempText += "#define\tPckID_" + tempString + "\t\t" + PackID.ToString() + "\t\t// ( 0x" + PackID.ToString("X2") + " )\n";

            return(tempText);
        }