public static void SendBuildEvent(Project project, Build.BuildResult buildResult) { if (project?.Settings == null) { return; } var configEntity = project.WorldManager.GetConfigEntity(); var displayInfo = project.EntityManager.GetComponentData <DisplayInfo>(configEntity); var e = new BuildEvent() { package = PackageInfo.Create(), context = ContextInfo.Default, project = ProjectInfo.Create(project), duration = buildResult.Duration.Ticks, heap_size = project.Settings.WebSettings.MemorySizeInMB, opt_auto_resize = displayInfo.autoSizeToFrame, opt_webp_decompressor = false, // TODO: re-populate from settings opt_ecma5 = false, // deprecated opt_single_file_output = project.Settings.WebSettings.SingleFileOutput, opt_embed_assets = project.Settings.WebSettings.SingleFileOutput, default_texture_format = project.Settings.DefaultTextureSettings.FormatType.ToString() }; Send(EventName.tinyEditorBuild, e); }
public ExtendedPlugin(string name, out bool success) { try { Name = name; DomainName = Guid.NewGuid().ToString(); Domain = AppDomain.CreateDomain(DomainName); Assembly = Assembly.Load(new AssemblyName(Name)); var pluginInterface = Assembly.GetTypes().Where(s => s.GetInterfaces().Contains(typeof(IPlugin))).FirstOrDefault(); if (pluginInterface != null) { FileVersion = Assembly.FullName; Utilities.Log.WriteLineAndConsole($"Creating instance of: {name} / {pluginInterface.FullName}"); Instance = (IPlugin)Activator.CreateInstance(pluginInterface); Info = PackageInfo.Create(this); success = true; } else { Utilities.Log.WriteLineAndConsole($"Error registration plugin. File: \"{name}\" does not contain an interface \"IExtendedPlugin\""); AppDomain.Unload(Domain); success = false; } } catch (Exception e) { Utilities.Log.WriteLineAndConsole($"Cannot load Plugin: {name}, Error: {e.ToString()}"); AppDomain.Unload(Domain); success = false; } }
/// <summary> ///[PluginManagerInfoAttribute] ///public class Plugin : IPlugin { } /// </summary> /// <param name="plugin"></param> /// <returns></returns> public static PackageInfo Create(ExtendedPlugin plugin) { var instanceType = plugin.Instance.GetType(); var attributeType = plugin.Assembly.GetType(instanceType.Namespace + ".PackageInfoAttribute"); if (attributeType != null) { PackageInfo attribute; try { attribute = PackageInfo.Create(instanceType.GetCustomAttribute(attributeType)); } catch { attribute = null; } if (attribute != null) { return(attribute); } } return(null); }
private static void SendEvent(EventCategory category, string categoryName, string name, string message, string description, TimeSpan duration) { if (string.IsNullOrEmpty(categoryName) || string.IsNullOrEmpty(name)) { TraceError(new ArgumentNullException().ToString()); return; } var e = new GenericEvent() { package = PackageInfo.Create(), context = ContextInfo.Default, project = ProjectInfo.Default, category = categoryName, category_id = (int)category, name = name, message = message, description = description, duration = duration.Ticks }; Send(EventName.tinyEditor, e); }