Example #1
0
        public static int EditValue(IntPtr parentWin, int fieldIndex, int unitIndex,
                                    int fieldType, IntPtr fieldValue, int maxLen, int flags,
                                    [MarshalAs(UnmanagedType.LPStr)] string langIdentifier)
        {
            SetValueResult   result;
            ContentFieldType fldType = (ContentFieldType)fieldType;
            EditValueFlags   evFlags = (EditValueFlags)flags;

            callSignature = String.Format("ContentEditValue ({0}/{1}/{2})",
                                          fieldIndex, unitIndex, evFlags.ToString());
            try {
                TcWindow     tcWin    = new TcWindow(parentWin);
                ContentValue value    = new ContentValue(fieldValue, fldType);
                string       strValue = value.StrValue;
                result = Plugin.EditValue(tcWin, fieldIndex, unitIndex, fldType,
                                          ref strValue, maxLen, evFlags, langIdentifier);
                if (result == SetValueResult.Success)
                {
                    value.StrValue = strValue;
                    value.CopyTo(fieldValue);
                }

                TraceCall(TraceLevel.Info, String.Format("{0} - {1}", result.ToString(), value.StrValue));
            } catch (Exception ex) {
                ProcessException(ex);
                result = SetValueResult.NoSuchField;
            }
            return((int)result);
        }
Example #2
0
 private static void OpenTcPluginHome()
 {
     if (tcMainWindowHandle != IntPtr.Zero)
     {
         TcWindow.SendMessage(tcMainWindowHandle, CmOpenNetwork);
         Thread.Sleep(500);
     }
 }
