|
using System;
using System.Collections.Generic;
using System.Text;
namespace FilePublisher
{
public class Configuration
{
string host;
public string Host
{
get { return host; }
set { host = value; }
}
string user;
public string User
{
get { return user; }
set { user = value; }
}
string pass;
public string Pass
{
get { return pass; }
set { pass = value; }
}
bool passive;
public bool Passive
{
get { return passive; }
set { passive = value; }
}
List<RemoteFolder> folders = new List<RemoteFolder>();
public List<RemoteFolder> Folders
{
get { return folders; }
set { folders = value; }
}
public void Save(string file)
{
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Configuration));
using( System.IO.FileStream fs = System.IO.File.Create(file))
serializer.Serialize(fs, this);
}
public static Configuration Load(string file)
{
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Configuration));
using( System.IO.FileStream fs = System.IO.File.OpenRead(file))
return (Configuration)serializer.Deserialize(fs);
}
}
public class RemoteFolder
{
string folder;
public string Folder
{
get { return folder; }
set { folder = value; }
}
List<Item> items = new List<Item>();
public List<Item> Items
{
get { return items; }
set { items = value; }
}
}
public class Item
{
string path;
public string Path
{
get { return path; }
set { path = value; }
}
DateTime lastUpload;
public DateTime LastUpload
{
get { return lastUpload; }
set { lastUpload = value; }
}
public Item(){}
public Item(string file, DateTime upload)
{
path = file;
lastUpload = upload;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Thomas is developer for a small service company based in the greater Vancouver area of canada. He has spent most of his time building custom c# business applications for clients.