Esempio n. 1
0
        public static void Watch(string project_root_path)
        {
            reloadCachePaks     = new Dictionary <string, ResourcePak>();
            resourcePakMap      = new Dictionary <string, string>();
            resourceManifestMap = new Dictionary <string, ResourceManifest>();
            newResourcesToAdd   = new List <string>();

            content_path = PathUtils.GetLocalPath(project_root_path, Constants.CONTENT_FOLDER);

            if (!Directory.Exists(content_path))
            {
                throw new Exception("Invalid Project : Missing Content Folder");
            }

            LoadContentManifest();

            ContentBuilder.Build(project_root_path);

            using (var watcher = new FileSystemWatcher())
            {
                watcher.Path = content_path;

                watcher.IncludeSubdirectories = true;

                watcher.NotifyFilter =
                    NotifyFilters.LastWrite |
                    NotifyFilters.FileName |
                    NotifyFilters.DirectoryName;

                watcher.Filter = "*.*";

                watcher.Changed += Watcher_Changed;
                watcher.Deleted += Watcher_Changed;
                watcher.Renamed += Watcher_Renamed;

                watcher.EnableRaisingEvents = true;

                ConsoleUtils.ShowInfo($"Now Watching Project on {project_root_path} for changes. Press 'q' to quit.");

                while (Console.Read() != 'q')
                {
                    Thread.Sleep(1);
                }
            }
        }
Esempio n. 2
0
 private static void ExecBuild(string project_root_path)
 {
     if (Directory.Exists(project_root_path))
     {
         try
         {
             ContentBuilder.Build(project_root_path);
             ConsoleUtils.ShowSuccess("Project Built Successfully.");
         }
         catch (Exception e)
         {
             ConsoleUtils.ShowError($"An error ocurred: {e.Message} :: {e.StackTrace}");
         }
     }
     else
     {
         ConsoleUtils.ShowError($"Invalid Path: {project_root_path}");
     }
 }