コード例 #1
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            Event evt  = null;
            var   args = Environment.GetCommandLineArgs();

            if (args.Length == 3)
            {
                lbDevice.Text = args[1];
                var eventGuid = getEventGuid();
                lbEvent.Text = eventGuid;
                evt          = EventModel.FindEventByGuid(eventGuid);
                if (evt != null)
                {
                    tbEventName.Text = evt.Name;
                }
            }
            var profiles = NapsProfiles.GetProfileNames();

            foreach (var profile in profiles)
            {
                cbProfiles.Items.Add(profile);
            }
            if (evt != null)
            {
                cbProfiles.SelectedIndex = cbProfiles.FindStringExact(evt.ProfileName);
                var fileName = NapsProfiles.GetAutoSaveFilename(evt.ProfileName);
                lbFileName.Text    = fileName;
                tbFileName.Enabled = fileName.Contains("$(x)");
            }
        }
コード例 #2
0
        private void runProfile(Event evt)
        {
            var naps = new NapsApp();

            naps.SetProfileName(evt.ProfileName);
            var fileName = NapsProfiles.GetAutoSaveFilename(evt.ProfileName);

            if (fileName != null)
            {
                if (fileName.Contains("$(x)"))
                {
                    var frm = new GetFileNameFrm();
                    frm.ProfileName = evt.ProfileName;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        fileName = fileName.Replace("$(x)", frm.Result.Replace(' ', '-'));
                        naps.SetAutoSaveFilename(fileName);
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    naps.UseProfilesAutosaveSettings();
                }
            }
            naps.Run();
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var napsApp  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"NAPS2\NAPS2.Console.exe");
            var fileName = NapsProfiles.GetAutoSaveFilename(GetSelectedProfileName());
            var args     = "-p \"" + GetSelectedProfileName() + "\"";

            if (fileName.Contains("$(x)"))
            {
                fileName = fileName.Replace("$(x)", tbFileName.Text.Replace(' ', '-'));
                args    += " -o \"" + fileName + "\"";
            }
            else
            {
                args += " -a";
            }
            MessageBox.Show(args);
            var p = new Process();

            p.StartInfo.FileName  = napsApp;
            p.StartInfo.Arguments = args;
            p.Start();
        }