Example #3
0
 public override void ConfigurePacker(TcWindow parentWin)
 {
     MessageBox.Show(parentWin,
                     "Provides MD5/SHA1 checksum generator/checker\n" +
                     "from within Total Commander packer interface\n" +
                     " ( idea of Stanislaw Y. Pusep,\n" +
                     "   http://ghisler.fileburst.com/plugins/checksum.zip)\n\n" +
                     "Author: Oleg Yuvashev",
                     ".NET Test Packer Plugin",
                     MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Example #4
0
        public override ExecResult ExecuteOpen(TcWindow mainWin, RemotePath remoteName)
        {
            WsPath wsPath = remoteName;

            switch (wsPath.Level)
            {
            case WsPathLevel.Account when wsPath.AccountName == ADD_NEW_ACCOUNT_TITLE:
                return(_accountRepository.AddNewAccount());

            default:
                return(ExecResult.Yourself);
            }
        }
Example #5
0
        public override ExecResult ExecuteProperties(TcWindow mainWin, RemotePath remoteName)
        {
            WsPath wsPath = remoteName;

            switch (wsPath.Level)
            {
            case WsPathLevel.Account when wsPath.AccountName != ADD_NEW_ACCOUNT_TITLE:
                Prompt.MsgOk("TODO:", "Show account properties");
                return(ExecResult.Ok);

            default:
                return(ExecResult.Yourself);
            }
        }
Example #6
0
 public ExecResult ExecuteFile(TcWindow mainWin, ref string remoteName, string verb)
 {
     if (String.IsNullOrEmpty(verb))
     {
         return(ExecResult.Error);
     }
     if (verb.Equals("open", StringComparison.CurrentCultureIgnoreCase))
     {
         return(ExecuteOpen(mainWin, ref remoteName));
     }
     if (verb.Equals("properties", StringComparison.CurrentCultureIgnoreCase))
     {
         return(ExecuteProperties(mainWin, remoteName));
     }
     if (verb.StartsWith("chmod ", StringComparison.CurrentCultureIgnoreCase))
     {
         return(ExecuteCommand(mainWin, ref remoteName, verb.Trim()));
     }
     if (verb.StartsWith("quote ", StringComparison.CurrentCultureIgnoreCase))
     {
         return(ExecuteCommand(mainWin, ref remoteName, verb.Substring(6).Trim()));
     }
     return(ExecResult.Yourself);
 }
Example #7
0
 public override ExecResult ExecuteOpen(TcWindow mainWin, RemotePath remoteName)
 {
     return(ExecResult.Yourself);
 }
Example #8
0
 public override ExecResult ExecuteCommand(TcWindow mainWin, RemotePath remoteName, string command)
 {
     return(ExecResult.Yourself);
 }
Example #9
0
 public virtual ExecResult ExecuteCommand(TcWindow mainWin, ref string remoteName, string command)
 {
     return(ExecResult.Yourself);
 }
Example #10
0
 public virtual ExecResult ExecuteProperties(TcWindow mainWin, string remoteName)
 {
     return(ExecResult.Yourself);
 }
Example #11
0
 public virtual ExecResult ExecuteOpen(TcWindow mainWin, ref string remoteName)
 {
     return(ExecResult.Yourself);
 }
Example #12
0
 // methods used in WDX plugins only
 public virtual SetValueResult EditValue(TcWindow parentWin, int fieldIndex, int unitIndex,
                                         ContentFieldType fieldType, ref string fieldValue, int maxLen, EditValueFlags flags,
                                         string langIdentifier)
 {
     return(SetValueResult.NoSuchField);
 }
Example #13
0
 public virtual void ConfigurePacker(TcWindow parentWin)
 {
 }
Example #14
0
        public override ExecResult ExecuteCommand(TcWindow mainWin, ref string remoteName, string command)
        {
            ExecResult result = ExecResult.Yourself;

            if (String.IsNullOrEmpty(command))
            {
                return(result);
            }
            string[] cmdPars = command.Split(new[] { ' ', '\\' });
            if (cmdPars[0].Equals("log", StringComparison.InvariantCultureIgnoreCase))
            {
                string logString = ((cmdPars.Length < 3 || String.IsNullOrEmpty(cmdPars[2])) ? null : cmdPars[2]);
                if (cmdPars.Length > 1)
                {
                    canDisconnect = true;
                    if (cmdPars[1].Equals("connect", StringComparison.InvariantCultureIgnoreCase))
                    {
                        //msgType = LogMsgType.Connect;
                        currentConnection = logString == null ? Title : logString;
                        LogProc(LogMsgType.Connect, "CONNECT \\" + currentConnection);
                        ftpConnections.Add(currentConnection);
                        LogProc(LogMsgType.Details, String.Format("Connection to {0} established.", currentConnection));
                    }
                    else if (cmdPars[1].Equals("disconnect", StringComparison.InvariantCultureIgnoreCase))
                    {
                        LogProc(LogMsgType.Disconnect, "Disconnect from: " + logString);
                    }
                    else if (cmdPars[1].Equals("details", StringComparison.InvariantCultureIgnoreCase))
                    {
                        LogProc(LogMsgType.Details, logString);
                    }
                    else if (cmdPars[1].Equals("trComplete", StringComparison.InvariantCultureIgnoreCase))
                    {
                        LogProc(LogMsgType.TransferComplete, "Transfer complete: \\" + remoteName + " -> " + logString);
                    }
                    else if (cmdPars[1].Equals("error", StringComparison.InvariantCultureIgnoreCase))
                    {
                        LogProc(LogMsgType.ImportantError, logString);
                    }
                    else if (cmdPars[1].Equals("opComplete", StringComparison.InvariantCultureIgnoreCase))
                    {
                        LogProc(LogMsgType.OperationComplete, logString);
                    }
                    result = ExecResult.OK;
                }

                //currentConnection = "\\" + ((cmdPars.Length < 2 || String.IsNullOrEmpty(cmdPars[1])) ? Title : cmdPars[1]);
                //LogProc(LogMsgType.Connect, "CONNECT " + currentConnection);
                //if (cmdPars.Length > 2)
                //    LogProc(LogMsgType.Details,
                //        String.Format("Connection to {0} established with {1}.", currentConnection, cmdPars[2]));
                //result = ExecResult.OK;
            }
            else if (cmdPars[0].Equals("req", StringComparison.InvariantCultureIgnoreCase))
            {
                RequestType requestType = RequestType.Other;
                if (cmdPars.Length > 1)
                {
                    if (cmdPars[1].Equals("UserName", StringComparison.InvariantCultureIgnoreCase))
                    {
                        requestType = RequestType.UserName;
                    }
                    else if (cmdPars[1].Equals("Password", StringComparison.InvariantCultureIgnoreCase))
                    {
                        requestType = RequestType.Password;
                    }
                    else if (cmdPars[1].Equals("Account", StringComparison.InvariantCultureIgnoreCase))
                    {
                        requestType = RequestType.Account;
                    }
                    else if (cmdPars[1].Equals("TargetDir", StringComparison.InvariantCultureIgnoreCase))
                    {
                        requestType = RequestType.TargetDir;
                    }
                    else if (cmdPars[1].Equals("url", StringComparison.InvariantCultureIgnoreCase))
                    {
                        requestType = RequestType.Url;
                    }
                    else if (cmdPars[1].Equals("DomainInfo", StringComparison.InvariantCultureIgnoreCase))
                    {
                        requestType = RequestType.DomainInfo;
                    }
                }
                string customText = (requestType == RequestType.Other) ? "Input value:" : null;
                string testValue  = (cmdPars.Length > 2) ? cmdPars[2] : null;
                if (RequestProc(requestType, "Request Callback Test", customText, ref testValue, 2048))
                {
                    MessageBox.Show(testValue,
                                    String.Format("Request for '{0}' returned:", requestType.ToString()),
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    result = ExecResult.OK;
                }
            }
            else if (cmdPars[0].Equals("crypt", StringComparison.InvariantCultureIgnoreCase))
            {
                string connectionName = "LFS Test Connection";
                if (cmdPars.Length > 2)
                {
                    connectionName = cmdPars[2];
                }
                string password = "******";
                if (cmdPars.Length > 3)
                {
                    password = cmdPars[3];
                }
                CryptResult cryptRes = CryptResult.PasswordNotFound;
                if (cmdPars.Length > 1)
                {
                    if (cmdPars[1].Equals("Save", StringComparison.InvariantCultureIgnoreCase))
                    {
                        cryptRes = Password.Save(connectionName, password);
                    }
                    else if (cmdPars[1].Equals("Load", StringComparison.InvariantCultureIgnoreCase))
                    {
                        cryptRes = Password.Load(connectionName, ref password);
                    }
                    else if (cmdPars[1].Equals("LoadNoUi", StringComparison.InvariantCultureIgnoreCase))
                    {
                        cryptRes = Password.LoadNoUI(connectionName, ref password);
                    }
                    else if (cmdPars[1].Equals("Copy", StringComparison.InvariantCultureIgnoreCase))
                    {
                        cryptRes = Password.Copy(connectionName, password);
                    }
                    else if (cmdPars[1].Equals("Move", StringComparison.InvariantCultureIgnoreCase))
                    {
                        cryptRes = Password.Move(connectionName, password);
                    }
                    else if (cmdPars[1].Equals("Delete", StringComparison.InvariantCultureIgnoreCase))
                    {
                        cryptRes = Password.Delete(connectionName);
                    }
                }
                string s = String.Format("Crypt for '{0}' returned '{1}'", cmdPars[1], cryptRes.ToString());
                if (cryptRes == CryptResult.OK)
                {
                    s += " (" + password + ")";
                }
                string testValue = null;
                RequestProc(RequestType.MsgYesNo, null, s, ref testValue, 0);
                result = ExecResult.OK;
            }
            return(result);
        }