Пример #1
0
        protected override void OnMessage(MessageEventArgs e)
        {
            string[] dataParams = e.Data.Split(' ');

            switch (dataParams[0])
            {
            case "RunLogin":
                Send(ActionRunner.RunLogin(dataParams, isUAC: false).ToString());
                break;

            case "RequestFileIndex":
                Send(ActionRunner.RunFileIndexSender(dataParams));
                break;

            case "RequestDirectoryIndex":
                Send(ActionRunner.RunFolderIndexSender(dataParams));
                break;

            case "RequestFileData":
                Send(Other.MiscFunctions.StringCompressBytes(ActionRunner.RunFileDataSender(dataParams)));
                break;

            case "UploadFileData":
                string bytes = e.Data.Substring(e.Data.IndexOf(dataParams[4]));
                SendTask(ActionRunner.RunFileUpdate(dataParams, dataParams[3], Other.MiscFunctions.StringDecompressBytes(bytes)));
                BroadcastMessage($"RefreshFile {dataParams[3]} {dataParams[1]} {bytes}");
                break;

            case "CreateNewFile":
                var data = e.Data.Substring(e.Data.IndexOf(dataParams[4]));
                SendTask(ActionRunner.RunFileUpload(dataParams, dataParams[3], data));
                BroadcastMessage($"CreateFile {dataParams[1]} {dataParams[3]} {data}");
                break;

            case "DeleteFile":
                SendTask(ActionRunner.RunFileDeleter(dataParams));
                BroadcastMessage($"DeleteFile {dataParams[1]} {dataParams[3]}");
                break;

            case "CreateNewFolder":
                SendTask(ActionRunner.RunFolderCreator(dataParams));
                BroadcastMessage($"CreateFolder {dataParams[1]} {dataParams[3]}");
                break;

            case "DeleteFolder":
                SendTask(ActionRunner.RunFolderDeleter(dataParams));
                BroadcastMessage($"DeleteFolder {dataParams[1]} {dataParams[3]}");
                break;

            case "ChangePassword":
                Send(ActionRunner.RunPasswordChanger(dataParams));
                break;
            }
        }
Пример #2
0
        protected override void OnMessage(MessageEventArgs e)
        {
            String[] dataParams = e.Data.Split(Convert.ToChar(" "));
            string   data;
            string   status;

            switch (dataParams[0])
            {
            case "RunLogin":
                if (ActionRunner.RunLogin(dataParams))
                {
                    Send("True");
                }
                else
                {
                    Send("False");
                }
                break;

            case "RequestFileIndex":
                Send(ActionRunner.RunFileIndexSender(dataParams));
                break;

            case "RequestDirectoryIndex":
                Send(ActionRunner.RunFolderIndexSender(dataParams));
                break;

            case "RequestFileData":
                Send(ActionRunner.RunFileDataSender(dataParams));
                break;

            case "UploadFileData":
                data   = e.Data.Substring(e.Data.IndexOf(dataParams[4]));
                status = ActionRunner.RunFileUpdate(dataParams, dataParams[3], data);
                Send(status);
                Sessions.Broadcast($"RefreshFile {dataParams[3]} {data}");
                break;

            case "CreateNewFile":
                data   = e.Data.Substring(e.Data.IndexOf(dataParams[4]));
                status = ActionRunner.RunFileUpload(dataParams, dataParams[3], data);
                Send(status);
                Sessions.Broadcast($"CreateFile {dataParams[3]}");
                break;

            case "DeleteFile":
                status = ActionRunner.RunFileDeleter(dataParams);
                Send(status);
                Sessions.Broadcast($"DeleteFile {dataParams[3]}");
                break;

            case "CreateNewFolder":
                status = ActionRunner.RunFolderCreator(dataParams);
                Send(status);
                Sessions.Broadcast($"CreateFolder {dataParams[3]}");
                break;

            case "DeleteFolder":
                status = ActionRunner.RunFolderDeleter(dataParams);
                Send(status);
                Sessions.Broadcast($"DeleteFolder {dataParams[3]}");
                break;
            }
        }