本文整理汇总了C#中ExtensionType类的典型用法代码示例。如果您正苦于以下问题:C# ExtensionType类的具体用法?C# ExtensionType怎么用?C# ExtensionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExtensionType类属于命名空间,在下文中一共展示了ExtensionType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSettings
/// <summary>
/// Retreaves StringDictionary object from database or file system
/// </summary>
/// <param name="exType">Extension Type</param>
/// <param name="exId">Extension Id</param>
/// <returns>StringDictionary object as Stream</returns>
public object GetSettings(ExtensionType exType, string exId)
{
SerializableStringDictionary ssd = null;
StringDictionary sd = new StringDictionary();
XmlSerializer serializer = new XmlSerializer(typeof(SerializableStringDictionary));
if (_section.DefaultProvider == "XmlTrainProvider")
{
Stream stm = (Stream)TrainService.LoadFromDataStore(exType, exId);
if (stm != null)
{
ssd = (SerializableStringDictionary)serializer.Deserialize(stm);
stm.Close();
sd = (StringDictionary)ssd;
}
}
else
{
object o = TrainService.LoadFromDataStore(exType, exId);
if (!string.IsNullOrEmpty((string)o))
{
using (StringReader reader = new StringReader((string)o))
{
ssd = (SerializableStringDictionary)serializer.Deserialize(reader);
}
sd = (StringDictionary)ssd;
}
}
return sd;
}
示例2: GetSettings
/// <summary>
/// Retreaves StringDictionary object from database or file system
/// </summary>
/// <param name="extensionType">
/// Extension Type
/// </param>
/// <param name="extensionId">
/// Extension Id
/// </param>
/// <returns>
/// StringDictionary object as Stream
/// </returns>
public object GetSettings(ExtensionType extensionType, string extensionId)
{
SerializableStringDictionary ssd;
var sd = new StringDictionary();
var serializer = new XmlSerializer(typeof(SerializableStringDictionary));
if (Section.DefaultProvider == "XmlBlogProvider")
{
var stm = (Stream)BlogService.LoadFromDataStore(extensionType, extensionId);
if (stm != null)
{
ssd = (SerializableStringDictionary)serializer.Deserialize(stm);
stm.Close();
sd = ssd;
}
}
else
{
var o = BlogService.LoadFromDataStore(extensionType, extensionId);
if (!string.IsNullOrEmpty((string)o))
{
using (var reader = new StringReader((string)o))
{
ssd = (SerializableStringDictionary)serializer.Deserialize(reader);
}
sd = ssd;
}
}
return sd;
}
示例3: GetSettings
/// <summary>
/// Gets settings from data store
/// </summary>
/// <param name="extensionType">
/// Extension Type
/// </param>
/// <param name="extensionId">
/// Extension ID
/// </param>
/// <returns>
/// Settings as Stream
/// </returns>
public object GetSettings(ExtensionType extensionType, string extensionId)
{
WidgetData widgetData;
var xml = new XmlDocument();
if (Section.DefaultProvider == "XmlBlogProvider")
{
var stm = (Stream)BlogService.LoadFromDataStore(extensionType, extensionId);
if (stm != null)
{
var x = new XmlSerializer(typeof(XmlDocument));
xml = (XmlDocument)x.Deserialize(stm);
stm.Close();
}
}
else
{
var o = BlogService.LoadFromDataStore(extensionType, extensionId);
if (!string.IsNullOrEmpty((string)o))
{
var serializer = new XmlSerializer(typeof(WidgetData));
using (var reader = new StringReader((string)o))
{
widgetData = (WidgetData)serializer.Deserialize(reader);
}
if (widgetData.Settings.Length > 0)
{
xml.InnerXml = widgetData.Settings;
}
}
}
return xml;
}
示例4: GetSettings
/// <summary>
/// Gets settings from data store
/// </summary>
/// <param name="exType">Extension Type</param>
/// <param name="exId">Extension ID</param>
/// <returns>Settings as Stream</returns>
public object GetSettings(ExtensionType exType, string exId)
{
WidgetData wd = new WidgetData();
XmlDocument xml = new XmlDocument();
if (_section.DefaultProvider == "XmlTrainProvider")
{
Stream stm = (Stream)TrainService.LoadFromDataStore(exType, exId);
if (stm != null)
{
XmlSerializer x = new XmlSerializer(typeof(XmlDocument));
xml = (XmlDocument)x.Deserialize(stm);
stm.Close();
}
}
else
{
object o = TrainService.LoadFromDataStore(exType, exId);
if (!string.IsNullOrEmpty((string)o))
{
XmlSerializer serializer = new XmlSerializer(typeof(WidgetData));
using (StringReader reader = new StringReader((string)o))
{
wd = (WidgetData)serializer.Deserialize(reader);
}
if (wd.Settings.Length > 0)
xml.InnerXml = wd.Settings;
}
}
return xml;
}
示例5: ExtensionInfo
//---------------------------------------------------------------------
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="name">The extension's name</param>
/// <param name="type">The extension's type</param>
/// <param name="mainClass">The AssemblyQualifiedName of the
/// extension's main class (dervied from ExtensionMain).</param>
public ExtensionInfo(string name,
ExtensionType type,
string mainClass)
: base(name, typeof(ExtensionMain), mainClass)
{
this.type = type;
}
示例6: ClientExtension
/// <summary>
/// Initializes a new instance of the <see cref="ClientExtension"/> class.
/// </summary>
/// <param name="type">Extension type</param>
/// <param name="scope">Extension install scope</param>
/// <param name="manifestStream">Manifest stream, can be null</param>
/// <param name="marketplaceAssetID">The asset ID for Office Marketplace</param>
/// <param name="marketplaceContentMarket">The content market for Office Marketplace</param>
/// <param name="isAvailable">Whether extension is available</param>
/// <param name="isMandatory">Whether extension is mandatory</param>
/// <param name="isEnabledByDefault">Whether extension is enabled by default</param>
/// <param name="providedTo">Who the extension is provided for (e.g. "entire org" or "specific users")</param>
/// <param name="specificUsers">List of users extension is provided for, can be null</param>
/// <param name="appStatus">App status</param>
/// <param name="etoken">Etoken</param>
public ClientExtension(
ExtensionType type,
ExtensionInstallScope scope,
Stream manifestStream,
string marketplaceAssetID,
string marketplaceContentMarket,
bool isAvailable,
bool isMandatory,
bool isEnabledByDefault,
ClientExtensionProvidedTo providedTo,
StringList specificUsers,
string appStatus,
string etoken)
: this()
{
this.Type = type;
this.Scope = scope;
this.ManifestStream = manifestStream;
this.MarketplaceAssetID = marketplaceAssetID;
this.MarketplaceContentMarket = marketplaceContentMarket;
this.IsAvailable = isAvailable;
this.IsMandatory = isMandatory;
this.IsEnabledByDefault = isEnabledByDefault;
this.ProvidedTo = providedTo;
this.SpecificUsers = specificUsers;
this.AppStatus = appStatus;
this.Etoken = etoken;
}
示例7: SendMessage
public void SendMessage(object msg, ExtensionType type)
{
var foundExts = _extensions.Where(x => x.ExtensionType == type);
foreach (var ext in foundExts) {
ext.Extension.RecieveMessage(msg);
}
}
示例8: SaveSettings
/// <summary>
/// Saves extension to database or file system
/// </summary>
/// <param name="exType">Extension Type</param>
/// <param name="exId">Extension ID</param>
/// <param name="settings">Extension object</param>
/// <returns>True if saved</returns>
public bool SaveSettings(ExtensionType exType, string exId, object settings)
{
try
{
BlogService.SaveToDataStore(exType, exId, settings);
return true;
}
catch (Exception)
{
throw;
}
}
示例9: Http2Server
/// <summary>
/// Initializes new instance of Http2 server.
/// </summary>
/// <param name="port">Port to listen.</param>
public Http2Server(int port)
{
this.Port = port;
ExtensionType[] extensions = new ExtensionType[] { ExtensionType.Renegotiation, ExtensionType.ALPN };
SecurityOptions options = new SecurityOptions(SecureProtocol.Tls1, extensions, ConnectionEnd.Server);
options.VerificationType = CredentialVerification.None;
options.Certificate = Org.Mentalis.Security.Certificates.Certificate.CreateFromCerFile(@"certificate.pfx");
options.Flags = SecurityFlags.Default;
options.AllowedAlgorithms = SslAlgorithms.RSA_AES_128_SHA | SslAlgorithms.NULL_COMPRESSION;
_server = new SecureTcpListener(Port, options);
}
示例10: GetByType
/// <summary>
/// Gets the extensions available for the given type.
/// </summary>
/// <param name="type">The extension type</param>
/// <param name="draft">Whether the entity is a draft or not</param>
/// <returns>A list of extensions</returns>
public static List<Models.Extension> GetByType(ExtensionType type, bool draft = false)
{
var ext = new List<Models.Extension>() ;
Extensions.Where(extension => extension.ExtensionType.HasFlag(type)).ToList().ForEach(e => {
ext.Add(new Models.Extension() {
IsDraft = draft,
Type = e.Type.ToString(),
Body = (IExtension)Activator.CreateInstance(e.Type)
}) ;
});
return ext ;
}
示例11: Load
public Load(string name, ExtensionType extensionType, BasicType basicType, object value)
{
this.name = name;
if (extensionType != ExtensionType.List)
{
throw new Exception("Not supported type");
}
this.data = new List(basicType.ToString(), value);
}
示例12: AddExtensionToResult
private static bool AddExtensionToResult(byte[] buffer, ref int currentLen, Int16 extLen, ConnectionEnd end,
ExtensionList knownExtensions, ExtensionType type, ref ExtensionList result)
{
foreach (var extension in knownExtensions)
{
if (extension.Type == type)
{
result.Add(extension.Parse(buffer, ref currentLen, extLen, end));
return true;
}
}
return false;
}
示例13: GetByTypeAndEntity
/// <summary>
/// Gets the extensions available for the given type and entity.
/// </summary>
/// <param name="type">The extension type</param>
/// <param name="id">The entity id</param>
/// <param name="draft">Whether the entity is a draft or not</param>
/// <returns>A list of extensions</returns>
public static List<Models.Extension> GetByTypeAndEntity(ExtensionType type, Guid id, bool draft)
{
var ret = new List<Models.Extension>() ;
var tmp = GetByType(type, draft) ;
foreach (var e in tmp) {
var ext = Models.Extension.GetSingle("extension_type = @0 AND extension_parent_id = @1 AND extension_draft = @2",
e.Type, id, draft) ;
if (ext != null)
ret.Add(ext) ;
else ret.Add(e) ;
}
return ret ;
}
示例14: SaveToDataStore
/// <summary>
/// Save settings to generic data store
/// </summary>
/// <param name="extensionType">
/// Type of extension
/// </param>
/// <param name="extensionId">
/// Extension ID
/// </param>
/// <param name="settings">
/// Stream Settings
/// </param>
public override void SaveToDataStore(ExtensionType extensionType, string extensionId, object settings)
{
var fileName = string.Format("{0}{1}.xml", StorageLocation(extensionType), extensionId);
if (!Directory.Exists(StorageLocation(extensionType)))
{
Directory.CreateDirectory(StorageLocation(extensionType));
}
using (TextWriter writer = new StreamWriter(fileName))
{
var x = new XmlSerializer(settings.GetType());
x.Serialize(writer, settings);
}
}
示例15: LoadFromDataStore
/// <summary>
/// Loads settings from generic data store
/// </summary>
/// <param name="extensionType">
/// Extension Type
/// </param>
/// <param name="extensionId">
/// Extension ID
/// </param>
/// <returns>
/// Stream Settings
/// </returns>
public override object LoadFromDataStore(ExtensionType extensionType, string extensionId)
{
var fileName = string.Format("{0}{1}.xml", StorageLocation(extensionType), extensionId);
Stream str = null;
if (!Directory.Exists(StorageLocation(extensionType)))
{
Directory.CreateDirectory(StorageLocation(extensionType));
}
if (File.Exists(fileName))
{
var reader = new StreamReader(fileName);
str = reader.BaseStream;
}
return str;
}