Beispiel #1
0
 private void WriteStoryboard(String folder)
 {
     using (TextWriter tw = new StreamWriter(Path.Combine(folder, GetOsbPath()))) {
         var code = SB.GenerateCode();
         Trace.Write(code);
         tw.Write(code);
     }
 }
Beispiel #2
0
        private void WriteMapStoryboard(string folder, Map map)
        {
            var code = SB.GenerateCode();

            Trace.Write(code);

            var diffContents = "";

            using (var streamReader = new StreamReader(Path.Combine(folder, map.Path))) {
                diffContents = streamReader.ReadToEnd();
            }

            var beginning = "//Storyboard Layer 0 (Background)";
            var end       = "//Storyboard Sound Samples";

            var contentsBeginning = diffContents.IndexOf(beginning);
            var contentsEnd       = diffContents.IndexOf(end);

            var codeBeginning = code.IndexOf(beginning);
            var codeEnd       = code.IndexOf(end);

            var updatedDiffContents = diffContents.Substring(0, contentsBeginning);

            updatedDiffContents += code.Substring(codeBeginning, codeEnd - codeBeginning);
            updatedDiffContents += diffContents.Substring(contentsEnd, diffContents.Length - contentsEnd);
            if (IsWidescreen())
            {
                updatedDiffContents = updatedDiffContents.Replace("WidescreenStoryboard: 0", "WidescreenStoryboard: 1");
            }
            else
            {
                updatedDiffContents = updatedDiffContents.Replace("WidescreenStoryboard: 1", "WidescreenStoryboard: 0");
            }

            using (TextWriter tw = new StreamWriter(Path.Combine(folder, map.Path))) {
                tw.Write(updatedDiffContents);
            }
        }