private async Task StepCopyFiles(ComposeSettings settings)
        {
            Io.CreateDirIfNotExist(settings.CefSharpEnvPath);
            var copyWorker = new CopyWorkerService(settings);

            foreach (var p in settings.Nugets)
            {
                await copyWorker.CopyOne(p);
            }
        }
Beispiel #2
0
        private async Task DownloadOneNuget(ComposeSettings settings, NugetInfo n, string fileName)
        {
            var dl      = new DownloadTool(_progressFn);
            var url     = $"https://www.nuget.org/api/v2/package/{n.Name}/{n.Version}";
            var dstFile = Path.Combine(settings.TmpDownloadPath, fileName);

            if (File.Exists(dstFile) == false)
            {
                await dl.DownloadFileAsync(url, dstFile);
            }
        }
Beispiel #3
0
        private async Task StepCopyFiles(ComposeSettings settings)
        {
            Io.CreateDirIfNotExist(settings.CefSharpEnvPath);
            var copyWorker = new CopyWorkerService(settings, _progressFn);

            foreach (var p in settings.Nugets)
            {
                _logFn($"Copy '{p.Name}'");
                await copyWorker.CopyOne(p);
            }
        }
 private void StepExtractNugets(ComposeSettings settings)
 {
     foreach (var p in settings.Nugets)
     {
         var dir  = $"{p.Name}.{p.Version}";
         var file = $"{dir}.nupkg";
         var src  = Path.Combine(settings.TmpDownloadPath, file);
         var dst  = Path.Combine(settings.TmpExtractionPath, dir);
         Io.CreateDirIfNotExist(dst);
         ExtractTool.ExtractZipToDirectory(src, dst);
     }
 }
        public async Task Do()
        {
            var settings = new ComposeSettings(_registry);

            Init(settings);
            await StepGetNugetPackages(settings);

            StepExtractNugets(settings);
            await StepCopyFiles(settings);

            Clean(settings);
        }
Beispiel #6
0
        public async Task Do()
        {
            _logFn($"Begin create package: {_registry.CefSharpPackageName}");
            var settings = new ComposeSettings(_registry);

            Init(settings);
            await StepGetNugetPackages(settings);

            StepExtractNugets(settings);
            await StepCopyFiles(settings);

            Clean(settings);
            _logFn("Done");
        }
 private async Task StepGetNugetPackages(ComposeSettings settings)
 {
     foreach (var p in settings.Nugets)
     {
         var file  = $"{p.Name}.{p.Version}.nupkg";
         var path  = Path.Combine(settings.LocalNugetSourcePath, p.Name, p.Version);
         var local = Path.Combine(path, file);
         if (File.Exists(local) && settings.UseLocalNugetSource)
         {
             var dst = Path.Combine(settings.TmpDownloadPath, file);
             await Io.CopyFileAsync(local, dst);
         }
         else
         {
             await DownloadOneNuget(settings, p, file);
         }
     }
 }
Beispiel #8
0
        private ComposeSettings getComposeSettingFromPreference()
        {
            ComposeSettings composeSetting = new ComposeSettings();

            if ((Preference.Get("compose.randomKeyEnable") == "1"))
            {
                composeSetting.randomKeyEnable  = true;
                composeSetting.minorKeyEnable   = (Preference.Get("compose.minorKeyEnable") == "1");
                composeSetting.sharpedKeyEnable = (Preference.Get("compose.sharpedKeyEnable") == "1");
            }
            else
            {
                composeSetting.keyDegree    = Int16.Parse(Preference.Get("compose.keyDegree"));
                composeSetting.minorKeyFlag = (Preference.Get("compose.minorKeyFlag") == "1");
            }
            composeSetting.substituteChordEnable = (Preference.Get("compose.substituteChordEnable") == "1");

            return(composeSetting);
        }
Beispiel #9
0
        private void runToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <String> errors = new List <String>();

            if (!validateInput(errors))
            {
                errorMessage.Text = "";
                foreach (String errorStr in errors)
                {
                    errorMessage.Text += errorStr + "\n";
                }

                ControllerEffect.SlideDown effect = new ControllerEffect.SlideDown(ErrorMessagePanel, 150, 50);
                tickHandlers.Add(effect);
                return;
            }


            loadPreferenceFromInput();

            song = new Song(Int16.Parse(Preference.Get("compose.barCount")));

            ChordTypeMapper chordTypeMapper = new ChordTypeMapper();

            chordTypeMapper.Map(song);

            ComposeSettings composeSetting = getComposeSettingFromPreference();
            ChordMapper     chordMapper    = new ChordMapper(composeSetting);

            chordMapper.Map(song);

            FlatSecondFilter flatSecondFilter = new FlatSecondFilter(Int16.Parse(Preference.Get("base_line_filter.frequency")));

            flatSecondFilter.Run(song);

            DominantFilter dominantFilter = new DominantFilter(Int16.Parse(Preference.Get("dominant_filter.frequency")));

            dominantFilter.Run(song);

            canvas.Invalidate();
        }
Beispiel #10
0
 public CopyWorkerService(ComposeSettings composeSettings, Action <int> progressFn)
 {
     _composeSettings = composeSettings;
     _progressFn      = progressFn;
 }
Beispiel #11
0
 private static void Clean(ComposeSettings settings)
 {
     Io.RemoveFolder(settings.TmpDownloadPath);
     Io.RemoveFolder(settings.TmpExtractionPath);
     Io.RemoveFolder(settings.TmpPath);
 }
Beispiel #12
0
 private static void Init(ComposeSettings settings)
 {
     Io.CreateDirIfNotExist(settings.CefSharpEnvPath);
     Io.CreateDirIfNotExist(settings.TmpDownloadPath);
     Io.CreateDirIfNotExist(settings.TmpExtractionPath);
 }
 public CopyWorkerService(ComposeSettings composeSettings)
 {
     _composeSettings = composeSettings;
 }