private void WriteCsToDisk(CSharpClassWriter klass, DataNode set) { var csFile = new FileWriter(_csharpPath + "\\" + klass.DiskFileName); klass.WriteToCsFile(csFile); //if (IsClassChanged(klass, set)) csFile.WriteToDisk(); _csFiles.Add(klass.DiskFileName); }
private void WriteCppToDisk(CSharpClassWriter klass, DataNode set) { var cppFileName = klass.DiskCppFileName; AddToFileList(cppFileName); var cppFile = new FileWriter(_cppFolder + "\\" + cppFileName); var definitionFile = new FileWriter(_cppFolder + "\\" + klass.DiskCppHeaderName); klass.WriteToCppFile(cppFile, definitionFile); // if (!IsClassChanged(klass, set)) return; CSharpClassWriter.DefinitionsHeaderFinish(definitionFile); cppFile.WriteToDisk(); }
private static bool IsClassChanged(CSharpClassWriter klass, DataNode set) { //return true; // decomment to regenerate all wrappers var generator = set.Root.Set(Consts.Occ, Consts.Generator); var ns = generator.Set(Consts.NaroCppCore, Consts.Namespace); var occ = ns.Set(Consts.Occ, Consts.Namespace); var packageNode = occ.Get(klass.PackageName, Consts.Namespace); if (packageNode == null) { return(true); } var classNode = packageNode.Get(klass.ClassName, Consts.Klass); if (classNode == null) { return(true); } var methodsNode = classNode.Get(Consts.Methods); if (methodsNode == null && klass.Methods.Count != 0) { return(true); } if (methodsNode != null && methodsNode.Children.Count != klass.Methods.Count) { return(true); } var ctorssNode = classNode.Get(Consts.Constructors); if (ctorssNode == null && klass.Constructors.Count != 0) { return(true); } if (ctorssNode != null && ctorssNode.Children.Count != klass.Constructors.Count) { return(true); } var propssNode = classNode.Get(Consts.Properties); if (propssNode == null && klass.Properties.Count != 0) { return(true); } if (propssNode != null && propssNode.Children.Count != klass.Properties.Count) { return(true); } return(false); }
private CSharpClassWriter GetOrAddClass(DataNode node) { var className = node.Name; CSharpClassWriter result; if (Classes.TryGetValue(className, out result)) { return(result); } result = new CSharpClassWriter(this, node); var implementsNode = node.Get(Consts.Implements); result.BasedOn = implementsNode != null ? Util.BeautifiedClassName(implementsNode.Name) : "NativeInstancePtr"; if (implementsNode != null) { result.AddDependentType(implementsNode.Name); } Classes[className] = result; return(result); }