Beispiel #1
0
    public SerializerFile GetSerializerFile(Type type, string groupId, string key)
    {
        string dataPath   = GetDataPath(type, groupId, key);
        var    serializer = SerializerFile.Create(dataPath, key);

        return(serializer);
    }
Beispiel #2
0
    public void Save(Type type, string groupId, string key, object obj, Call call = null)
    {
        groupId ??= DefaultGroupId;
        call ??= new Call();
        SerializerFile serializer = GetSerializerFile(type, groupId, key);         // use hash since filesystems can't handle long names

        serializer.Save(call, obj, key);
    }
Beispiel #3
0
        private void Reset(Call call)
        {
            // How do we replace a shared pointer that exists everywhere? references?
            //call.Application.Restart();
            var serializer = SerializerFile.Create(Project.UserSettings.SettingsPath);

            serializer.Save(call, new ProjectSettings());
            Environment.Exit(0);
        }
    public void BaseSetup()
    {
        Initialize("Serialize");

        string basePath = Paths.Combine(TestPath, "Serialize");

        Directory.CreateDirectory(basePath);

        string filePath = Paths.Combine(basePath, "Data.atlas");

        serializerFile = new SerializerFileAtlas(filePath);
    }
Beispiel #5
0
    public T Load <T>(string groupId, string key, Call call, bool createIfNeeded = false, bool lazy = false)
    {
        SerializerFile serializerFile = GetSerializerFile(typeof(T), groupId, key);

        if (serializerFile.Exists)
        {
            T obj = serializerFile.Load <T>(call, lazy);
            if (obj != null)
            {
                return(obj);
            }
        }

        if (createIfNeeded)
        {
            T newObject = Activator.CreateInstance <T>();
            Debug.Assert(newObject != null);
            return(newObject);
        }
        return(default);
Beispiel #6
0
        private void Save(Call call)
        {
            var serializer = SerializerFile.Create(Project.UserSettings.SettingsPath);

            serializer.Save(call, Project.ProjectSettings);
        }