public IAsyncOperation Generate (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
		{
			return new ThreadAsyncOperation (delegate {
				using (var host = new ProjectFileTemplatingHost (file)) {
					
					var defaultOutputName = file.FilePath.ChangeExtension (".cs"); //cs extension for VS compat
					
					string ns = TextTemplatingFilePreprocessor.GetNamespaceHint (file, defaultOutputName);
					TextTemplatingFilePreprocessor.LogicalSetData ("NamespaceHint", ns, result.Errors);
					
					host.ProcessTemplate (file.FilePath, defaultOutputName);
					result.GeneratedFilePath = host.OutputFile;
					result.Errors.AddRange (host.Errors);
					
					foreach (var err in host.Errors)
						monitor.Log.WriteLine (err);
				}
			}, result);
		}
		public Task Generate (ProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
		{
			return Task.Run (delegate {
				using (var host = new ProjectFileTemplatingHost (file, IdeApp.Workspace.ActiveConfiguration)) {
					host.AddMonoDevelopHostImport ();
					var defaultOutputName = file.FilePath.ChangeExtension (".cs"); //cs extension for VS compat
					
					string ns = CustomToolService.GetFileNamespace (file, defaultOutputName);
					LogicalSetData ("NamespaceHint", ns);
					
					host.ProcessTemplate (file.FilePath, defaultOutputName);
					result.GeneratedFilePath = host.OutputFile;
					result.Errors.AddRange (host.Errors);
					
					foreach (var err in host.Errors)
						monitor.Log.WriteLine (err);
				}
			});
		}
        public IAsyncOperation Generate(IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
        {
            return(new ThreadAsyncOperation(delegate {
                using (var host = new ProjectFileTemplatingHost(file)) {
                    host.AddMonoDevelopHostImport();
                    var defaultOutputName = file.FilePath.ChangeExtension(".cs");                      //cs extension for VS compat

                    string ns = TextTemplatingFilePreprocessor.GetNamespaceHint(file, defaultOutputName);
                    TextTemplatingFilePreprocessor.LogicalSetData("NamespaceHint", ns, result.Errors);

                    host.ProcessTemplate(file.FilePath, defaultOutputName);
                    result.GeneratedFilePath = host.OutputFile;
                    result.Errors.AddRange(host.Errors);

                    foreach (var err in host.Errors)
                    {
                        monitor.Log.WriteLine(err);
                    }
                }
            }, result));
        }
Example #4
0
        public Task Generate(ProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
        {
            return(Task.Run(delegate {
                using (var host = new ProjectFileTemplatingHost(file, IdeApp.Workspace.ActiveConfiguration)) {
                    host.AddMonoDevelopHostImport();
                    var defaultOutputName = file.FilePath.ChangeExtension(".cs");                      //cs extension for VS compat

                    string ns = CustomToolService.GetFileNamespace(file, defaultOutputName);
                    LogicalSetData("NamespaceHint", ns);

                    host.ProcessTemplate(file.FilePath, defaultOutputName);
                    result.GeneratedFilePath = host.OutputFile;
                    result.Errors.AddRange(host.Errors);

                    foreach (var err in host.Errors)
                    {
                        monitor.Log.WriteLine(err);
                    }
                }
            }));
        }