Exemplo n.º 1
0
        public void init(PNGModel model, FileSaveCallback fileSaveCallback)
        {
            this._model            = model;
            this._fileSaveCallback = fileSaveCallback;
            if (_model.isReplace)
            {
                doStartWithReplace();
            }
            else if (_model.isSaveAs)
            {
                doStartWithSaveAs();
            }


            foreach (string file in Directory.EnumerateFiles(_model.RootPath, "*.png"))
            {
                var contents = File.ReadAllText(file);
                Console.WriteLine(contents.Length + "");
            }
        }
Exemplo n.º 2
0
        private void brnStart_Click(object sender, EventArgs e)
        {
            if (edtRootPath.Text.Equals(""))
            {
                MessageBox.Show("Root Path Is Emty", "ERROR");
                return;
            }

            /*if (edtKeyword.Text.Equals(""))
             * {
             *  MessageBox.Show("Keyword Is Emty", "ERROR");
             *  return;
             * } */
            if (radSaveAs.Checked)
            {
                if (edtPathSaveAs.Text.Equals(""))
                {
                    MessageBox.Show("Save Path Is Emty", "ERROR");
                    return;
                }
            }
            List <SortModel> _listSortModel = new List <SortModel>();

            if (!edtPathKewordFilter.Text.Equals(""))
            {
                try
                {
                    string[] lines = File.ReadAllLines(edtPathKewordFilter.Text.Trim());
                    foreach (string line in lines)
                    {
                        if (!line.Equals(""))
                        {
                            SortModel _sortModel = new SortModel();
                            _sortModel.Keywords       = line;
                            _sortModel.PathSave       = edtPathSaveAs.Text.Trim();
                            _sortModel.RootPath       = edtRootPath.Text.Trim();
                            _sortModel.IsCreateFolder = true;
                            _listSortModel.Add(_sortModel);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            RunModel _runModel = new RunModel();

            PNGModel model = new PNGModel();

            model.RootPath   = edtRootPath.Text.ToString().Trim();
            model.isReplace  = radReplace.Checked;
            model.isSaveAs   = radSaveAs.Checked;
            model.Keywords   = edtKeyword.Text;
            model.PathSaveAs = edtPathSaveAs.Text.ToString().Trim();

            _runModel.SortModels = _listSortModel;
            _runModel.PNGModel   = model;

            RenameController _renameController = new RenameController(_runModel, this);

            _renameController.Start();
        }