本文整理汇总了C#中Mono.Addins.RuntimeAddin类的典型用法代码示例。如果您正苦于以下问题:C# RuntimeAddin类的具体用法?C# RuntimeAddin怎么用?C# RuntimeAddin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeAddin类属于Mono.Addins命名空间,在下文中一共展示了RuntimeAddin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AnimatedIcon
public AnimatedIcon (RuntimeAddin addin, string animationSpec, Gtk.IconSize size)
{
this.addin = addin;
this.size = size;
this.animationSpec = animationSpec;
Parse (animationSpec);
}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:7,代码来源:AnimatedIcon.cs
示例2: SolutionItemDescriptor
protected SolutionItemDescriptor(RuntimeAddin addin, XmlElement element)
{
this.addin = addin;
name = element.GetAttribute ("name");
// relativePath = element.GetAttribute ("directory");
typeName = element.GetAttribute ("type");
template = element;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:8,代码来源:SolutionItemDescriptor.cs
示例3: PropertyRef
public PropertyRef (RuntimeAddin addin, string targetType, string name, string propertyType, bool isExternal, bool skipEmpty)
{
this.Addin = addin;
this.TargetType = targetType;
this.Name = name;
this.PropertyType = propertyType;
this.IsExternal = isExternal;
this.SkipEmpty = skipEmpty;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:DataContext.cs
示例4: RuntimeAddin
internal RuntimeAddin(AddinEngine addinEngine, RuntimeAddin parentAddin, ModuleDescription module)
{
this.addinEngine = addinEngine;
this.parentAddin = parentAddin;
this.module = module;
id = parentAddin.id;
baseDirectory = parentAddin.baseDirectory;
privatePath = parentAddin.privatePath;
ainfo = parentAddin.ainfo;
localizer = parentAddin.localizer;
module.RuntimeAddin = this;
}
开发者ID:slluis,项目名称:mono-addins,代码行数:12,代码来源:RuntimeAddin.cs
示例5: CreateLocalizer
public IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element)
{
string pkg = element.GetAttribute ("catalog");
if (pkg.Length == 0)
pkg = addin.Id;
string dir = element.GetAttribute ("location");
if (dir.Length == 0)
dir = "locale";
dir = addin.GetFilePath (dir);
domain = new GettextDomain ();
domain.Init (pkg, dir);
return this;
}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:13,代码来源:GettextLocalizer.cs
示例6: CreateSolutionDescriptor
public static SolutionDescriptor CreateSolutionDescriptor (RuntimeAddin addin, XmlElement xmlElement,
FilePath baseDirectory)
{
SolutionDescriptor solutionDescriptor = new SolutionDescriptor ();
solutionDescriptor.addin = addin;
if (xmlElement.Attributes["name"] != null)
solutionDescriptor.name = xmlElement.Attributes["name"].Value;
else
throw new InvalidOperationException ("Attribute 'name' not found");
if (xmlElement.Attributes["type"] != null)
solutionDescriptor.type = xmlElement.Attributes["type"].Value;
if (xmlElement.Attributes["directory"] != null)
solutionDescriptor.directory = xmlElement.Attributes["directory"].Value;
if (xmlElement["Options"] != null && xmlElement["Options"]["StartupProject"] != null)
solutionDescriptor.startupProject = xmlElement["Options"]["StartupProject"].InnerText;
foreach (XmlNode xmlNode in xmlElement.ChildNodes) {
if (xmlNode is XmlElement) {
XmlElement xmlNodeElement = (XmlElement)xmlNode;
switch (xmlNodeElement.Name) {
case "Project":
solutionDescriptor.entryDescriptors.Add (
ProjectDescriptor.CreateProjectDescriptor (xmlNodeElement, baseDirectory));
break;
case "CombineEntry":
case "SolutionItem":
solutionDescriptor.entryDescriptors.Add (
SolutionItemDescriptor.CreateDescriptor (addin, xmlNodeElement));
break;
}
}
}
return solutionDescriptor;
}
开发者ID:KseniaVensko,项目名称:gap-develop,代码行数:40,代码来源:SolutionDescriptor.cs
示例7: CreateLocalizer
public IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element)
{
foreach (NodeElement nloc in element.ChildNodes) {
if (nloc.NodeName != "Locale")
throw new InvalidOperationException ("Invalid element found: '" + nloc.NodeName + "'. Expected: 'Locale'");
string ln = nloc.GetAttribute ("id");
if (ln.Length == 0)
throw new InvalidOperationException ("Locale id not specified");
ln = ln.Replace ('_','-');
Hashtable messages = new Hashtable ();
foreach (NodeElement nmsg in nloc.ChildNodes) {
if (nmsg.NodeName != "Msg")
throw new InvalidOperationException ("Locale '" + ln + "': Invalid element found: '" + nmsg.NodeName + "'. Expected: 'Msg'");
string id = nmsg.GetAttribute ("id");
if (id.Length == 0)
throw new InvalidOperationException ("Locale '" + ln + "': Message id not specified");
messages [id] = nmsg.GetAttribute ("str");
}
locales [ln] = messages;
}
return this;
}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:22,代码来源:StringTableLocalizer.cs
示例8: LoadFileTemplate
private static FileTemplate LoadFileTemplate (RuntimeAddin addin, ProjectTemplateCodon codon)
{
XmlDocument xmlDocument = codon.GetTemplate ();
FilePath baseDirectory = codon.BaseDirectory;
//Configuration
XmlElement xmlNodeConfig = xmlDocument.DocumentElement["TemplateConfiguration"];
FileTemplate fileTemplate = null;
if (xmlNodeConfig["Type"] != null) {
Type configType = addin.GetType (xmlNodeConfig["Type"].InnerText);
if (typeof (FileTemplate).IsAssignableFrom (configType)) {
fileTemplate = (FileTemplate)Activator.CreateInstance (configType);
}
else
throw new InvalidOperationException (string.Format ("The file template class '{0}' must be a subclass of MonoDevelop.Ide.Templates.FileTemplate", xmlNodeConfig["Type"].InnerText));
}
else
fileTemplate = new FileTemplate ();
fileTemplate.originator = xmlDocument.DocumentElement.GetAttribute ("Originator");
fileTemplate.created = xmlDocument.DocumentElement.GetAttribute ("Created");
fileTemplate.lastModified = xmlDocument.DocumentElement.GetAttribute ("LastModified");
if (xmlNodeConfig["_Name"] != null) {
fileTemplate.name = xmlNodeConfig["_Name"].InnerText;
}
else {
throw new InvalidOperationException (string.Format ("Missing element '_Name' in file template: {0}", codon.Id));
}
if (xmlNodeConfig["_Category"] != null) {
fileTemplate.category = xmlNodeConfig["_Category"].InnerText;
}
else {
throw new InvalidOperationException (string.Format ("Missing element '_Category' in file template: {0}", codon.Id));
}
if (xmlNodeConfig["LanguageName"] != null) {
fileTemplate.languageName = xmlNodeConfig["LanguageName"].InnerText;
}
if (xmlNodeConfig["ProjectType"] != null) {
fileTemplate.projecttype = xmlNodeConfig["ProjectType"].InnerText;
}
if (xmlNodeConfig["_Description"] != null) {
fileTemplate.description = xmlNodeConfig["_Description"].InnerText;
}
if (xmlNodeConfig["Icon"] != null) {
fileTemplate.icon = ImageService.GetStockId (addin, xmlNodeConfig["Icon"].InnerText, IconSize.Dnd); //xmlNodeConfig["_Description"].InnerText;
}
if (xmlNodeConfig["Wizard"] != null) {
fileTemplate.icon = xmlNodeConfig["Wizard"].Attributes["path"].InnerText;
}
if (xmlNodeConfig["DefaultFilename"] != null) {
fileTemplate.defaultFilename = xmlNodeConfig["DefaultFilename"].InnerText;
string isFixed = xmlNodeConfig["DefaultFilename"].GetAttribute ("IsFixed");
if (isFixed.Length > 0) {
bool bFixed;
if (bool.TryParse (isFixed, out bFixed))
fileTemplate.isFixedFilename = bFixed;
else
throw new InvalidOperationException ("Invalid value for IsFixed in template.");
}
}
//Template files
XmlNode xmlNodeTemplates = xmlDocument.DocumentElement["TemplateFiles"];
if(xmlNodeTemplates != null) {
foreach(XmlNode xmlNode in xmlNodeTemplates.ChildNodes) {
if(xmlNode is XmlElement) {
fileTemplate.files.Add (
FileDescriptionTemplate.CreateTemplate ((XmlElement)xmlNode, baseDirectory));
}
}
}
//Conditions
XmlNode xmlNodeConditions = xmlDocument.DocumentElement["Conditions"];
if(xmlNodeConditions != null) {
foreach(XmlNode xmlNode in xmlNodeConditions.ChildNodes) {
if(xmlNode is XmlElement) {
fileTemplate.conditions.Add (FileTemplateCondition.CreateCondition ((XmlElement)xmlNode));
}
}
}
return fileTemplate;
}
开发者ID:riverans,项目名称:monodevelop,代码行数:95,代码来源:FileTemplate.cs
示例9: GetStockId
internal static string GetStockId (RuntimeAddin addin, string icon)
{
return icon;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:CommandCodon.cs
示例10: LoadStockIcon
static Xwt.Drawing.Image LoadStockIcon (RuntimeAddin addin, string stockId, string resource, string imageFile, string iconId, Gtk.IconSize iconSize, string animation, bool forceWildcard)
{
try {
Gdk.Pixbuf pixbuf = null, pixbuf2x = null;
AnimatedIcon animatedIcon = null;
Func<Stream[]> imageLoader = null;
if (!string.IsNullOrEmpty (resource) || !string.IsNullOrEmpty (imageFile)) {
// using the stream directly produces a gdk warning.
byte[] buffer;
if (resource != null) {
imageLoader = delegate {
var stream = addin.GetResource (resource);
var stream2x = addin.GetResource2x (resource);
if (stream2x == null)
return new [] { stream };
else
return new [] { stream, stream2x };
};
}
else {
imageLoader = delegate {
var file = addin.GetFilePath (imageFile);
var stream = File.OpenRead (file);
Stream stream2x = null;
var file2x = Path.Combine (Path.GetDirectoryName (file), Path.GetFileNameWithoutExtension (file) + "@2x" + Path.GetExtension (file));
if (File.Exists (file2x))
stream2x = File.OpenRead (file2x);
else {
file2x = file + "@2x";
if (File.Exists (file2x))
stream2x = File.OpenRead (file2x);
}
if (stream2x == null)
return new [] { stream };
else
return new [] { stream, stream2x };
};
}
var streams = imageLoader ();
var st = streams[0];
var st2x = streams.Length > 1 ? streams[1] : null;
using (st) {
if (st == null || st.Length < 0) {
LoggingService.LogError ("Did not find resource '{0}' in addin '{1}' for icon '{2}'",
resource, addin.Id, stockId);
return null;
}
buffer = new byte [st.Length];
st.Read (buffer, 0, (int)st.Length);
}
pixbuf = new Gdk.Pixbuf (buffer);
using (st2x) {
if (st2x != null && st2x.Length >= 0) {
buffer = new byte [st2x.Length];
st2x.Read (buffer, 0, (int)st2x.Length);
pixbuf2x = new Gdk.Pixbuf (buffer);
}
}
} else if (!string.IsNullOrEmpty (iconId)) {
var id = GetStockIdForImageSpec (addin, iconId, iconSize);
pixbuf = GetPixbuf (id, iconSize);
pixbuf2x = Get2xIconVariant (pixbuf);
// This may be an animation, get it
animationFactory.TryGetValue (id, out animatedIcon);
} else if (!string.IsNullOrEmpty (animation)) {
string id = GetStockIdForImageSpec (addin, "animation:" + animation, iconSize);
pixbuf = GetPixbuf (id, iconSize);
// This *should* be an animation
animationFactory.TryGetValue (id, out animatedIcon);
}
Gtk.IconSize size = forceWildcard? Gtk.IconSize.Invalid : iconSize;
if (pixbuf != null)
AddToIconFactory (stockId, pixbuf, pixbuf2x, size);
if (animatedIcon != null)
AddToAnimatedIconFactory (stockId, animatedIcon);
var img = Xwt.Toolkit.CurrentEngine.WrapImage (pixbuf);
if (pixbuf2x != null) {
var img2x = Xwt.Toolkit.CurrentEngine.WrapImage (pixbuf2x);
img = Xwt.Drawing.Image.CreateMultiResolutionImage (new [] { img, img2x });
}
if (imageLoader != null)
img.SetStreamSource (imageLoader);
return img;
} catch (Exception ex) {
LoggingService.LogError (string.Format ("Error loading icon '{0}'", stockId), ex);
return null;
}
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:99,代码来源:ImageService.cs
示例11: InternalGetStockIdFromResource
static string InternalGetStockIdFromResource (RuntimeAddin addin, string id, Gtk.IconSize size)
{
if (!id.StartsWith ("res:", StringComparison.Ordinal))
return id;
id = id.Substring (4);
int addinId = GetAddinId (addin);
Dictionary<string, string> hash = addinIcons[addinId];
string stockId = "__asm" + addinId + "__" + id + "__" + size;
if (!hash.ContainsKey (stockId)) {
icons[stockId] = LoadStockIcon (addin, stockId, id, null, null, size, null, false);
hash[stockId] = stockId;
}
return stockId;
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:15,代码来源:ImageService.cs
示例12: SetDefaultHandlerTypeInfo
public void SetDefaultHandlerTypeInfo (RuntimeAddin addin, string typeName)
{
defaultHandlerAddin = addin;
defaultHandlerTypeName = typeName;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:5,代码来源:ActionCommand.cs
示例13: CustomImageLoader
public CustomImageLoader (RuntimeAddin addin)
{
this.addin = addin;
}
开发者ID:vvarshne,项目名称:monodevelop,代码行数:4,代码来源:ImageService.cs
示例14: PrivGetStockId
static string PrivGetStockId (RuntimeAddin addin, string filename, Gtk.IconSize size)
{
if (addin != null && filename.StartsWith ("res:"))
return InternalGetStockIdFromResource (addin, filename, size);
if (filename.StartsWith ("animation:"))
return InternalGetStockIdFromAnimation (addin, filename, size);
return filename;
}
开发者ID:alexrp,项目名称:monodevelop,代码行数:10,代码来源:ImageService.cs
示例15: ProjectTemplate
protected ProjectTemplate (RuntimeAddin addin, string id, ProjectTemplateCodon codon, string overrideLanguage)
{
XmlDocument xmlDocument = codon.GetTemplate ();
XmlElement xmlConfiguration = xmlDocument.DocumentElement ["TemplateConfiguration"];
// Get legacy category.
if (xmlConfiguration ["_Category"] != null) {
category = xmlConfiguration ["_Category"].InnerText;
}
if (xmlConfiguration ["Category"] != null) {
category = xmlConfiguration ["Category"].InnerText;
} else if (category == null) {
LoggingService.LogWarning (string.Format ("Category missing in project template {0}", codon.Id));
}
if (!string.IsNullOrEmpty (overrideLanguage)) {
this.languagename = overrideLanguage;
this.category = overrideLanguage + "/" + this.category;
}
else if (xmlConfiguration ["LanguageName"] != null) {
List<string> listLanguages = new List<string> ();
foreach (string item in xmlConfiguration ["LanguageName"].InnerText.Split (','))
listLanguages.Add (item.Trim ());
ExpandLanguageWildcards (listLanguages);
this.languagename = listLanguages [0];
if (listLanguages.Count > 1 && !String.IsNullOrEmpty (languagename) && !category.StartsWith (languagename + "/"))
category = languagename + "/" + category;
for (int i = 1; i < listLanguages.Count; i++) {
string language = listLanguages[i];
try {
ProjectTemplates.Add (new ProjectTemplate (addin, id, codon, language));
} catch (Exception e) {
LoggingService.LogError (GettextCatalog.GetString ("Error loading template {0} for language {1}", codon.Id, language), e);
}
}
}
this.id = id;
this.originator = xmlDocument.DocumentElement.GetAttribute ("originator");
this.created = xmlDocument.DocumentElement.GetAttribute ("created");
this.lastModified = xmlDocument.DocumentElement.GetAttribute ("lastModified");
if (xmlConfiguration ["Wizard"] != null) {
this.wizardPath = xmlConfiguration ["Wizard"].InnerText;
}
if (xmlConfiguration ["_Name"] != null) {
this.nonLocalizedName = xmlConfiguration ["_Name"].InnerText;
this.name = addin.Localizer.GetString (this.nonLocalizedName);
}
if (xmlConfiguration ["_Description"] != null) {
this.description = addin.Localizer.GetString (xmlConfiguration ["_Description"].InnerText);
}
if (xmlConfiguration ["Icon"] != null) {
this.icon = ImageService.GetStockId (addin, xmlConfiguration ["Icon"].InnerText, Gtk.IconSize.Dnd);
}
if (xmlConfiguration ["GroupId"] != null) {
this.groupId = xmlConfiguration ["GroupId"].InnerText;
this.condition = xmlConfiguration ["GroupId"].GetAttribute ("condition");
}
if (xmlConfiguration ["FileExtension"] != null) {
this.fileExtension = xmlConfiguration ["FileExtension"].InnerText;
}
if (xmlConfiguration ["SupportedParameters"] != null) {
this.supportedParameters = xmlConfiguration ["SupportedParameters"].InnerText;
}
if (xmlConfiguration ["DefaultParameters"] != null) {
this.defaultParameters = xmlConfiguration ["DefaultParameters"].InnerText;
}
if (xmlConfiguration ["Image"] != null) {
XmlElement imageElement = xmlConfiguration ["Image"];
imageId = imageElement.GetAttribute ("id");
imageFile = imageElement.GetAttribute ("file");
if (!String.IsNullOrEmpty (imageFile)) {
imageFile = Path.Combine (codon.BaseDirectory, imageFile);
}
}
if (xmlConfiguration ["Visibility"] != null) {
visibility = xmlConfiguration ["Visibility"].InnerText;
}
if (xmlDocument.DocumentElement ["Combine"] == null) {
throw new InvalidOperationException ("Combine element not found");
}
//.........这里部分代码省略.........
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:101,代码来源:ProjectTemplate.cs
示例16: InternalGetStockIdFromResource
static string InternalGetStockIdFromResource (RuntimeAddin addin, string id, Gtk.IconSize size)
{
if (!id.StartsWith ("res:", StringComparison.Ordinal))
return id;
id = id.Substring (4);
int addinId = GetAddinId (addin);
Dictionary<string, string> hash = addinIcons[addinId];
string stockId = "__asm" + addinId + "__" + id + "__" + size;
if (!hash.ContainsKey (stockId)) {
System.IO.Stream stream = addin.GetResource (id);
if (stream != null) {
Gdk.Pixbuf pix1, pix2 = null;
using (stream) {
pix1 = new Gdk.Pixbuf (stream);
}
stream = addin.GetResource2x (id);
if (stream != null) {
using (stream) {
pix2 = new Gdk.Pixbuf (stream);
}
}
AddToIconFactory (stockId, pix1, pix2, size);
}
hash[stockId] = stockId;
}
return stockId;
}
开发者ID:alexrp,项目名称:monodevelop,代码行数:28,代码来源:ImageService.cs
示例17: GetAddinId
static int GetAddinId (RuntimeAddin addin)
{
int result = addins.IndexOf (addin);
if (result == -1) {
result = addins.Count;
addinIcons.Add (new Dictionary<string, string> ());
}
return result;
}
开发者ID:alexrp,项目名称:monodevelop,代码行数:9,代码来源:ImageService.cs
示例18: GetStockId
public static string GetStockId (RuntimeAddin addin, string filename)
{
return GetStockId (addin, filename, Gtk.IconSize.Invalid);
}
开发者ID:alexrp,项目名称:monodevelop,代码行数:4,代码来源:ImageService.cs
示例19: GetModule
internal RuntimeAddin GetModule(ModuleDescription module)
{
// If requesting the root module, return this
if (module == module.ParentAddinDescription.MainModule)
return this;
if (module.RuntimeAddin != null)
return module.RuntimeAddin;
RuntimeAddin addin = new RuntimeAddin (addinEngine, this, module);
return addin;
}
开发者ID:slluis,项目名称:mono-addins,代码行数:12,代码来源:RuntimeAddin.cs
示例20: RegisterAssemblies
internal void RegisterAssemblies (RuntimeAddin addin)
{
lock (LocalLock) {
var loadedAssembliesCopy = new Dictionary<Assembly,RuntimeAddin> (loadedAssemblies);
foreach (Assembly asm in addin.Assemblies)
loadedAssembliesCopy [asm] = addin;
loadedAssemblies = loadedAssembliesCopy;
}
}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:9,代码来源:AddinEngine.cs
注:本文中的Mono.Addins.RuntimeAddin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论