public Serialize ( |
||
writer | Binary writer to write data to | |
protocolVersion | int | Current FileZilla protocol version |
index | int | The 0 based index of this item in relation to any parent list |
리턴 | void |
/// <summary> /// Get state of FileZilla server /// </summary> /// <returns>True if Success</returns> public bool SetSettings(Settings settings) { // Check options if (ProtocolVersion < ProtocolVersions.TLS ? settings.Options.Count != (int)OptionId.V11_OPTIONS_NUM : settings.Options.Count != (int)OptionId.V12_OPTIONS_NUM) { throw new ApiException("Bad option count"); } // Before serializing, give Admin Password option special treatment. // If password is null, then set it to invalid ("*"). // That way server can distinguish between // - Not set (Null, serialized as "*") // - Blank password ("") // - Actual password var adminPassword = settings.GetOption(OptionId.ADMINPASS); if (adminPassword.TextValue == null) { adminPassword.TextValue = "*"; } SendCommand(MessageType.Settings, writer => settings.Serialize(writer, ProtocolVersion)); return(Receive <bool>(MessageType.Settings)); }
/// <summary> /// Get state of FileZilla server /// </summary> /// <returns>True if Success</returns> public bool SetSettings(Settings settings) { // Check options if(ProtocolVersion < ProtocolVersions.TLS ? settings.Options.Count != (int)OptionId.V11_OPTIONS_NUM : settings.Options.Count != (int)OptionId.V12_OPTIONS_NUM) throw new ApiException("Bad option count"); // Before serializing, give Admin Password option special treatment. // If password is null, then set it to invalid ("*"). // That way server can distinguish between // - Not set (Null, serialized as "*") // - Blank password ("") // - Actual password var adminPassword = settings.GetOption(OptionId.ADMINPASS); if (adminPassword.TextValue == null) adminPassword.TextValue = "*"; SendCommand(MessageType.Settings, writer => settings.Serialize(writer, ProtocolVersion)); return Receive<bool>(MessageType.Settings); }