Exemplo n.º 1
0
 public static void AttachWatcher(ModObject o)
 {
     if (WatcherProcesses.ContainsKey(o.GetDirectoryName()))
     {
         return;
     }
     WatcherProcesses.Add(o.GetDirectoryName(), new ScriptWatcher(o));
 }
Exemplo n.º 2
0
 public static void DetachWatcher(ModObject o)
 {
     if (WatcherProcesses.ContainsKey(o.GetDirectoryName()))
     {
         WatcherProcesses[o.GetDirectoryName()].Dispose();
         WatcherProcesses.Remove(o.GetDirectoryName());
     }
 }
Exemplo n.º 3
0
        public long GetIdForMod(ModObject mod)
        {
            var dirname = mod.GetDirectoryName();

            if (SteamWorkshopData.ContainsKey(dirname))
            {
                return(SteamWorkshopData[dirname]);
            }
            return(0);
        }
Exemplo n.º 4
0
        public void SetIdForMod(ModObject mod, long value)
        {
            var dirname = mod.GetDirectoryName();

            if (SteamWorkshopData.ContainsKey(dirname))
            {
                SteamWorkshopData[dirname] = value;
            }
            else
            {
                SteamWorkshopData.Add(dirname, value);
            }
            Save();
        }
Exemplo n.º 5
0
 public ExecutableArgumentsPair GetCompileScript(ModObject mod, bool watcher = false)
 {
     return(new ExecutableArgumentsPair(
                !watcher ? "Compiling scripts..." : "Changes in filesystem detected... Recompiling scripts...",
                EditorExecutablePath,
                new string[] {
         "make",
         "-FULL",
         "-SHORTPATHS",
         "-NOPAUSEONSUCCESS",
         "-MODSONLY=" + mod.GetDirectoryName()
     },
                Path.GetDirectoryName(EditorExecutablePath)
                ));
 }
Exemplo n.º 6
0
 public ExecutableArgumentsPair GetCookMod(ModObject mod)
 {
     return(new ExecutableArgumentsPair(
                "Cooking mod...",
                EditorExecutablePath,
                new string[]
     {
         "CookPackages",
         "-PLATFORM=PC",
         "-NOPAUSEONSUCCESS",
         "-FULL",
         "-FASTCOOK",
         "-MULTILANGUAGECOOK=" + (Properties.Settings.Default.MultilangCook ? "INT+CHN+DEU+ESN+FRA+ITA+JPN+KOR+PTB" : "INT"),
         "-MODSONLY=" + mod.GetDirectoryName()
     },
                Path.GetDirectoryName(EditorExecutablePath)
                ));
 }
Exemplo n.º 7
0
        public ModTile(ModObject mod)
        {
            InitializeComponent();

            contextMenuStrip1.Renderer  = new ToolStripProfessionalRenderer(new MenuColorTable());
            contextMenuStrip1.BackColor = ThemeConstants.BackgroundColor;
            contextMenuStrip1.ForeColor = ThemeConstants.ForegroundColor;

            OriginalColor = this.BackColor;

            this.Mod = mod;
            this.panel1.BackgroundImage = mod.GetIcon();
            this.label1.Text            = mod.Name + "\n(" + mod.GetDirectoryName() + ")";

            this.panel2.Visible = mod.IsReleased;

            checkBox1.CheckedChanged += CheckBox1_CheckedChanged;
            CheckBox1_CheckedChanged(null, null);

            this.MouseEnter += ModTile_MouseEnter;
            this.MouseLeave += ModTile_MouseLeave;

            this.panel1.MouseEnter += ModTile_MouseEnter;
            this.panel1.MouseLeave += ModTile_MouseLeave;

            this.label1.MouseEnter += ModTile_MouseEnter;
            this.label1.MouseLeave += ModTile_MouseLeave;

            checkBox1.Cursor = Cursors.Arrow;

            this.Click        += ModTile_Click;
            this.panel1.Click += ModTile_Click;
            this.label1.Click += ModTile_Click;

            scriptWatcherToolStripMenuItem2.Checked = ScriptWatcherManager.IsWatcherAttached(Mod);

            RevalidateBG();
        }
Exemplo n.º 8
0
        private void IterateContent(TreeNodeCollection root, ModObject mod, string currPath, string acceptExt, bool isBase = false)
        {
            if (!Directory.Exists(currPath))
            {
                return;
            }

            if (isBase)
            {
                var node = root.Add("folder", Path.GetFileName(currPath), "folder", "folder");
                IterateContent(node.Nodes, mod, currPath, acceptExt);
                return;
            }
            foreach (string path in Directory.GetFiles(currPath, "*.*"))
            {
                Debug.WriteLine(GameFinder.GetCookedPcDir());
                var exts      = acceptExt.Split('|');
                var extension = Path.GetExtension(path);
                var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
                if (!exts.Contains(acceptExt))
                {
                    var treeNode = root.Add("", Path.GetFileName(path), "error", "error");
                    var text     = "This asset does not belong here.";
                    foreach (var a in Adict)
                    {
                        if (exts.Contains(a.Key))
                        {
                            text += Environment.NewLine + a.Value;
                        }
                    }

                    foreach (var b in BDict)
                    {
                        if (extension == b.Key)
                        {
                            text += Environment.NewLine + b.Value;
                        }
                    }

                    treeNode.Tag    = new ContentTreeViewInfo(Path.GetFileName(path), text);
                    HasContentError = true;
                }
                else if (fileNameWithoutExtension.ToLower() == mod.GetDirectoryName().ToLower() && !exts.Contains(".int") && !exts.Contains(".umap"))
                {
                    var treeNode = root.Add("", Path.GetFileName(path), "error", "error");
                    treeNode.Tag    = new ContentTreeViewInfo(Path.GetFileName(path), "Packages can't have the same name as your mod folder.\nAdd a _Content suffix or something. Example:\n" + fileNameWithoutExtension + "_Content" + extension);
                    HasContentError = true;
                }
                else if (Utils.FileExists(GameFinder.GetCookedPcDir(), Path.GetFileName(path)))
                {
                    var treeNode = root.Add("", Path.GetFileName(path), "error", "error");
                    treeNode.Tag    = new ContentTreeViewInfo(Path.GetFileName(path), "There's an asset with an identical name in CookedPC.\nPlease give your asset another name.\n(btw don't put your own stuff in CookedPC. Keep it to the mods folder.)");
                    HasContentError = true;
                }
                else
                {
                    var ext      = exts.Contains(".int") ? "localization" : "package";
                    var treeNode = root.Add("", Path.GetFileName(path), ext, ext);
                    treeNode.Tag = new ContentTreeViewInfo(Path.GetFileName(path), "");
                }
            }
            foreach (var file in Directory.GetDirectories(currPath))
            {
                var node = root.Add("", Path.GetFileName(file), "folder", "folder");
                IterateContent(node.Nodes, mod, file, acceptExt);
            }
        }
Exemplo n.º 9
0
 public static bool IsWatcherAttached(ModObject o)
 {
     return(WatcherProcesses.ContainsKey(o.GetDirectoryName()));
 }