Esempio n. 1
0
        static int Main(string[] args)
        {
            if (args.Length >= 2)
            {
                string inputDirectory = args[0];
                string outputDirectory = args[1];

                if (!Directory.Exists(outputDirectory))
                {
                    try
                    {
                        Directory.CreateDirectory(outputDirectory);
                    }
                    catch
                    {
                        return 1;
                    }
                }
                else if(Directory.Exists(inputDirectory))
                {
                    Console.WriteLine(string.Format("Compiling\n{0}\nto\n{1}",inputDirectory, outputDirectory));
                    ContentBuilder builder = new ContentBuilder();
                    builder.Clear();
                    builder.OnOutput += WriteLine;
                    builder.BuildAssets(inputDirectory, outputDirectory, false);
                    builder.OnOutput -= WriteLine;

                    DirectoryInfo inputDirectoryInfo = new DirectoryInfo(inputDirectory);
                    List<FileInfo> moveFiles = new List<FileInfo>();
                    moveFiles.AddRange(inputDirectoryInfo.GetFiles("*.txt"));

                    foreach (FileInfo filename in moveFiles)
                    {
                        Console.WriteLine(filename.Name);
                        filename.CopyTo(outputDirectory + "\\" + filename.Name, true);
                    }
                }
                else
                {
                    Console.WriteLine("Input directory does not exist");
                    return 1;
                }
            }
            else
            {
                Console.WriteLine("Usage: ContentCompiler.exe [ ? | inputDirectory outputDirectory ]");
                return 1;
            }
            return 0;
        }
        private void BuildAndLoad(string filename, ContentManager content, GraphicsDevice device)
        {
            content.Unload();

            if (File.Exists(compiledName))
            {
                File.Delete(compiledName);
            }

            ContentBuilder builder = new ContentBuilder();
            builder.BuildSingleAsset(FileName);

            FileInfo info = new FileInfo(filename);
            FileInfo compiledFileInfo = new FileInfo(info.Directory.FullName + "\\temp.xnb");

            compiledName = compiledFileInfo.FullName;

            content.RootDirectory = info.Directory.FullName;
            currentTexture = content.Load<Texture2D>("temp");
            debugTex = new Texture2D(device, 1, 1, false, SurfaceFormat.Color);
            uint[] white = new uint[1];
            white[0] = Color.White.PackedValue;
            debugTex.SetData<uint>(white);

            rectangle = content.Load<Texture2D>("grid");

            CreateFileWatcher(info);
        }
Esempio n. 3
0
 public BuilderViewModel()
 {
     contentBuilder = new ContentBuilder();
     LoadConfiguredValues();
 }