Beispiel #1
0
        /// <summary>
        /// Generate CreateLesson.html file which is added to Document Libraries to enable the creation of Grava Lessons
        /// </summary>
        static void GenerateCreateLessonStub()
        {
            if (Directory.Exists(_exeDirectory + @"\AuthoringBin\")) // Only generate CreateLesson if Authoring is installed
            {
                Console.WriteLine(Strings.GeneratingCreateLessonStub, GetServerName());

                using (Stream htmlStream = new MemoryStream())
                {
                    string launchUrl = "/Services/Authoring/Authoring.application?" +
                                       "DocumentLibrary=\" + documentLibraryUrl + \"" +
                                       "&New=/Services/NewLesson.grproj";

                    string redirectHtml = ContentService.GenerateRedirectStub("Create new lesson", "Grava Authoring", launchUrl);

                    string servicesDirectory = new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName;
                    using (FileStream fs = File.OpenWrite(Path.Combine(servicesDirectory, "CreateLesson.html")))
                    {
                        using (StreamWriter sw = new StreamWriter(fs))
                        {
                            sw.Write(redirectHtml);
                            sw.Flush();
                        }
                    }
                }
            }
        }