Esempio n. 1
0
        /// <summary>
        /// Get the generated assembly for the specified fileName using the
        /// specified generator to generate it if necessary
        /// </summary>
        /// <param name="infoFileName"></param>
        /// <param name="generator"></param>
        /// <returns></returns>
        public static GeneratedAssemblyInfo GetGeneratedAssembly(string infoFileName, IAssemblyGenerator generator)
        {
            GeneratedAssemblyInfo assemblyInfo = GeneratedAssemblies.GetGeneratedAssemblyInfo(infoFileName);

            if (assemblyInfo == null)
            {
                assemblyInfo = new GeneratedAssemblyInfo(infoFileName);
                // check for the info file
                if (assemblyInfo.InfoFileExists) // load it from file if it exists
                {
                    assemblyInfo = assemblyInfo.InfoFilePath.FromJsonFile <GeneratedAssemblyInfo>();
                    if (!assemblyInfo.InfoFileName.Equals(infoFileName) || !assemblyInfo.AssemblyExists) // regenerate if the names don't match
                    {
                        assemblyInfo = generator.GenerateAssembly();
                    }
                }
                else
                {
                    assemblyInfo = generator.GenerateAssembly();
                }
            }

            GeneratedAssemblies.SetAssemblyInfo(infoFileName, assemblyInfo);
            return(assemblyInfo);
        }
Esempio n. 2
0
 public static void SetAssemblyInfo(string name, GeneratedAssemblyInfo assembly)
 {
     _generatedAssemblies[name] = assembly;
 }