本文整理汇总了C#中Mediachase.GetFiles方法的典型用法代码示例。如果您正苦于以下问题:C# Mediachase.GetFiles方法的具体用法?C# Mediachase.GetFiles怎么用?C# Mediachase.GetFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mediachase
的用法示例。
在下文中一共展示了Mediachase.GetFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecursiveCreateXML
private void RecursiveCreateXML(Mediachase.IBN.Business.ControlSystem.FileStorage fs, XmlNode currParent, int FolderID, bool bIncludeAsset, int DeepLevel, int CurDeepLevel, int AssetId)
{
Mediachase.IBN.Business.ControlSystem.DirectoryInfo[] infos = fs.GetDirectories(FolderID);
foreach (Mediachase.IBN.Business.ControlSystem.DirectoryInfo info in infos)
{
XmlNode folderItem = InsertFolderInformation(fs, currParent, info, info.Name, AssetId);
if (folderItem != null)
{
if (DeepLevel <= 0 || DeepLevel > (CurDeepLevel + 1))
{
XmlNode childFolderItemNode = folderItem.SelectSingleNode("ChildList");
RecursiveCreateXML(fs, childFolderItemNode, info.Id, bIncludeAsset, DeepLevel, CurDeepLevel + 1, AssetId);
}
}
}
if (bIncludeAsset)
{
Mediachase.IBN.Business.ControlSystem.FileInfo[] files = fs.GetFiles(FolderID);
foreach (Mediachase.IBN.Business.ControlSystem.FileInfo file in files)
{
InsertAssetInformation(currParent, FolderID, file);
}
}
}
示例2: Create
internal static Pop3Message Create(string From, string[] To, string Subject, string Body, Mediachase.IBN.Business.ControlSystem.DirectoryInfo Attachments)
{
MemoryStream emlMessage = new MemoryStream();
byte[] tmpBuffer = null;
string ToEmail = string.Join(", ", To);
#region Fill Pop3 Message Stream
// Create Pop3 Message Headers
StringBuilder sbHeaders = new StringBuilder();
sbHeaders.AppendFormat("Date: {0}", DateTime.UtcNow.ToString("r")).Append("\r\n");
sbHeaders.AppendFormat("From: {0}", Rfc822HeaderCollection.Encode2AsciiString(From)).Append("\r\n");
sbHeaders.AppendFormat("To: {0}", Rfc822HeaderCollection.Encode2AsciiString(ToEmail)).Append("\r\n");
sbHeaders.AppendFormat("Subject: {0}", Rfc822HeaderCollection.Encode2AsciiString(Subject)).Append("\r\n");
sbHeaders.Append("MIME-Version: 1.0").Append("\r\n");
sbHeaders.Append("Content-Type: multipart/mixed; boundary=\"----------7E143249668A83E\"").Append("\r\n");
sbHeaders.Append("\r\n");
tmpBuffer = Encoding.ASCII.GetBytes(sbHeaders.ToString());
emlMessage.Write(tmpBuffer, 0, tmpBuffer.Length);
// Create Pop3 Message Entry
StringBuilder sbMessage = new StringBuilder();
sbMessage.Append("------------7E143249668A83E").Append("\r\n");
// IF MESSAGE IS PLAIN TEXT
//sbMessage.Append("Content-Type: text/plain; charset=utf-8").Append("\r\n");
// IF MESSAGE IS HTML TEXT
sbMessage.Append("Content-Type: text/html; charset=utf-8").Append("\r\n");
sbMessage.Append("Content-Transfer-Encoding: base64").Append("\r\n");
sbMessage.Append("\r\n");
string FullMessage = Body;
sbMessage.Append(Convert.ToBase64String(Encoding.UTF8.GetBytes(FullMessage),Base64FormattingOptions.InsertLineBreaks)).Append("\r\n");
tmpBuffer = Encoding.ASCII.GetBytes(sbMessage.ToString());
emlMessage.Write(tmpBuffer, 0, tmpBuffer.Length);
if (Attachments != null)
{
Hashtable contentTypeHash = new Hashtable();
using (IDataReader reader = ContentType.GetListContentTypes())
{
while (reader.Read())
{
contentTypeHash.Add(((string)reader["Extension"]).ToLower(), (string)reader["ContentTypeString"]);
}
}
// Add Pop3 Message Attachements
foreach (Mediachase.IBN.Business.ControlSystem.FileInfo fileInfo in Attachments.GetFiles())
{
StringBuilder sbFile = new StringBuilder();
sbFile.Append("------------7E143249668A83E").Append("\r\n");
sbFile.AppendFormat("Content-Type: {0}; name=\"{1}\"", fileInfo.FileBinaryContentType, Rfc822HeaderCollection.Encode2AsciiString(fileInfo.Name)).Append("\r\n");
sbFile.Append("Content-Transfer-Encoding: base64").Append("\r\n");
sbFile.AppendFormat("Content-Disposition: attachment; filename=\"{0}\"", Rfc822HeaderCollection.Encode2AsciiString(fileInfo.Name)).Append("\r\n");
sbFile.Append("\r\n");
using (MemoryStream fs = new MemoryStream())
{
FileStorage.LightLoadFile(fileInfo, fs);
fs.Capacity = (int)fs.Length;
sbFile.Append(Convert.ToBase64String(fs.GetBuffer(), Base64FormattingOptions.InsertLineBreaks));
}
sbFile.Append("\r\n");
tmpBuffer = Encoding.ASCII.GetBytes(sbFile.ToString());
emlMessage.Write(tmpBuffer, 0, tmpBuffer.Length);
}
}
// Add Final Line
tmpBuffer = Encoding.ASCII.GetBytes("------------7E143249668A83E--\r\n\r\n");
emlMessage.Write(tmpBuffer, 0, tmpBuffer.Length);
#endregion
return new Pop3Message(emlMessage);
}