private string CreateCommentedCode(AnnotationList annotations)
        {
            var file = annotations.Filename + ".phpvhbackup";

            if (!File.Exists(file))
            {
                Cli.WriteLine("Could not find ~Red~{0}~R~", file);
                return(null);
            }

            var code = File.ReadAllText(file);

            var isPhpless = Regex.Matches(code, @"<\?[^=]").Count == 0;

            string commentedCode;

            if (isPhpless)
            {
                var annot = new Annotation()
                {
                    HitCount = annotations.Items.First().HitCount
                };
                commentedCode = CreateComment(annot) + code;
            }
            else
            {
                commentedCode = annotations.Items
                                .OrderByDescending(z => z.Index)
                                .Select(z => new
                {
                    Index   = z.Index,
                    Comment = CreateComment(z)
                })
                                .Where(z => z.Index < code.Length)
                                .Aggregate(
                    new StringBuilder(code),
                    (sb, z) => sb.Insert(z.Index, z.Comment))
                                .ToString();
            }

            return(commentedCode);
        }
 static string GetRelativeCodePath(AnnotationList list)
 {
     return(list.Filename.Substring(Program.Config.WebRoot.Length + 1));
 }
        static string GetPageFilename(AnnotationList list)
        {
            var md5 = new MD5CryptoServiceProvider();

            return(md5.ComputeHash(list.Filename) + ".html");
        }