Esempio n. 1
0
        /// <summary>
        /// Generates TimedScope.cs from TimedScopes.xml
        /// </summary>
        /// <param name="timedScopesDefinitionFile">Timed scopes definition file</param>
        /// <param name="timedScopesFile">File to generate C# static class</param>
        /// <param name="isSharedTimedScope">Is the TimedScope class to be generated a Shared one.</param>
        public static void GenerateTimedScopesClass(FileInfo timedScopesDefinitionFile, FileInfo timedScopesFile, bool isSharedTimedScope = false)
        {
            TimedScopeCollection timedScopeCollection = ReadFromFile <TimedScopeCollection>(timedScopesDefinitionFile);

            TimedScopeClassTemplate template = new TimedScopeClassTemplate(timedScopeCollection, isSharedTimedScope);
            string generatedClass            = template.TransformText();

            using (StreamWriter writer = new StreamWriter(timedScopesFile.FullName))
            {
                writer.Write(generatedClass);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="scopeCollection">Scope collection</param>
 /// <param name="isSharedTimedScopes">Are we rendering shared timed scopes?</param>
 public TimedScopeClassTemplate(TimedScopeCollection scopeCollection, bool isSharedTimedScopes)
 {
     ScopeCollection     = scopeCollection;
     IsSharedTimedScopes = isSharedTimedScopes;
 }