Esempio n. 1
0
        public bool CheckFolders(CommandProcess process)
        {
            var missionFolder = process.computer.fileSystem.RootFile.GetFile("mission");

            if (missionFolder == null || !missionFolder.IsFolder())
            {
                process.Print("No mission daemon folder was found ! (Contact the admin of this node to create one as the mission board is useless without one)");
                return(false);
            }
            var accountFile = missionFolder.GetFile("accounts.db");

            if (accountFile == null)
            {
                process.Print("No accounts file was found ! (Contact the admin of this node to create one as the mission board is useless without one)");
                return(false);
            }
            var missionFile = missionFolder.GetFile("missions.db");

            if (accountFile == null)
            {
                process.Print("No missions file was found ! (Contact the admin of this node to create one as the mission board is useless without one)");
                return(false);
            }
            return(true);
        }
 public void Handle(RemoveCreditCardCommand command)
 {
     CommandProcess
     .Start(command.Email)
     .Execute(account => account.RemoveCreditCard(command.Creditcard))
     .Complete();
 }
Esempio n. 3
0
 public void Handle(PurchasePayPerViewCommand command)
 {
     CommandProcess
     .Start(command.Email)
     .Execute(account => account.PurchasePayPerView(command.MovieId))
     .Complete();
 }
Esempio n. 4
0
 public void Handle(StartSubscriptionCommand command)
 {
     CommandProcess
     .Start(command.Email)
     .Execute(account => account.StartSubscription())
     .Complete();
 }
Esempio n. 5
0
 private static void DownloadFFmpegThreadFunction(string downloadUrl, string savePath)
 {
     UnityEngine.Debug.Log("Download FFmpeg in the background, please wait a few minutes until complete...");
     CommandProcess.Run("curl", downloadUrl + " --output " + "\"" + savePath + "\"");
     GrantFFmpegPermissionForOSX();
     UnityEngine.Debug.Log("Download FFmpeg complete!");
 }
Esempio n. 6
0
        private static void GrantFFmpegPermissionForOSX()
        {
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
            CommandProcess.Run("chmod", "a+x " + "\"" + Config.macOSFFmpegPath + "\"");
            UnityEngine.Debug.Log("Grant permission for: " + Config.macOSFFmpegPath);
#endif
        }
Esempio n. 7
0
        public PlayerLoginCommand(INotificationCenter notificationManager)
        {
            this.passwordProcessor = new CharacterPasswordProcessor();
            this.nameProcessor     = new CharacterNameProcessor(notificationManager, this.passwordProcessor);
            this.nameRequestor     = new CharacterNameRequestor(notificationManager, this.nameProcessor);

            this.currentProcessor    = this.nameRequestor;
            this.notificationManager = notificationManager;
        }
Esempio n. 8
0
        private void btnDecompile_Click(object sender, EventArgs e)
        {
            if (!File.Exists(tbApkPath.Text))
            {
                MessageBox.Show("源文件不存在");
                tbApkPath.Focus();
                return;
            }

            if (rbPlatformAndroid.Checked)
            {
                if (!tbApkPath.Text.EndsWith(".apk"))
                {
                    MessageBox.Show("源文件必须为apk文件");
                    tbApkPath.Focus();
                    return;
                }
            }
            else if (rbPlatformWinPhone.Checked)
            {
                if (!tbApkPath.Text.EndsWith(".xap"))
                {
                    MessageBox.Show("源文件必须为xap文件");
                    tbApkPath.Focus();
                    return;
                }
            }

            cmd = new CommandProcess(config);
            cmd.OutputDataReceived += DataReceived;
            cmd.SourceFile          = tbApkPath.Text;
            cmd.Package             = config.PackageList[cbPackageName.SelectedIndex];
            List <String> channelIds = new List <string>();

            thread = new Thread(new ThreadStart(delegate()
            {
                if (rbPlatformAndroid.Checked)
                {
                    cmd.runAndroidDecompile();
                }
                else if (rbPlatformWinPhone.Checked)
                {
                    cmd.runWinPhoneDecompile();
                }
                this.Invoke((ThreadStart) delegate()
                {
                    cbEnableVersionName.Checked = false;
                    tbVersionName.Text          = cmd.VersionName;
                    tbVersionCode.Text          = cmd.VersionCode.ToString();
                    MessageBox.Show(this, "反编译完成");
                });
            }));
            thread.IsBackground = true;
            thread.Start();
        }
