예제 #1
0
        private void InstallTemplates()
        {
            Byte[] b            = LocaleHelper.GetFile("SamTemplate0");
            String templatePath = Path.Combine(
                Path.Combine(ProjectPaths.FileTemplatesDirectory, "HaxeProject"), "Resources.xml.fdt");
            String template = UTF8Encoding.Default.GetString(b);

            if (!File.Exists(templatePath))
            {
                using (StreamWriter file = new StreamWriter(templatePath))
                {
                    file.Write(template);
                    file.Close();
                }
            }
            templatePath = Path.Combine(
                Path.Combine(ProjectPaths.FileTemplatesDirectory, "AS3Project"), "Resources.xml.fdt");
            if (!File.Exists(templatePath))
            {
                using (StreamWriter file = new StreamWriter(templatePath))
                {
                    file.Write(template);
                    file.Close();
                }
            }
            String dataPath = Path.Combine(PathHelper.DataDir, "SamHaXePanel");

            if (Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            this.player = Path.Combine(dataPath, "player.swf");
            b           = LocaleHelper.GetFile("MP3Player");
            if (!File.Exists(this.player))
            {
                using (BinaryWriter binWriter =
                           new BinaryWriter(File.Open(this.player, FileMode.Create)))
                {
                    binWriter.Write(b);
                    binWriter.Close();
                }
            }
            b            = LocaleHelper.GetFile("Resource.hx");
            template     = UTF8Encoding.Default.GetString(b);
            templatePath = Path.Combine(dataPath, "Resources.hx.fdt");
            resourceTemplates["haxe"] = templatePath;
            if (!File.Exists(templatePath))
            {
                using (StreamWriter file = new StreamWriter(templatePath))
                {
                    file.Write(template);
                    file.Close();
                }
            }
        }