Skip to content

Instantly share code, notes, and snippets.

View skenderbeu's full-sized avatar

Peter Campbell skenderbeu

View GitHub Profile
using System;
using System.Collections.Generic;
using log4net;
namespace Zoom.MailingExtracts
{
public class ZipModule : IDisposable
{
protected static readonly ILog Log = LogManager.GetLogger(typeof(ZipModule));
protected string BrandName;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using log4net;
public class ZipUtil : IZip
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ZipModule));
private string _zipFileName;
public void FTPZippedFile(some params....)
{
//create and set variables
var fallback = Policy
.Handle<SessionRemoteException>()
.Fallback((ex)=> SendEmail(ex.Message));
var fileUploadResult = fallback.Execute(() =>
UploadFile(zipFileName, fullzipFilepath,
public string UploadFile(string zipFileName, string fullZipFilePath,
TransferOptions transOptions, SessionOptions sessionOptions)
{
using (var session = new Session())
{
session.Open(sessionOptions);
return session.PutFiles(
zipFileName,
fullZipFilePath,
using System;
using System.IO;
using Polly;
namespace SpreadsheetImporter
{
class Program
{
static void Main(string[] args)
{
using System;
using System.IO;
namespace SpreadsheetImporter
{
class Program
{
static void Main(string[] args)
{
ReadFile(@"C:\temp\jam2.xls");
using System;
using System.IO;
using log4net;
using WinSCP;
public class Upload
{
public static void SendFile(UploadConfig config, ILog log)
{
try
public class UploadConfig
{
public string Protocol { get; set; }
public string Host { get; set; }
public string User { get; set; }
public string Password { get; set; }
public string ZipFileName { get; set; }
public string RemotePath { get; set; }
public string PrivateKeyPath { get; set; }
public string Port { get; set; }
public interface IZip
{
void SetZipFileName(string zipfileName);
void SetFilesToZip(List<string> files);
void CreateArchive();
}
private System.Xml.XmlDocument getSecurityHeaderXML(str _username, str _passwordDigest,
str _encodedNonce, str _creationDate)
{
System.Xml.XmlDocument xDoc;
System.Xml.XmlNode xmlRoot;
System.Xml.XmlElement securityElement;
System.Xml.XmlElement usernameTokenElement;
System.Xml.XmlElement usernameElement;
System.Xml.XmlElement passwordElement;
System.Xml.XmlElement nonceElement;