예제 #1
0
        /// <summary>
        /// Render and parse one of the items.
        /// </summary>
        /// <param name="iTaskItem"></param>
        /// <param name="iTaskItem_2"></param>
        private bool RenderDataModel(ITaskItem inputDM, ITaskItem outputFile)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Namespace))
                    Namespace = "ROOTLINQ";

                var inputXMLFile = new FileInfo(inputDM.GetMetadata("FullPath"));
                var outputCSFile = new FileInfo(outputFile.GetMetadata("FullPath"));
                var generator = new TTreeClassGenerator.ClassGenerator();
                generator.GenerateClasss(inputXMLFile, outputCSFile, Namespace);
            }
            catch (Exception e)
            {
                Log.LogError("ParseError", "ParseError", "ParseError", inputDM.ItemSpec, 0, 0, 0, 0, "Failed to parse: " + DumpExceptoin(e));
                return false;
            }

            return true;
        }
예제 #2
0
        /// <summary>
        /// Render and parse one of the items.
        /// </summary>
        /// <param name="iTaskItem"></param>
        /// <param name="iTaskItem_2"></param>
        private bool RenderDataModel(ITaskItem inputDM, ITaskItem outputFile)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Namespace))
                {
                    Namespace = "ROOTLINQ";
                }

                var inputXMLFile = new FileInfo(inputDM.GetMetadata("FullPath"));
                var outputCSFile = new FileInfo(outputFile.GetMetadata("FullPath"));
                var generator    = new TTreeClassGenerator.ClassGenerator();
                generator.GenerateClasss(inputXMLFile, outputCSFile, Namespace);
            }
            catch (Exception e)
            {
                Log.LogError("ParseError", "ParseError", "ParseError", inputDM.ItemSpec, 0, 0, 0, 0, "Failed to parse: " + DumpExceptoin(e));
                return(false);
            }

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Generate a set of classes reading in an XML file
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            ///
            /// Parse the command line arguments
            ///

            string CSharpNtupleNamespace = "ROOTTTreeDataModel";

            if (args.Length != 2)
            {
                Usage();
                return;
            }

            FileInfo inputXMLFile = new FileInfo(args[0]);
            FileInfo outputCSFile = new FileInfo(args[1]);

            if (!inputXMLFile.Exists)
            {
                Console.WriteLine("Could not find input xml file '" + inputXMLFile.FullName + "'");
                return;
            }

            if (!outputCSFile.Directory.Exists)
            {
                Console.WriteLine("Could not find output cs file's parent directory '" + outputCSFile.Directory.FullName + "'");
                return;
            }

            ///
            /// Ok - the actual generation is pretty simple!
            ///

            var generator = new TTreeClassGenerator.ClassGenerator();

            generator.GenerateClasss(inputXMLFile, outputCSFile, CSharpNtupleNamespace);
        }