Esempio n. 9
0
        /// <summary>
        /// Executes a command line operation and returns <c>true</c> if there was no standard error reported.
        /// </summary>
        /// <param name="fileName">Command line file name to execute.</param>
        /// <param name="arguments">Command line arguments to use, if any.</param>
        /// <param name="standardOutput">Any standard output reported by the command line operation.</param>
        /// <param name="standardError">Any standard error reported by the command line operation.</param>
        /// <param name="processCompleted">Flag that determines if process completed or timed-out. This is only relevant if <paramref name="timeout"/> is not -1.</param>
        /// <param name="exitCode">Exit code of the process, assuming process successfully completed.</param>
        /// <param name="timeout">Timeout, in milliseconds, to wait for command line operation to complete. Set to <see cref="Timeout.Infinite"/>, i.e., -1, for infinite wait.</param>
        /// <returns><c>true</c> if there was no standard error reported; otherwise, <c>false</c>.</returns>
        public static bool Execute(string fileName, string?arguments, out string standardOutput, out string standardError, out bool processCompleted, out int exitCode, int timeout)
        {
            using CommandProcess process = new CommandProcess(fileName, arguments ?? "");

            processCompleted = process.Execute(timeout);
            standardOutput   = process.StandardOutput;
            standardError    = process.StandardError;
            exitCode         = process.ExitCode;

            return(string.IsNullOrWhiteSpace(standardError));
        }
        public static void SendCommand(this Control control, List <ConnectionRow> connections, bool errorsInRow, CommandMetaData commandMetaData, params object[] args)
        {
            using (ProgressDialog dialog = new ProgressDialog()
            {
                ProgressMessage = $"Sending command to {connections.Count} devices.",
                Style = ProgressBarStyle.Marquee,
                CancelButtonEnabled = false,
            })
            {
                Thread thread = new Thread(() =>
                {
                    Parallel.ForEach(connections,
                                     (connection) =>
                    {
                        string messageString = "";
                        CommunicationProcessResult result;

                        do
                        {
                            Reporter reporter      = new Reporter();
                            CommandProcess process = new CommandProcess(connection.Connection, reporter, new CommandCallback(commandMetaData.GetMessage(args)), 100, 3);

                            result = process.Send();

                            StringBuilder fullMessageString = new StringBuilder();

                            fullMessageString.AppendLine("Error while communicating with " + connection.Connection.Settings.GetDeviceDescriptor() + ".");
                            fullMessageString.AppendLine();

                            fullMessageString.Append("Failed to confirm command: " + commandMetaData.OscAddress);

                            messageString = fullMessageString.ToString();

                            if (result != CommunicationProcessResult.Success && errorsInRow == true)
                            {
                                connection.SetError(messageString);
                            }
                        }while (result != CommunicationProcessResult.Success &&
                                errorsInRow == false && dialog.InvokeShowError(messageString, MessageBoxButtons.RetryCancel) == DialogResult.Retry);
                    });

                    control.Invoke(new MethodInvoker(dialog.Close));
                });

                thread.Start();

                dialog.ShowDialog(control);
            }
        }
Esempio n. 11
0
        public void OpenDaemon(CommandProcess process, string target)
        {
            Session activeSession = GetClient(process).activeSession;

            foreach (Daemon daemon in activeSession.connectedNode.daemons)
            {
                if (daemon.IsOfType(target))
                {
                    DaemonClient daemonClient = daemon.CreateClient(activeSession, process);
                    StartProcess(process, daemonClient);
                    daemon.OnConnect(activeSession, daemonClient);
                    GetClient(process).activeSession.AttachProcess(daemonClient);
                }
            }
        }
Esempio n. 12
0
        public Task <InputCommandResult> ExecuteAsync(ICharacter owner, params string[] args)
        {
            InputCommandResult result = null;

            if (this.currentProcessor.Process(owner, this, args, out result))
            {
                this.currentProcessor = this.currentProcessor.GetNextProcessor();
                if (result.IsCommandCompleted)
                {
                    this.notificationManager.Publish(new NewCharacterCreatedMessage("Character created.", owner));
                }
            }

            return(Task.FromResult(result));
        }
Esempio n. 13
0
        public void Login(CommandProcess process, string username, string password)
        {
            GameClient  client      = GetClient(process);
            Credentials credentials = node.Login(GetClient(process), username, password);

            if (credentials != null)
            {
                client.Login(node, credentials);
                client.Send(NetUtil.PacketType.MESSG, "Logged as : " + username);
                node.Log(Log.LogEvents.Login, node.logs.Count + 1 + " " + client.homeComputer.ip + " logged in as " + username, client.activeSession.sessionId, client.homeComputer.ip);
            }
            else
            {
                client.Send(NetUtil.PacketType.MESSG, "Wrong identificants.");
            }
        }
Esempio n. 14
0
        public bool CheckFolders(CommandProcess process)
        {
            var bankFolder = process.computer.fileSystem.rootFile.GetFile("bank");

            if (bankFolder == null || !bankFolder.IsFolder())
            {
                process.Print("No bank daemon folder was found ! (Contact the admin of this node to create one as the bank is useless without one)");
                return(false);
            }
            var accountFile = bankFolder.GetFile("accounts.db");

            if (accountFile == null)
            {
                process.Print("No accounts file was found ! (Contact the admin of this node to create one as the bank is useless without one)");
                return(false);
            }

            return(true);
        }
Esempio n. 15
0
 public void Disconnect(CommandProcess process)
 {
     GetClient(process).Disconnect();
 }
