public void Init(IContentReference contentReference) { this.contentReference = contentReference; //Immediatly increment the instance count contentReference.IncrementReferences(); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { IContentReference result = (IContentReference)this.getGlobalObject <FastActivator>().createInstance(objectType); if (reader.TokenType == JsonToken.Null) { return(result); } // Load JObject from stream JObject jo = JObject.Load(reader); JToken guid_token = jo.GetValue(nameof(BaseContent.guid)); if (guid_token == null || guid_token.Type == JTokenType.Null) { return(result); } Guid guid = Guid.Empty; if (Guid.TryParse(guid_token.Value <string>(), out guid)) { result.guid = guid; } return(result); }
/// <summary> /// Create an asset dependency of type <paramref name="type"/> and pointing to <paramref name="item"/> /// </summary> /// <param name="item">The item the dependency is pointing to</param> /// <param name="type">The type of the dependency between the items</param> public AssetLink(AssetItem item, ContentLinkType type) { if (item == null) throw new ArgumentNullException("item"); Item = item; this.type = type; reference = item.ToReference(); }
// This constructor exists for better factorization of code in AssetDependencies. // It should not be turned into public as AssetItem is not valid. internal AssetLink(IContentReference reference, ContentLinkType type) { if (reference == null) throw new ArgumentNullException("reference"); Item = null; this.type = type; this.reference = reference; }
/// <summary> /// Creates a proxy object with <see cref="AttachedReference" /> designing it as a proxy with a given id and location (that can be used with <see cref="Assets.AssetManager" />). This allows to construct and save object references without actually loading them. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="contentReference">The content reference.</param> /// <returns>T.</returns> /// <exception cref="System.ArgumentNullException">contentReference</exception> public static T CreateSerializableVersion <T>(IContentReference contentReference) where T : class, new() { if (contentReference == null) { throw new ArgumentNullException("contentReference"); } return(CreateSerializableVersion <T>(contentReference.Id, contentReference.Location)); }
/// <summary> /// Initializes a new instance of the <see cref="AssetLogMessage" /> class. /// </summary> /// <param name="package">The package.</param> /// <param name="assetReference">The asset reference.</param> /// <param name="type">The type.</param> /// <param name="messageCode">The message code.</param> /// <exception cref="System.ArgumentNullException">asset</exception> public AssetLogMessage(Package package, IContentReference assetReference, LogMessageType type, AssetMessageCode messageCode) { this.package = package; AssetReference = assetReference; Type = type; MessageCode = messageCode; Related = new List<IContentReference>(); Text = AssetMessageStrings.ResourceManager.GetString(messageCode.ToString()) ?? messageCode.ToString(); }
public static void Warning(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IEnumerable<IContentReference> relatedGuids, params object[] arguments) { var logMessage = new AssetLogMessage(package, assetReference, LogMessageType.Warning, code, arguments); if (relatedGuids != null) { logMessage.Related.AddRange(relatedGuids); } logger.Log(logMessage); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IEnumerable<IContentReference> relatedGuids, Exception exception = null) { var logMessage = new AssetLogMessage(package, assetReference, LogMessageType.Error, code) { Exception = exception }; if (relatedGuids != null) { logMessage.Related.AddRange(relatedGuids); } logger.Log(logMessage); }
/// <summary> /// Initializes a new instance of the <see cref="AssetLogMessage" /> class. /// </summary> /// <param name="package">The package.</param> /// <param name="assetReference">The asset reference.</param> /// <param name="type">The type.</param> /// <param name="messageCode">The message code.</param> /// <exception cref="System.ArgumentNullException">asset</exception> public AssetLogMessage(Package package, IContentReference assetReference, LogMessageType type, AssetMessageCode messageCode) { this.package = package; AssetReference = assetReference; Type = type; MessageCode = messageCode; Related = new List <IContentReference>(); Text = AssetMessageStrings.ResourceManager.GetString(messageCode.ToString()) ?? messageCode.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="AssetLogMessage" /> class. /// </summary> /// <param name="package">The package.</param> /// <param name="assetReference">The asset reference.</param> /// <param name="type">The type.</param> /// <param name="messageCode">The message code.</param> /// <param name="arguments">The arguments.</param> /// <exception cref="System.ArgumentNullException">asset</exception> public AssetLogMessage(Package package, IContentReference assetReference, LogMessageType type, AssetMessageCode messageCode, params object[] arguments) { this.package = package; AssetReference = assetReference; Type = type; MessageCode = messageCode; Related = new List<IContentReference>(); var message = AssetMessageStrings.ResourceManager.GetString(messageCode.ToString()) ?? messageCode.ToString(); Text = string.Format(message, arguments); }
public static void Warning(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IEnumerable <IContentReference> relatedGuids, params object[] arguments) { var logMessage = new AssetLogMessage(package, assetReference, LogMessageType.Warning, code, arguments); if (relatedGuids != null) { logMessage.Related.AddRange(relatedGuids); } logger.Log(logMessage); }
public virtual T Get(string name) { IContentReference result = null; if (Entries.TryGetValue(name, out result)) { return(Converter(result.GetGeneric())); } return(default(T)); }
/// <summary> /// Initializes a new instance of the <see cref="AssetLogMessage" /> class. /// </summary> /// <param name="package">The package.</param> /// <param name="assetReference">The asset reference.</param> /// <param name="type">The type.</param> /// <param name="messageCode">The message code.</param> /// <param name="arguments">The arguments.</param> /// <exception cref="System.ArgumentNullException">asset</exception> public AssetLogMessage(Package package, IContentReference assetReference, LogMessageType type, AssetMessageCode messageCode, params object[] arguments) { this.package = package; AssetReference = assetReference; Type = type; MessageCode = messageCode; Related = new List <IContentReference>(); var message = AssetMessageStrings.ResourceManager.GetString(messageCode.ToString()) ?? messageCode.ToString(); Text = string.Format(message, arguments); }
// This constructor exists for better factorization of code in AssetDependencies. // It should not be turned into public as AssetItem is not valid. internal AssetLink(IContentReference reference, ContentLinkType type) { if (reference == null) { throw new ArgumentNullException("reference"); } Item = null; this.type = type; this.reference = reference; }
/// <summary> /// Create an asset dependency of type <paramref name="type"/> and pointing to <paramref name="item"/> /// </summary> /// <param name="item">The item the dependency is pointing to</param> /// <param name="type">The type of the dependency between the items</param> public AssetLink(AssetItem item, ContentLinkType type) { if (item == null) { throw new ArgumentNullException("item"); } Item = item; this.type = type; reference = item.ToReference(); }
// Token: 0x06000FD1 RID: 4049 RVA: 0x00069374 File Offset: 0x00067774 public void OnDrop(PointerEventData eventData) { if (!(Sleek2DragManager.item is IContentReference)) { return; } if (typeof(T).IsAssignableFrom(Sleek2DragManager.item.GetType().GetGenericArguments()[0])) { IContentReference contentReference = (IContentReference)Sleek2DragManager.item; this.triggerContentReferenceDocked(new ContentReference <T>(contentReference)); } }
/// <summary> /// Adds a missing reference. /// </summary> /// <param name="contentReference">The content reference.</param> /// <exception cref="System.ArgumentNullException">contentReference</exception> public void AddMissingReference(IContentReference contentReference) { if (contentReference == null) { throw new ArgumentNullException("contentReference"); } if (missingReferences == null) { missingReferences = new List <IContentReference>(); } missingReferences.Add(contentReference); }
public static bool isSameAs(this IContentReference source, IContentReference target) { if (source == null && target == null) { return(true); } //one of them is not null, so what to use Equals class methods if (source != null) { return(source.Equals(target)); } return(target.Equals(source)); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IEnumerable <IContentReference> relatedGuids, Exception exception = null) { var logMessage = new AssetLogMessage(package, assetReference, LogMessageType.Error, code) { Exception = exception }; if (relatedGuids != null) { logMessage.Related.AddRange(relatedGuids); } logger.Log(logMessage); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, params object[] arguments) { Error(logger, package, assetReference, code, (IEnumerable <IContentReference>)null, arguments); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IEnumerable <IContentReference> relatedGuids, params object[] arguments) { Error(logger, package, assetReference, code, relatedGuids, (Exception)null, arguments); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IContentReference[] relatedGuids, Exception exception = null) { Error(logger, package, assetReference, code, (IEnumerable<IContentReference>)relatedGuids, exception); }
/// <summary> /// Finds an asset from all the packages by its asset reference. /// It will first try by id, then location. /// </summary> /// <param name="package">The package.</param> /// <param name="contentReference">The reference to the asset.</param> /// <returns>An <see cref="AssetItem" /> or <c>null</c> if not found.</returns> public static AssetItem FindAsset(this Package package, IContentReference contentReference) { return(package.FindAsset(contentReference.Id) ?? package.FindAsset(contentReference.Location)); }
/// <summary> /// Adds a broken link out. /// </summary> /// <param name="reference">the reference to the missing element</param> /// <param name="contentLinkType">The type of link</param> /// <exception cref="ArgumentException">A broken link to this element already exists</exception> public void AddBrokenLinkOut(IContentReference reference, ContentLinkType contentLinkType) { AddLink(ref missingChildren, new AssetLink(reference, contentLinkType), false); }
public static bool isSameAs <T>(this IContentReference source, T target) where T : IContent, new() { return(isSameAs(source, (IContentReference) new ContentReference <T>(target))); }
public static bool isReferedBy <T>(this T source, IContentReference target) where T : IContent, new() { return(target.isSameAs(source)); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IEnumerable<IContentReference> relatedGuids, params object[] arguments) { Error(logger, package, assetReference, code, relatedGuids, (Exception)null, arguments); }
/// <summary> /// Adds a broken link out. /// </summary> /// <param name="reference">the reference to the missing element</param> /// <param name="contentLinkType">The type of link</param> /// <exception cref="ArgumentException">A broken link to this element already exists</exception> public void AddBrokenLinkOut(IContentReference reference, ContentLinkType contentLinkType) { AddLink(ref missingChildren, new AssetLink(reference, contentLinkType), false); }
private static bool IsNewReference(Tuple <Guid, UFile> newReference, IContentReference previousReference) { return(newReference.Item1 != previousReference.Id || newReference.Item2 != previousReference.Location); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, Exception exception, params object[] arguments) { Error(logger, package, assetReference, code, null, exception, arguments); }
public static void Warning(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, params object[] arguments) { Warning(logger, package, assetReference, code, null, arguments); }
/// <summary> /// Finds an asset from all the packages by its asset reference. /// It will first try by id, then location. /// </summary> /// <param name="package">The package.</param> /// <param name="contentReference">The reference to the asset.</param> /// <returns>An <see cref="AssetItem" /> or <c>null</c> if not found.</returns> public static AssetItem FindAsset(this Package package, IContentReference contentReference) { return package.FindAsset(contentReference.Id) ?? package.FindAsset(contentReference.Location); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IContentReference[] relatedGuids, Exception exception = null) { Error(logger, package, assetReference, code, (IEnumerable <IContentReference>)relatedGuids, exception); }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, Exception exception, params object[] arguments) { Error(logger, package, assetReference, code, null, exception, arguments); }
public static void Warning(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IContentReference[] relatedGuids) { Warning(logger, package, assetReference, code, (IEnumerable<IContentReference>)null); }
public static void Warning(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, params object[] arguments) { Warning(logger, package, assetReference, code, null, arguments); }
public static void Warning(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, IContentReference[] relatedGuids) { Warning(logger, package, assetReference, code, (IEnumerable <IContentReference>)null); }
public void Add(IContentReference reference) { Pending.Add(reference); }
// Token: 0x06001998 RID: 6552 RVA: 0x000907B5 File Offset: 0x0008EBB5 public ContentReference(IContentReference contentReference) { this.name = contentReference.name; this.path = contentReference.path; }
public static void Error(this ILogger logger, Package package, IContentReference assetReference, AssetMessageCode code, params object[] arguments) { Error(logger, package, assetReference, code, (IEnumerable<IContentReference>)null, arguments); }