Exemplo n.º 1
0
        public override void Notificar(IntArgs args)
        {
            Projeto projeto = projetos[args.valor];

            Vista.Hide();
            Vista.Close();
            new RealizarDespacho(projeto);
        }
        public override void Notificar(IntArgs args)
        {
            Projeto projeto = projetos[args.valor];

            Vista.Hide();
            Vista.Close();
            EmitirParecerTecnico emitirParecerTecnico = new EmitirParecerTecnico(projeto);
        }
Exemplo n.º 3
0
        public override void Notificar(IntArgs args)
        {
            Projeto projeto = projetos[args.valor];

            Vista.Hide();
            Vista.Close();
            RealizarPagamento realizarPagamento = new RealizarPagamento(projeto);
        }
Exemplo n.º 4
0
        public override void Notificar(IntArgs args)
        {
            Projeto projeto = projetos[args.valor];

            Vista.Hide();
            Vista.Close();
            new AlterarDados(projeto);
        }
Exemplo n.º 5
0
        public override void Notificar(IntArgs args)
        {
            Projeto projeto = projetos[args.valor];

            Vista.Hide();
            Vista.Close();
            new AprovacaoReforco(projeto);
        }
Exemplo n.º 6
0
        public override void Notificar(IntArgs args)
        {
            Projeto projeto    = projetos[args.valor];
            String  estado     = servicoObterEstados.ObterEstado(projeto.estado).estado1;
            String  estadoNovo = Utils.EstadoParaString(MaquinaDeEstados.processar(
                                                            Utils.StringParaEstado(estado),
                                                            EventosProjeto.despacho_aprovado));

            projeto.estado = servicoObterEstados.ObterIdEstado(estadoNovo);
            servicoProjetos.AtualizarProjeto(projeto);
            Vista.Hide();
            Vista.Close();
        }
Exemplo n.º 7
0
        private static bool ExtractIntFile(IntArgs args, LogInfo log)
        {
            Console.Clear();
            DrawLogo();
            WriteLog(log, false);
            Console.WriteLine($"Extracting {args.IntFile}:");
            LogMessage(log, $"Extracting {args.IntFile}", args.Game);
            string inputDir = args.InputDir;

            if (string.IsNullOrEmpty(args.InputDir))
            {
                inputDir = args.Game?.Path;
            }
            string outputDir = args.OutputDir;

            if (!string.IsNullOrEmpty(args.OutputDirAfter))
            {
                outputDir = Path.Combine(args.OutputDir,
                                         args.Game.Name(), args.OutputDirAfter);
            }

            int line           = Console.CursorTop;
            int lastLineLength = 0;

            try {
                Extracting.ExtractInt(inputDir, args.IntFile,
                                      args.Game.GetExtractExe(inputDir), outputDir,
                                      (a) => {
                    WriteProgress(line, ref lastLineLength, a);
                    return(false);
                });
                LogMessage(log, "Finished!");
                Beep();
                return(true);
            }
            catch (Exception ex) {
                if (args.Game != null)
                {
                    log.GamesFailed.Add(args.Game);
                }
                WriteError(ex);
                LogMessage(log, $"Error: {ex.Message}", args.Game);
                log.WriteLine(ex.ToString());
                Beep(300, 750);
                Thread.Sleep(1500);
                return(false);
            }
        }
