/* method that get the new order from sftp server */ private void GetOrder(string filePath, IEnumerable <string> fileList) { // connection to sftp server and read all the list of file sftp.Connect(); // download the files from the given list foreach (string file in fileList.Where(file => file != "." && file != "..")) { sftp.Get(SHIPMENT_DIR + '/' + file, filePath + "\\" + file); // after download the file delete it on the server (no need it anymore) ServerDelete.Delete(sftp.Host, sftp.Username, sftp.Password, SHIPMENT_DIR + '/' + file); } sftp.Close(); }
public static object Create(string eventName, object data) { object res; if (Ready.EventIsThis(eventName)) { res = new Ready((JObject)data); } else if (Resumed.EventIsThis(eventName)) { res = new Resumed((JObject)data); } else if (InvalidSession.EventIsThis(eventName)) { res = (bool)((JValue)data).Value; } else if (Channel.EventIsThis(eventName)) { res = new Channel((JObject)data); } else if (ChannelPinsUpdate.EventIsThis(eventName)) { res = new ChannelPinsUpdate((JObject)data); } else if (EvtServer.EventIsThis(eventName)) { res = new EvtServer((JObject)data); } else if (ServerDelete.EventIsThis(eventName)) { res = ((JObject)data).ToObject <UaServerJson>().id; } else if (ServerUser.EventIsThis(eventName)) { res = new ServerUser((JObject)data, eventName == ServerUser.MemberRemoveId); } else if (ServerUserSet.EventIsThis(eventName)) { res = new ServerUserSet((JObject)data); } else if (ServerUserUpdate.EventIsThis(eventName)) { res = new ServerUserUpdate((JObject)data); } else if (ServerEmojiUpdate.EventIsThis(eventName)) { res = new ServerEmojiUpdate((JObject)data); } else if (RawServer.EventIsThis(eventName)) { res = new RawServer((JObject)data); } else if (ServerRole.EventIsThis(eventName)) { res = new ServerRole((JObject)data); } else if (ServerRoleDelete.EventIsThis(eventName)) { res = new ServerRoleDelete((JObject)data); } else if (Message.EventIsThis(eventName)) { res = new Message((JObject)data, eventName == Message.UpdateId); } else if (RawMessage.EventIsThis(eventName)) { res = new RawMessage((JObject)data, eventName == RawMessage.BulkDeleteId); } else if (Reaction.EventIsThis(eventName)) { res = new Reaction((JObject)data); } else if (ReactionRemoveAll.EventIsThis(eventName)) { res = new ReactionRemoveAll((JObject)data); } else if (Webhook.EventIsThis(eventName)) { res = new Webhook((JObject)data); } else if (EvtUser.EventIsThis(eventName)) { res = new EvtUser((JObject)data); } else if (Unimplemented.EventIsThis(eventName)) { res = Unimplemented.Instance; } else { throw new UnknownEventException("Gateway event \"" + eventName + "\" is unknown."); } DiscordDebug.WriteLine("Heard event: " + eventName + ", handling w/ object " + res.GetType().Name); return(res); }