コード例 #1
0
ファイル: Program.cs プロジェクト: sbruyere/vbeDecoder
        public static void RunOptions(Options opts)
        {
            string result = "";

            if (opts.stdin)
            {
                Stream s = Console.OpenStandardInput();

                result = ScriptDecoder.DecodeStream(s);
            }

            if (opts.InputFiles?.Any() == true)
            {
                foreach (var encodedScript in opts.InputFiles)
                {
                    result = ScriptDecoder.DecodeFile(encodedScript);

                    if (opts.OutputPath == null)
                    {
                        Console.WriteLine();
                        Console.WriteLine($"'############################################################");
                        Console.WriteLine($"'# vbeDecoder - by Sylvain Bruyere ");
                        Console.WriteLine($"'# - Input File: {opts.OutputPath}");
                        Console.WriteLine();
                        Console.WriteLine(result);
                    }
                    else if (Directory.Exists(opts.OutputPath))
                    {
                        string newFilename = ChangeFileName(Path.GetFileName(encodedScript));
                        string oPath       = Path.Combine(opts.OutputPath, newFilename);

                        WriteFileResult(result, oPath);
                    }
                    else
                    {
                        string newFilename = ChangeFileName(Path.GetFileName(encodedScript));
                        string oPath       = opts.OutputPath + "-" + newFilename;

                        WriteFileResult(result, oPath);
                    }
                }
            }
        }
コード例 #2
0
    void Awake()
    {
        if (instance == null)
            instance = this;
        decoder = new ScriptDecoder();
        try
        {

            node = decoder.decode("test_script");
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }
        if (instance != this)
        {
            Destroy(gameObject);
        }
    }