Exemplo n.º 8
0
        public override void Notificar(IntArgs args)
        {
            Projeto projeto = projetos[args.valor];

            servicoHistorico.CriarHistorico(new Historico
            {
                id_projeto = projeto.id,
                estado     = projeto.estado
            });
            String estado     = servicoObterEstados.ObterEstado(projeto.estado).estado1;
            String estadoNovo = Utils.EstadoParaString(MaquinaDeEstados.processar(Utils.StringParaEstado(estado), EventosProjeto.reenquadrar));

            projeto.estado = servicoObterEstados.ObterIdEstado(estadoNovo);
            servicoProjetos.AtualizarProjeto(projeto);
            Vista.Hide();
            Vista.Close();
        }
 private static void LogOperation(IntArgs args, LogInfo log)
 {
 }
        private static IntArgs RequestExtractIntArgs(Game game)
        {
            IntArgs args = new IntArgs()
            {
                Game = game,
            };

            if (game != null)
            {
                Console.WriteLine($"Extract {game.Name()} Int Archive:");
            }
            else
            {
                Console.WriteLine($"Extract Int Archive:");
            }

            bool parseSuccess;

            if (game != Game.All)
            {
                do
                {
                    Console.Write("Input Directory: ");
                    if (game.Path != null)
                    {
                        WriteWatermark("<located path>");
                    }
                    args.InputDir = ReadDirectory(game.Path, out parseSuccess);
                } while (!parseSuccess);
            }

            string defOutputDir = Path.Combine(game.Name(), settings.Directories.IntDirectory);

            do
            {
                if (game == Game.All)
                {
                    defOutputDir = ".";
                    Console.Write("Output Directory (Before game name): ");
                    WriteWatermark("<current directory>");
                }
                else
                {
                    Console.Write("Output Directory: ");
                    WriteWatermark(defOutputDir);
                }
                args.OutputDir = ReadDirectory(defOutputDir, out parseSuccess);
            } while (!parseSuccess);

            if (game == Game.All)
            {
                defOutputDir = settings.Directories.IntDirectory;
                do
                {
                    Console.Write("Output Directory (After game name): ");
                    WriteWatermark(defOutputDir);
                    args.OutputDirAfter = ReadRelativePath(defOutputDir, out parseSuccess);
                } while (!parseSuccess);
            }

            do
            {
                Console.Write("Int File: ");
                WriteWatermark("image*.int");
                args.IntFile = ReadPattern("image*.int", out parseSuccess);
            } while (!parseSuccess);
            if (!args.IntFile.EndsWith(".int", StringComparison.OrdinalIgnoreCase) &&
                !args.IntFile.EndsWith(".int*", StringComparison.OrdinalIgnoreCase))
            {
                args.IntFile += ".int";
            }

            return(args);
        }
