Esempio n. 1
0
        /// <summary>
        /// Generate the script
        /// </summary>
        internal static void Generate(string snippetSourcePath, string frameworksFolder)
        {
            // Get latest framework folder
            Frameworks frameworks      = new Frameworks(frameworksFolder);
            string     frameworkFolder = frameworks.GetNewestVersion().Folder;

            List <TypeDefinition> list       = CollectExceptions(frameworkFolder);
            List <string>         namespaces = list.Select(x => x.Namespace).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
            List <string>         lines      = new List <string>();

            foreach (string ns in namespaces)
            {
                lines.Add(string.Format(NsTemplate, ns));
            }

            foreach (TypeDefinition type in list)
            {
                lines.Add(string.Format(TypeTemplate, type.Namespace, type.FullName));
            }

            string allLines = string.Join(Environment.NewLine, lines);

            allLines = allLines.Substring(0, allLines.Length - 1); // strip last ','
            string script   = Template.Replace("$$$", allLines);
            string existing = File.Exists(snippetSourcePath) ? File.ReadAllText(snippetSourcePath) : string.Empty;

            if (script != existing)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(snippetSourcePath));
                File.WriteAllText(snippetSourcePath, script);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Generate the script
        /// </summary>
        internal static void Generate(string snippetSourcePath, string frameworksFolder)
        {
            // Get latest framework folder
            Frameworks frameworks = new Frameworks(frameworksFolder);
            string frameworkFolder = frameworks.GetNewestVersion().Folder;

            List<TypeDefinition> list = CollectExceptions(frameworkFolder);
            List<string> namespaces = list.Select(x => x.Namespace).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
            List<string> lines = new List<string>();

            foreach (string ns in namespaces)
            {
                lines.Add(string.Format(NsTemplate, ns));
            }

            foreach (TypeDefinition type in list)
            {
                lines.Add(string.Format(TypeTemplate, type.Namespace, type.FullName));
            }

            string allLines = string.Join(Environment.NewLine, lines);
            allLines = allLines.Substring(0, allLines.Length - 1); // strip last ','
            string script = Template.Replace("$$$", allLines);
            string existing = File.Exists(snippetSourcePath) ? File.ReadAllText(snippetSourcePath) : string.Empty;
            if (script != existing)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(snippetSourcePath));
                File.WriteAllText(snippetSourcePath, script);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Generate the script
        /// </summary>
        internal static void Generate(string systemIdSourcePath, string frameworksFolder)
        {
            // Get latest framework folder
            Frameworks frameworks = new Frameworks(frameworksFolder);
            string frameworkFolder = frameworks.GetNewestVersion().Folder;

            List<string> list = CollectIds(frameworkFolder);
            string ids = string.Join(",\r\n", list.Select(x => string.Format("            \"{0}\"", x)));

            string script = Template.Replace("$$$", ids);
            string existing = File.Exists(systemIdSourcePath) ? File.ReadAllText(systemIdSourcePath) : string.Empty;
            if (script != existing)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(systemIdSourcePath));
                File.WriteAllText(systemIdSourcePath, script);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Generate the script
        /// </summary>
        internal static void Generate(string systemIdSourcePath, string frameworksFolder)
        {
            // Get latest framework folder
            Frameworks frameworks      = new Frameworks(frameworksFolder);
            string     frameworkFolder = frameworks.GetNewestVersion().Folder;

            List <string> list = CollectIds(frameworkFolder);
            string        ids  = string.Join(",\r\n", list.Select(x => string.Format("            \"{0}\"", x)));

            string script   = Template.Replace("$$$", ids);
            string existing = File.Exists(systemIdSourcePath) ? File.ReadAllText(systemIdSourcePath) : string.Empty;

            if (script != existing)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(systemIdSourcePath));
                File.WriteAllText(systemIdSourcePath, script);
            }
        }