Exemplo n.º 1
0
        internal WorldResource LoadSaveFromPath(string savePath, string userName, SaveWorldType saveType, UserDataPath dataPath)
        {
            var saveResource = new WorldResource
            {
                GroupDescription = string.Format("{0}: {1}", new EnumToResouceConverter().Convert(saveType, typeof(string), null, CultureInfo.CurrentUICulture), userName),
                SaveType         = saveType,
                Savename         = Path.GetFileName(savePath),
                UserName         = userName,
                Savepath         = savePath,
                DataPath         = dataPath,
            };

            return(saveResource);
        }
Exemplo n.º 2
0
        internal WorldResource LoadSaveFromPath(string savePath, string userName, SaveWorldType saveType, UserDataPath dataPath)
        {
            var saveResource = new WorldResource
            {
                GroupDescription = string.Format("{0}: {1}", new EnumToResouceConverter().Convert(saveType, typeof(string), null, CultureInfo.CurrentUICulture), userName),
                SaveType = saveType,
                Savename = Path.GetFileName(savePath),
                UserName = userName,
                Savepath = savePath,
                DataPath = dataPath,
            };

            return saveResource;
        }
Exemplo n.º 3
0
        private IEnumerable<WorldResource> FindSaveFiles(string lastLoadedPath, string userName, SaveWorldType saveType, UserDataPath dataPath)
        {
            var lastLoadedFile = Path.Combine(lastLoadedPath, SpaceEngineersConsts.LoadLoadedFilename);
            var list = new List<WorldResource>();

            // Ignore any other base Save paths without the LastLoaded file.
            if (File.Exists(lastLoadedFile))
            {
                MyObjectBuilder_LastLoadedTimes lastLoaded = null;
                try
                {
                    lastLoaded = SpaceEngineersApi.ReadSpaceEngineersFile<MyObjectBuilder_LastLoadedTimes>(lastLoadedFile);
                }
                catch { }
                var savePaths = Directory.GetDirectories(lastLoadedPath);

                // Still check every potential game world path.
                foreach (var savePath in savePaths)
                {
                    var saveResource = LoadSaveFromPath(savePath, userName, saveType, dataPath);
                    if (lastLoaded != null)
                    {
                        var last = lastLoaded.LastLoaded.Dictionary.FirstOrDefault(d => d.Key.Equals(savePath, StringComparison.OrdinalIgnoreCase));
                        if (last.Key != null)
                        {
                            saveResource.LastLoadTime = last.Value;
                        }
                    }

                    // This should still allow Games to be copied into the Save path manually.

                    saveResource.LoadCheckpoint();
                    list.Add(saveResource);
                }
            }

            return list;
        }
Exemplo n.º 4
0
        private IEnumerable <WorldResource> FindSaveFiles(string lastLoadedPath, string userName, SaveWorldType saveType, UserDataPath dataPath)
        {
            var lastLoadedFile = Path.Combine(lastLoadedPath, SpaceEngineersConsts.LoadLoadedFilename);
            var list           = new List <WorldResource>();

            // Ignore any other base Save paths without the LastLoaded file.
            if (File.Exists(lastLoadedFile))
            {
                MyObjectBuilder_LastLoadedTimes lastLoaded = null;
                try
                {
                    lastLoaded = SpaceEngineersApi.ReadSpaceEngineersFile <MyObjectBuilder_LastLoadedTimes>(lastLoadedFile);
                }
                catch { }
                var savePaths = Directory.GetDirectories(lastLoadedPath);

                // Still check every potential game world path.
                foreach (var savePath in savePaths)
                {
                    var saveResource = LoadSaveFromPath(savePath, userName, saveType, dataPath);
                    if (lastLoaded != null)
                    {
                        var last = lastLoaded.LastLoaded.Dictionary.FirstOrDefault(d => d.Key.Equals(savePath, StringComparison.OrdinalIgnoreCase));
                        if (last.Key != null)
                        {
                            saveResource.LastLoadTime = last.Value;
                        }
                    }

                    // This should still allow Games to be copied into the Save path manually.

                    saveResource.LoadCheckpoint();
                    list.Add(saveResource);
                }
            }

            return(list);
        }
Exemplo n.º 5
0
        private IEnumerable <WorldResource> FindSaveFiles(string lastLoadedPath, string userName, SaveWorldType saveType, UserDataPath dataPath)
        {
            var list = new List <WorldResource>();

            // Ignore any other base Save paths without the LastLoaded file.
            if (Directory.Exists(lastLoadedPath))
            {
                var savePaths = Directory.GetDirectories(lastLoadedPath);

                // Still check every potential game world path.
                foreach (var savePath in savePaths)
                {
                    var saveResource = LoadSaveFromPath(savePath, userName, saveType, dataPath);

                    // This should still allow Games to be copied into the Save path manually.
                    saveResource.LoadWorldInfo();
                    list.Add(saveResource);
                }
            }

            return(list);
        }