Esempio n. 1
0
        private void mnuDataRotate90CWSplitVertical_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter       = UI.Properties.Settings.Default.ImageFileFilter;
            openFileDialog.Title        = "Dữ liệu quét cần quay 90CW và cắt đôi theo chiều dọc";
            openFileDialog.Multiselect  = true;
            openFileDialog.AddExtension = true;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = System.IO.Directory.GetParent(openFileDialog.FileNames[0]).ToString() + "\\RS";
                    for (int i = 0; i < openFileDialog.FileNames.Length; i++)
                    {
                        Core.Prepare prepare = new Core.Prepare(openFileDialog.FileNames[i],
                                                                new Core.CoreMsgEventHandler(prepare_CoreMsg));

                        Directory.CreateDirectory(path);
                        prepare.Perform(RotateFlipType.Rotate90FlipNone, Core.Prepare.Clip.Vertical,
                                        path,
                                        openFileDialog.FileNames[i]);
                        toolProgressStrip.Value = (int)Math.Ceiling((i + 1) * 100.0 / openFileDialog.FileNames.Length);
                    }
                    MessageBox.Show("Đã quay-cắt xong");
                    System.Diagnostics.Process.Start(path);
                    toolStatusText.Text = "Xử lý xong.";
                }
                catch (Exception ex) { Core.Utility.Error("Có lỗi khi thực hiện. \n" + ex.Message); }
            }
        }
Esempio n. 2
0
        private void btnWork_Click(object sender, EventArgs e)
        {
            if (txtDest.Text == "" || txtSrc.Text == "")
            {
                Core.Utility.Msg("Nguồn dữ liệu và nơi lưu kết quả cần chọn trước" + Environment.NewLine +
                                 "Nhấn nút duyệt thư mục để chọn.");
                return;
            }
            UseWaitCursor = true;
            Cursor        = Cursors.WaitCursor;
            // Hiện group Log
            groupLog.Location       = groupIllustrate.Location;
            groupIllustrate.Visible = false;
            groupLog.Visible        = true;
            // Lấy danh sách các tệp cần xử lý.
            Core.Automate automate = new Core.Automate();
            automate.CoreMsg += new Core.CoreMsgEventHandler(automate_CoreMsg);
            automate.Folder(txtSrc.Text);
            Core.Prepare.Clip[] c_types = new Core.Prepare.Clip[]
            {
                Core.Prepare.Clip.None,
                Core.Prepare.Clip.Horizon,
                Core.Prepare.Clip.Vertical
            };
            Core.Prepare.Clip clip    = c_types[cropBox.SelectedIndex];
            RotateFlipType[]  r_types = new RotateFlipType[] {
                RotateFlipType.RotateNoneFlipNone,
                RotateFlipType.Rotate90FlipNone,
                RotateFlipType.Rotate180FlipNone,
                RotateFlipType.Rotate270FlipNone
            };
            RotateFlipType rotate = r_types[rotateBox.SelectedIndex];

            if (automate.FileList == null)
            {
                Core.Utility.Error("Không có tệp ảnh quét nào được tìm thấy trong thư mục: \n"
                                   + txtSrc.Text);
                return;
            }
            for (int i = 0; i < automate.FileList.Length; i++)
            {
                Core.Prepare prepare = new Core.Prepare(automate.FileList[i], new Core.CoreMsgEventHandler(automate_CoreMsg));
                prepare.Perform(rotate, clip, txtDest.Text, automate.FileList[i]);
                automate.Inform(this, automate.FileList[i] + " xong" + Environment.NewLine);
                progressBar.Value = (int)Math.Ceiling((i + 1) * 100.0 / automate.FileList.Length);
            }
            UseWaitCursor = false;
            Cursor        = Cursors.Default;
            System.Diagnostics.Process.Start(txtDest.Text);
            this.Close();
        }
Esempio n. 3
0
        public async Task PrepareStrings()
        {
            ILogger <Log.NLogger> logger = new Logger <Log.NLogger>(new NullLoggerFactory());

            DeezerSync.Core.Prepare p = new Core.Prepare(new DeezerSync.Log.NLogger(logger));

            // Playlist List
            List <StandardPlaylist> Playlist = new List <StandardPlaylist>();

            foreach (var i in SoundCloud)
            {
                // Track List
                List <StandardTitle> Titel = new List <StandardTitle>();
                foreach (var a in i.tracks)
                {
                    Titel.Add(await p.PrepareDeezerQuery(a));
                }
                Playlist.Add(new StandardPlaylist {
                    description = i.description, id = i.id, provider = i.provider, title = i.title, tracks = Titel
                });
            }
            await File.WriteAllTextAsync(@"../../../../../DataAnalytics/RawData/PrepareResult.json", JsonConvert.SerializeObject(Playlist, Formatting.Indented));
        }