Exemplo n.º 1
0
        public void SelectWorld(string worldPath, bool modsOnly = true)
        {
            DedicatedConfig.LoadWorld = worldPath;

            var worldInfo = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath);

            try
            {
                if (worldInfo?.Checkpoint == null)
                {
                    worldInfo = new WorldViewModel(worldPath);
                    DedicatedConfig.Worlds.Add(worldInfo);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Failed to load world at path: " + worldPath);
                DedicatedConfig.LoadWorld = null;
                return;
            }

            DedicatedConfig.SelectedWorld = worldInfo;
            if (DedicatedConfig.SelectedWorld?.Checkpoint != null)
            {
                DedicatedConfig.Mods.Clear();
                //remove the Torch mod to avoid running multiple copies of it
                DedicatedConfig.SelectedWorld.WorldConfiguration.Mods.RemoveAll(m => m.PublishedFileId == TorchModCore.MOD_ID);
                foreach (var m in DedicatedConfig.SelectedWorld.WorldConfiguration.Mods)
                {
                    DedicatedConfig.Mods.Add(new ModItemInfo(m));
                }
                Task.Run(() => DedicatedConfig.UpdateAllModInfosAsync());
            }
        }
Exemplo n.º 2
0
 public void SelectWorld(WorldViewModel world, bool modsOnly = true)
 {
     DedicatedConfig.LoadWorld     = world.WorldPath;
     DedicatedConfig.SelectedWorld = world;
     if (DedicatedConfig.SelectedWorld?.Checkpoint != null)
     {
         DedicatedConfig.Mods.Clear();
         //remove the Torch mod to avoid running multiple copies of it
         DedicatedConfig.SelectedWorld.Checkpoint.Mods.RemoveAll(m => m.PublishedFileId == TorchModCore.MOD_ID);
         foreach (var m in DedicatedConfig.SelectedWorld.Checkpoint.Mods)
         {
             DedicatedConfig.Mods.Add(m.PublishedFileId);
         }
     }
 }
Exemplo n.º 3
0
 public void SelectWorld(WorldViewModel world, bool modsOnly = true)
 {
     DedicatedConfig.LoadWorld     = world.WorldPath;
     DedicatedConfig.SelectedWorld = world;
     if (DedicatedConfig.SelectedWorld?.Checkpoint != null)
     {
         DedicatedConfig.Mods.Clear();
         //remove the Torch mod to avoid running multiple copies of it
         DedicatedConfig.SelectedWorld.WorldConfiguration.Mods.RemoveAll(m => m.PublishedFileId == TorchModCore.MOD_ID);
         foreach (var m in DedicatedConfig.SelectedWorld.WorldConfiguration.Mods)
         {
             DedicatedConfig.Mods.Add(new ModItemInfo(m));
         }
         Task.Run(() => DedicatedConfig.UpdateAllModInfosAsync());
     }
 }
Exemplo n.º 4
0
        private void ImportWorldConfig(WorldViewModel world, bool modsOnly = true)
        {
            var mods = new MtObservableList <ModItemInfo>();

            foreach (var mod in world.WorldConfiguration.Mods)
            {
                mods.Add(new ModItemInfo(mod));
            }
            DedicatedConfig.Mods = mods;


            Log.Debug("Loaded mod list from world");

            if (!modsOnly)
            {
                DedicatedConfig.SessionSettings = world.WorldConfiguration.Settings;
            }
        }
Exemplo n.º 5
0
        private void ImportWorldConfig(WorldViewModel world, bool modsOnly = true)
        {
            var sb = new StringBuilder();

            foreach (var mod in world.Checkpoint.Mods)
            {
                sb.AppendLine(mod.PublishedFileId.ToString());
            }

            DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList();

            Log.Debug("Loaded mod list from world");

            if (!modsOnly)
            {
                DedicatedConfig.SessionSettings = world.Checkpoint.Settings;
            }
        }
Exemplo n.º 6
0
 public void SelectWorld(WorldViewModel world, bool modsOnly = true)
 {
     if (DedicatedConfig.SelectedWorld?.Checkpoint != null)
     {
         DedicatedConfig.Mods.Clear();
         //remove the Torch mod to avoid running multiple copies of it
         DedicatedConfig.SelectedWorld.Checkpoint.Mods.RemoveAll(m => m.PublishedFileId == TorchModCore.MOD_ID);
         foreach (var m in DedicatedConfig.SelectedWorld.Checkpoint.Mods)
         {
             DedicatedConfig.Mods.Add(new ModItemInfo(m));
         }
         Task.Run(() => DedicatedConfig.UpdateAllModInfosAsync());
         DedicatedConfig.Administrators = DedicatedConfig.SelectedWorld.Checkpoint.PromotedUsers.Dictionary
                                          .Where(p => p.Value == VRage.Game.ModAPI.MyPromoteLevel.Admin || p.Value == VRage.Game.ModAPI.MyPromoteLevel.Owner)
                                          .Select(p => p.Key.ToString())
                                          .ToList();
     }
 }
Exemplo n.º 7
0
        public void SelectWorld(string worldPath, bool modsOnly = true)
        {
            DedicatedConfig.LoadWorld = worldPath;

            var worldInfo = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath);

            try
            {
                if (worldInfo?.Checkpoint == null)
                {
                    worldInfo = new WorldViewModel(worldPath);
                    DedicatedConfig.Worlds.Add(worldInfo);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Failed to load world at path: " + worldPath);
                DedicatedConfig.LoadWorld = null;
                return;
            }

            SelectWorld(worldInfo);
        }
Exemplo n.º 8
0
 public void SelectWorld(WorldViewModel world, bool modsOnly = true)
 {
     DedicatedConfig.LoadWorld     = world.WorldPath;
     DedicatedConfig.SelectedWorld = world;
 }