Exemplo n.º 11
0
        private static void Run(string[] args)
        {
            Console.Clear();
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Title           = "Grisaia Extract (Ripping written by asmodean)";
            DrawLogo();
            settings = new UserSettings();
            settings.Load();
            if (!string.IsNullOrWhiteSpace(settings.Directories.CurrentDirectory) &&
                !PathHelper.IsValidDirectory(settings.Directories.CurrentDirectory))
            {
                WriteError("CurrentDirectory ini setting is not valid!");
                settings.Directories.CurrentDirectory = "";
            }
            if (!PathHelper.IsValidRelativePath(settings.Directories.IntDirectory))
            {
                WriteError("IntDirectory ini setting is not valid!");
                settings.Directories.IntDirectory = "Raw";
            }
            if (!PathHelper.IsValidRelativePath(settings.Directories.Hg3Directory))
            {
                WriteError("IntDirectory ini setting is not valid!");
                settings.Directories.Hg3Directory = "Hg3";
            }
            foreach (var pair in settings.GameLocations.Paths)
            {
                if (pair.Value == null)
                {
                    continue;
                }
                if (!PathHelper.IsValidDirectory(pair.Value))
                {
                    WriteError($"{pair.Key} ini setting is not valid!");
                    Locator.SetPath(null, pair.Key);
                }
            }
            if (!string.IsNullOrWhiteSpace(settings.Directories.CurrentDirectory))
            {
                Directory.CreateDirectory(settings.Directories.CurrentDirectory);
                Directory.SetCurrentDirectory(settings.Directories.CurrentDirectory);
            }
            bool parseSuccess;

            bool hg3    = false;
            bool resort = false;

            do
            {
                Console.Write("What to Extract (int/hg3/resort): ");
                string input = ReadLine();
                parseSuccess = true;
                if (input.Equals2("int", true))
                {
                    hg3 = false;
                }
                else if (input.Equals2("hg3", true))
                {
                    hg3 = true;
                }
                else if (input.Equals2("resort", true))
                {
                    resort = true;
                }
                else
                {
                    WriteError("Invalid choice!");
                    parseSuccess = false;
                }
            } while (!parseSuccess);
            Game    game    = ReadGame(hg3 || resort);
            IntArgs intArgs = new IntArgs();
            Hg3Args hg3Args = new Hg3Args();
            PngArgs pngArgs = new PngArgs();
            bool    alsoHg3 = false;

            if (resort)
            {
                pngArgs = RequestResortPngArgs(game);
            }
            else if (!hg3)
            {
                intArgs = RequestExtractIntArgs(game);

                if (intArgs.IsImage)
                {
                    do
                    {
                        Console.Write("Convert hg3s afterwords (y/n): ");
                        alsoHg3 = ReadYesNo(null, out parseSuccess);
                    } while (!parseSuccess);
                }
            }
            if (hg3 || alsoHg3)
            {
                if (alsoHg3)
                {
                    hg3Args = RequestConvertHg3Args(game, intArgs);
                }
                else
                {
                    hg3Args = RequestConvertHg3Args(game);
                }
            }
            using (LogInfo log = new LogInfo()) {
                if (game != Game.All)
                {
                    RipGame(game, hg3, alsoHg3, resort, intArgs, hg3Args, pngArgs, log);
                }
                else
                {
                    foreach (Game located in Locator.LocateGames(out _))
                    {
                        RipGame(located, hg3, alsoHg3, resort, intArgs, hg3Args, pngArgs, log);
                    }
                }

                if (log.OperationsComplete > 1)
                {
                    Console.Clear();
                    DrawLogo();
                    WriteLog(log, true);
                }
            }
        }
Exemplo n.º 12
0
 private static void RipGame(Game game, bool hg3, bool alsoHg3, bool resort,
                             IntArgs intArgs, Hg3Args hg3Args, PngArgs pngArgs, LogInfo log)
 {
     if (resort)
     {
         pngArgs.Game = game;
         ResortPngs(pngArgs, log);
         log.OperationsComplete++;
         log.GamesComplete++;
     }
     else if (!hg3)
     {
         intArgs.Game = game;
         // Continue to the next process on success
         string inputDir = intArgs.InputDir;
         if (string.IsNullOrEmpty(intArgs.InputDir))
         {
             inputDir = intArgs.Game?.Path;
         }
         string[] intFiles = Directory.GetFiles(inputDir, intArgs.IntFile);
         if (intFiles.Length == 0)
         {
             LogMessage(log, $"No int files found matching `{intArgs.IntFile}`!", game);
             WriteError($"No int files found matching `{intArgs.IntFile}`!");
             Beep(300, 750);
             Thread.Sleep(1500);
             log.GamesFailed.Add(game);
             log.OperationsComplete++;
         }
         else
         {
             bool error = false;
             for (int i = 0; i < intFiles.Length; i++)
             {
                 string intFile = Path.GetFileName(intFiles[i]);
                 intArgs.IntFile = intFile;
                 if (!ExtractIntFile(intArgs, log))
                 {
                     error = true;
                 }
                 log.OperationsComplete++;
             }
             if (!error)
             {
                 if (alsoHg3)
                 {
                     hg3 = true;
                 }
                 else
                 {
                     log.GamesComplete++;
                 }
             }
         }
     }
     if (hg3)
     {
         hg3Args.Game = game;
         if (ConvertHg3s(hg3Args, log))
         {
             log.GamesComplete++;
         }
         log.OperationsComplete++;
     }
 }
Exemplo n.º 13
0
 public override void Notificar(IntArgs args)
 {
     Vista.Hide();
     Vista.Close();
     new ReforcoDeFinanciamento(projetos[args.valor]);
 }