Beispiel #1
0
        private static int InstallTemplates(string csproj, string larnacaFiles, string larnacaFilesPackageIdentities, string dir, string outAddedTemplates)
        {
            var larnacaFilesArray = larnacaFiles.Split(';').Select(p => Path.Combine(dir, p)).ToArray();
            var larnacaFilesPackageIdentitiesArray = larnacaFilesPackageIdentities.Split(';');
            var result = TemplateFileManager.InstallUpdateTemplates(csproj, larnacaFilesArray, larnacaFilesPackageIdentitiesArray, dir, outAddedTemplates);

            if (result.Fail())
            {
                Console.Error.WriteLine(result);
            }
            else
            {
                Console.WriteLine(result);
            }
            return(result.StatusCode);
        }
Beispiel #2
0
        protected override void GenerateProxiesCore(string proxyLocation, string @namespace, SessionGeneratorContext context)
        {
            SessionProxyEmitter emitter = new SessionProxyEmitter();

            AddSessionBasesToContext();

            TemplateFileManager fileManager = new TemplateFileManager(emitter.GenerationEnvironment);

            fileManager.StartNewFile("SessionProxies.cs");
            emitter.EmitUsingStatements(context);
            using (emitter.BeginNamespace(@namespace)) {
                using (emitter.BeginEmitSessionContainer())
                    using (emitter.BeginEmitSessionContainerInitialize()) {
                        foreach (var info in from i in context.SessionInfos
                                 where !i.IsAbstractBase
                                 select i)
                        {
                            emitter.EmitSessionContainerRegistration(info.Type);
                        }
                    }
            }

            foreach (var info in from i in context.SessionInfos
                     where !i.IsAbstractBase
                     select i)
            {
                using (emitter.BeginNamespace(info.Type.Namespace + ".Proxies")) {
                    using (emitter.BeginEmitSessionClass(info.Type)) {
                        emitter.EmitConstructor(info.Type);
                        foreach (var method in info.Operations)
                        {
                            emitter.EmitOperation(method);
                        }
                        foreach (var property in info.DataProperties)
                        {
                            emitter.EmitDataProperty(property);
                        }
                    }
                }
            }
            fileManager.Process(proxyLocation, true);
        }
        public void GenerateWpfCommands(WpfCommandsEmitter emitter)
        {
            AddSessionBasesToContext();

            TemplateFileManager fileManager = new TemplateFileManager(emitter.GenerationEnvironment);

            fileManager.StartNewFile("WpfSessionCommands.cs");
            emitter.EmitUsingStatements(context);
            using (emitter.BeginNamespace(@namespace)) {
                //using (emitter.BeginEmitSessionContainer())
                //using (emitter.BeginEmitSessionContainerInitialize())
                //{
                //    foreach (var info in from i in context.SessionInfos
                //                         where !i.IsAbstractBase
                //                         select i)
                //    {
                //        emitter.EmitSessionContainerRegistration(info.Type);
                //    }
                //}

                foreach (var info in from i in context.SessionInfos
                         where !i.IsAbstractBase
                         select i)
                {
                    using (emitter.BeginEmitCommandsClass(info.Type)) {
                        foreach (var method in info.Operations)
                        {
                            emitter.EmitRoutedCommand(info, method);
                        }

                        using (emitter.BeginEmitBindCommandsMethod(info.Type))
                            using (emitter.BeginReturnCommandBindingsArray()) {
                                foreach (var method in info.Operations)
                                {
                                    emitter.EmitCommandBinding(method);
                                }
                            }
                    }
                }
            }
            fileManager.Process(@".\Generated\", true);
        }