Beispiel #1
0
        private string GenerateInternalsCodeBlock()
        {
            StringBuilder SB = new StringBuilder();

            foreach (T6Property t6Property in Properties)
            {
                string get = "";
                if (t6Property.Getter != null)
                {
                    get = NativeFunctionTemplate.GetFunctionString(t6Property.Getter);
                }

                string set = "";
                if (t6Property.Setter != null)
                {
                    set = NativeFunctionTemplate.GetFunctionString(t6Property.Setter);
                }

                SB.Append(get + set);
            }

            foreach (T6Function t6Function in Functions)
            {
                SB.Append(NativeFunctionTemplate.GetFunctionString(t6Function));
            }
            return(SB.ToString().Trim());
        }
        private static void SaveNamespaceDictionary()
        {
            foreach (KeyValuePair <string, List <T6Function> > keyValuePair in _namespaceDictionary)
            {
                StringBuilder internalsStringBuilder = new StringBuilder();
                StringBuilder functionsStringBuilder = new StringBuilder();

                foreach (T6Function t6Function in keyValuePair.Value)
                {
                    internalsStringBuilder.Append(NativeFunctionTemplate.GetFunctionString(keyValuePair.Key, t6Function));
                }

                foreach (T6Function t6Function in keyValuePair.Value)
                {
                    string internalName = keyValuePair.Key + "_" + t6Function.Name;

                    functionsStringBuilder.Append(FunctionTemplate.GetMethodString(internalName, t6Function));
                }

                Directory.CreateDirectory(_outputDir + "/Torque6/Engine/Namespaces");
                StreamWriter SW = new StreamWriter(_outputDir + "/Torque6/Engine/Namespaces/" + keyValuePair.Key + ".cs");

                SW.Write(NamespaceTemplate.GetClassString(keyValuePair.Key,
                                                          internalsStringBuilder.ToString().Trim(),
                                                          functionsStringBuilder.ToString().Trim(),
                                                          GetCustomForNamespace(keyValuePair.Key)));

                SW.Close();
            }
        }