예제 #1
0
        static void Monitor_OnFileChange(object sender, FileSystemEventArgs e)
        {
            try
            {
                Console.WriteLine("Change detected: {0} {1}", e.FullPath, e.ChangeType);

                // LOVE builds must be created at a minimum
                var packer          = new Packer(ConfigHelper.BuildPath, ConfigHelper.SourcePath);
                var createdFilePath = packer.CompressFiles(ConfigHelper.LoveBuildName, ConfigHelper.IgnoredExtensions, ConfigHelper.IgnoredFiles);

                if ((ConfigHelper.CurrentBuildTargets & BuildTargets.Windows) == BuildTargets.Windows)
                {
                    var windowsBuilder = new WindowsBuilder(ConfigHelper.LovePath, ConfigHelper.WindowsBuildPath);
                    windowsBuilder.PrepareDependencies();
                    windowsBuilder.Build(createdFilePath, ConfigHelper.WindowsBuildName);
                }

                if (ConfigHelper.UseBuildNumber)
                {
                    ConfigHelper.IncrementBuildNumber();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error handling file change: {0}", ex.Message);
            }
        }