using UnityEditor.Build.Content;
using UnityEditor.Build.Pipeline.Interfaces;
using UnityEditor.Build.Pipeline.Utilities;
namespace UnityEditor.Build.Pipeline
{
///
/// Generates identifiers linearly for built content. Only deterministic if object order and initial Index is deterministic.
///
public class LinearPackedIdentifiers : IDeterministicIdentifiers
{
///
/// The index at which to start linear id assignment.
///
public long Index { get; set; }
///
/// Default constructor, takes an initial index at which to start linear id assignment.
///
/// Initial index at which to start linear id assignment.
public LinearPackedIdentifiers(long index)
{
Index = index;
}
///
public virtual string GenerateInternalFileName(string name)
{
var hash = HashingMethods.Calculate(name).ToString();
return string.Format("CAB-{0}", hash);
}
///
public virtual long SerializationIndexFromObjectIdentifier(ObjectIdentifier objectID)
{
return Index++;
}
}
}