Ejemplo n.º 1
0
        public static void SelectFile()
        {
            _colorify.Clear();

            try
            {
                Section.Header("PROJECT", "SELECT FILE");

                string dirPath = _path.Combine(_config.path.development, _config.path.workspace, _config.path.project, _config.personal.selected.project, _config.project.androidPath, _config.project.androidBuildPath);
                dirPath.Exists("Please review your configuration file or make a build first.");
                List <string> files = dirPath.Files($"*{_config.project.androidBuildExtension}", "Please make a build first.", SearchOption.AllDirectories);

                if (files.Count < 1)
                {
                    _config.personal.selected.path        = "";
                    _config.personal.selected.file        = "";
                    _config.personal.selected.packageName = "";
                    _config.personal.selected.versionCode = "";
                    _config.personal.selected.versionName = "";
                }
                else
                {
                    var i = 1;
                    foreach (var file in files)
                    {
                        string f = file;
                        _colorify.WriteLine($" {i,2}] {_path.GetFileName(f)}", txtPrimary);
                        i++;
                    }
                }

                _colorify.BlankLines();
                _colorify.WriteLine($"{"[EMPTY] Cancel",82}", txtDanger);

                Section.HorizontalRule();

                _colorify.Write($"{" Make your choice:",-25}", txtInfo);
                string opt = Console.ReadLine().Trim();

                if (!String.IsNullOrEmpty(opt))
                {
                    Number.IsOnRange(1, Convert.ToInt32(opt), files.Count);
                    var sel = files[Convert.ToInt32(opt) - 1];
                    _config.personal.selected.path        = _path.Split(_path.GetDirectoryName(sel), dirPath);
                    _config.personal.selected.file        = _path.GetFileName(sel);
                    _config.personal.selected.mapping     = _config.personal.selected.file.Replace(_config.project.androidBuildExtension, _config.project.androidMappingSuffix);
                    _config.personal.selected.packageName = BuildTools.CmdGetPackage(sel, "name", 1);
                    _config.personal.selected.versionCode = BuildTools.CmdGetPackage(sel, "versionCode", 2);
                    _config.personal.selected.versionName = BuildTools.CmdGetPackage(sel, "versionName", 3);
                }

                Menu.Start();
            }
            catch (Exception Ex)
            {
                Exceptions.General(Ex);
            }
        }
Ejemplo n.º 2
0
 public static void Upgrade()
 {
     try
     {
         BuildTools.Upgrade();
     }
     catch (Exception Ex)
     {
         Exceptions.General(Ex);
     }
 }