Esempio n. 16
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            if (!checkInput())
            {
                return;
            }

            cmd = new CommandProcess(config);
            cmd.OutputDataReceived += DataReceived;
            cmd.SourceFile          = tbApkPath.Text;
            cmd.Package             = config.PackageList[cbPackageName.SelectedIndex];
            cmd.DeleteGameResDir    = cbDeleteGameResDir.Checked;
            if (tbResourceApk.Enabled)
            {
                cmd.ResourceApkPath = tbResourceApk.Text;
            }
            if (tbVersionName.Enabled)
            {
                cmd.VersionName = tbVersionName.Text;
            }
            if (tbVersionCode.Enabled)
            {
                cmd.VersionCode = int.Parse(tbVersionCode.Text);
            }
            {
                cmd.DeletePath.Clear();
                string[] strArr = tbResourceDelete.Text.Split(';');
                foreach (string strItem in strArr)
                {
                    string item = strItem.Trim();
                    if (!String.IsNullOrEmpty(item))
                    {
                        cmd.DeletePath.Add(item);
                    }
                }
            }
            {
                cmd.EncryptOverwrite.Clear();
                string[] strArr = tbEncryptOverwrite.Text.Split(';');
                foreach (string strItem in strArr)
                {
                    string item = strItem.Trim();
                    if (!String.IsNullOrEmpty(item))
                    {
                        cmd.EncryptOverwrite.Add(item);
                    }
                }
            }
            {
                cmd.NormalOverwrite.Clear();
                string[] strArr = tbNormalOverwrite.Text.Split(';');
                foreach (string strItem in strArr)
                {
                    string item = strItem.Trim();
                    if (!String.IsNullOrEmpty(item))
                    {
                        cmd.NormalOverwrite.Add(item);
                    }
                }
            }
            {
                cmd.OtherJsonFile.Clear();
                string[] strArr = tbOtherJsonFile.Text.Split(';');
                foreach (string strItem in strArr)
                {
                    string item = strItem.Trim();
                    if (!String.IsNullOrEmpty(item))
                    {
                        cmd.OtherJsonFile.Add(item);
                    }
                }
            }
            {
                cmd.GlobalresOverwrite.Clear();
                string[] strArr = tbGloOverwrite.Text.Split(';');
                foreach (string strItem in strArr)
                {
                    string item = strItem.Trim();
                    if (!String.IsNullOrEmpty(item))
                    {
                        cmd.GlobalresOverwrite.Add(item);
                    }
                }
            }
            {
                cmd.PermissionDelete.Clear();
                string[] strArr = tbPermissionDelete.Text.Split(';');
                foreach (string strItem in strArr)
                {
                    string trimItem = strItem.Trim();
                    if (!String.IsNullOrEmpty(trimItem))
                    {
                        cmd.PermissionDelete.Add(trimItem);
                    }
                }
            }
            foreach (int index in clbChannel.CheckedIndices)
            {
                cmd.ChannelList.Add(config.ChannelList[index]);
            }

            thread = new Thread(new ThreadStart(delegate() {
                if (rbPlatformAndroid.Checked)
                {
                    cmd.runAndroidCommand();
                }
                else if (rbPlatformWinPhone.Checked)
                {
                    cmd.runWinPhoneCommand();
                }
                this.Invoke((ThreadStart) delegate()
                {
                    MessageBox.Show(this, "打包完成");
                });
            }));
            thread.IsBackground = true;
            thread.Start();
        }
Esempio n. 17
0
File: Command.cs Progetto: rmc00/gsf
        /// <summary>
        /// Executes a command line operation and returns <c>true</c> if there was no standard error reported.
        /// </summary>
        /// <param name="fileName">Command line file name to execute.</param>
        /// <param name="arguments">Command line arguments to use, if any.</param>
        /// <param name="standardOutput">Any standard output reported by the command line operation.</param>
        /// <param name="standardError">Any standard error reported by the command line operation.</param>
        /// <param name="processCompleted">Flag that determines if process completed or timed-out. This is only relevant if <paramref name="timeout"/> is not -1.</param>
        /// <param name="exitCode">Exit code of the process, assuming process successfully completed.</param>
        /// <param name="timeout">Timeout, in milliseconds, to wait for command line operation to complete. Set to <see cref="Timeout.Infinite"/>, i.e., -1, for infinite wait.</param>
        /// <returns><c>true</c> if there was no standard error reported; otherwise, <c>false</c>.</returns>
        public static bool Execute(string fileName, string arguments, out string standardOutput, out string standardError, out bool processCompleted, out int exitCode, int timeout)
        {
            using (CommandProcess process = new CommandProcess(fileName, arguments ?? ""))
            {
                processCompleted = process.Execute(timeout);
                standardOutput = process.StandardOutput;
                standardError = process.StandardError;
                exitCode = process.ExitCode;
            }

            return string.IsNullOrWhiteSpace(standardError);
        }
Esempio n. 18
0
 public CharacterNameProcessor(INotificationCenter notificationCenter, CommandProcess nextProcessor) : base(nextProcessor)
 {
     this.notificationManager = notificationCenter;
 }
Esempio n. 19
0
 public CharacterPasswordProcessor(CommandProcess nextProcessor) : base(nextProcessor)
 {
 }