in plugin/:
[moon.git] / src / fullscreen / fullscreen.cs
blob3bd6fbe676edd6da856092a6337e86875a6444d2
1 using System;
2 using System.IO;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Text;
7 class convert {
8 static int Main (string [] args)
10 try {
11 string sourcefile;
12 if (args.Length == 0)
13 sourcefile = "fullscreen.xaml";
14 else
15 sourcefile = args [0];
16 string destfile = Path.ChangeExtension (sourcefile, ".h");
17 string [] source = File.ReadAllLines (sourcefile);
18 List<string> dest = new List <string> ();
20 dest.Add (@"/*
21 * fullscreen.h: the xaml for the fullscreen message.
23 * Contact:
24 * Moonlight List (moonlight-list@lists.ximian.com)
26 * Copyright 2007 Novell, Inc. (http://www.novell.com)
28 * See the LICENSE file included with the distribution for details.
30 */");
32 dest.Add ("#define FULLSCREEN_MESSAGE \\");
34 for (int i = 0; i < source.Length; i++) {
35 int j;
36 StringBuilder sb = new StringBuilder ();
37 /* put the leading whitespace in the file */
38 for (j = 0; j < source[i].Length; j ++) {
39 if (!Char.IsWhiteSpace (source[i], j))
40 break;
42 if (j > 0) sb.Append (source[i].Substring (0, j));
43 sb.Append ("\"" + source [i].Substring (j).Replace ("\"", "\\\"") + (source[i][source[i].Length-1] == '>' ? "" : " ") + "\" \\");
44 dest.Add (sb.ToString());
46 dest.Add ("\"\"");
47 dest.Add ("");
48 File.WriteAllLines (destfile, dest.ToArray ());
50 return 0;
51 } catch (Exception ex) {
52 Console.WriteLine (ex.Message);
53 Console.WriteLine (ex.StackTrace);
54 return 1;