Exemplo n.º 1
0
        string CreateVideoEntry()
        {
            var clip = Wrap.BlockOfType <YoutubeVideoCommands>().YoutubeClip;

            if (clip != null)
            {
                return(string.Format("\t\t//#video " + clip.Id));
            }
            return("");
        }
Exemplo n.º 2
0
        public void Compile()
        {
            var file = Source.FileForSlide(Wrap);;

            if (!file.Directory.Exists)
            {
                file.Directory.Create();
            }

            if (!file.Exists)
            {
                var content = CreateContent(CreateVideoEntry());
                System.IO.File.WriteAllText(Source.FileForSlide(Wrap).FullName, content);
            }
            else
            {
                var text   = File.ReadAllText(file.FullName);
                var regexp = new Regex("//#video ([a-zA-Z0-9_-]+)");
                var id     = Wrap.BlockOfType <YoutubeVideoCommands>().YoutubeClip.Id;
                text = regexp.Replace(text, "//#video " + id);
                File.WriteAllText(file.FullName, text);
            }
        }