public static FtpClient[] LoadNewWorkSpace() { OpenFileDialog fileNameDialog = new OpenFileDialog(); fileNameDialog.DefaultExt = ".xml"; if (DialogResult.OK == fileNameDialog.ShowDialog()) { FtpExlorerWorkspace workSpace = new FtpExlorerWorkspace(); workSpace.ReadXml(fileNameDialog.OpenFile()); FtpClient._ftpSessionTable.Clear(); foreach (FtpExlorerWorkspace.SiteListRow siterow in workSpace.SiteList.Rows) { NetworkCredential credential = new NetworkCredential(siterow.UserId, siterow.Password); FtpClient.AddSite(siterow.HostName, credential, siterow.IsSecured); } FtpClient[] clients = new FtpClient[FtpClient._ftpSessionTable.Count]; FtpClient._ftpSessionTable.Values.CopyTo(clients, 0); return(clients); } else { return(new FtpClient[0]); } }
public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs) { System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType(); System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence(); FtpExlorerWorkspace ds = new FtpExlorerWorkspace(); xs.Add(ds.GetSchemaSerializable()); System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "SiteListDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; return(type); }
public override System.Data.DataSet Clone() { FtpExlorerWorkspace cln = ((FtpExlorerWorkspace)(base.Clone())); cln.InitVars(); return(cln); }
public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) { FtpExlorerWorkspace ds = new FtpExlorerWorkspace(); System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType(); System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence(); xs.Add(ds.GetSchemaSerializable()); System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; return(type); }
public static void SaveCurrentWorkSpace() { SaveFileDialog fileNameDialog = new SaveFileDialog(); fileNameDialog.DefaultExt = ".xml"; if (DialogResult.OK == fileNameDialog.ShowDialog()) { FtpExlorerWorkspace workSpace = new FtpExlorerWorkspace(); foreach (string key in _ftpSessionTable.Keys) { FtpClient client = (FtpClient)_ftpSessionTable[key]; FtpExlorerWorkspace.SiteListRow siterow = workSpace.SiteList.NewSiteListRow(); siterow.HostName = client.HostId; siterow.UserId = client._credential.UserName; siterow.Password = client._credential.Password; siterow.IsSecured = client._enableSSL; workSpace.SiteList.Rows.Add(siterow); } workSpace.WriteXml(fileNameDialog.OpenFile()); } }