Beispiel #1
0
        public ProjectFile(GMData dataHandle, string directoryPath, Warning warningHandler = null)
        {
            DataHandle     = dataHandle;
            DirectoryPath  = directoryPath;
            WarningHandler = warningHandler;

            JsonFile = new ProjectJson();

            ConvertDataToProject.Convert(this);
        }
Beispiel #2
0
        public void Load()
        {
            JsonFile = JsonSerializer.Deserialize <ProjectJson>(
                File.ReadAllBytes(Path.Combine(DirectoryPath, "project.json")),
                JsonOptions);

            // Compare data file for mismatch
            unsafe
            {
                fixed(byte *a = DataHandle.Hash, b = JsonFile.BaseFileHash)
                {
                    int *ai = (int *)a, bi = (int *)b;

                    if (DataHandle.Length != JsonFile.BaseFileLength || ai[0] != bi[0] || ai[1] != bi[1] || ai[2] != bi[2] || ai[3] != bi[3] || ai[4] != bi[4])
                    {
                        WarningHandler?.Invoke(WarningType.DataFileMismatch);
                    }
                }
            }

            LoadAssets(Paths);
            LoadAssets(Sounds);
            LoadAssets(Objects);
        }