Exemple #1
0
 public static void DeleteMod(object state)
 {
     var op = state as DeleteMod;
     string targetDir = Path.Combine(d2mpDir, op.Mod.name);
     if (Directory.Exists(targetDir)) Directory.Delete(targetDir, true);
     log.Debug("Server/user requested that we delete mod " + op.Mod.name + ".");
     var msg = new OnDeletedMod
     {
         Mod = op.Mod
     };
     Send(JObject.FromObject(msg).ToString(Formatting.None));
     var existing = modController.clientMods.FirstOrDefault(m => m.name == op.Mod.name);
     if (existing != null) modController.clientMods.Remove(existing);
     refreshMods();
 }
Exemple #2
0
        public static void DeleteMod(object state)
        {
            var op = state as DeleteMod;
            string targetDir = Path.Combine(d2mpDir, op.Mod.name);

            if (Directory.Exists(targetDir)) Directory.Delete(targetDir, true);

            //close dota before removing active mod, otherwise we might crash
            if (activeMod != null && activeMod.name == op.Mod.name)
            {
                //if (Dota2Running()) KillDota2();

                try
                {
                    Directory.Delete(modDir, true);
                }
                finally
                {
                    activeMod = GetActiveMod();
                }
            }

            log.Debug("Server/user requested that we delete mod " + op.Mod.name + ".");
            var msg = new OnDeletedMod
            {
                Mod = op.Mod
            };
            Send(JObject.FromObject(msg).ToString(Formatting.None));
            var existing = modController.clientMods.FirstOrDefault(m => m.name == op.Mod.name);
            if (existing != null) modController.clientMods.Remove(existing);
            refreshMods();
        }