GetAliasFile() public method

public GetAliasFile ( string alias ) : ModuleFile
alias string
return ModuleFile
        public ModuleFile GetModuleFile(string fullAlias)
        {
            int    indexOfColon = fullAlias.IndexOf(':');
            string module       = fullAlias.Substring(0, indexOfColon);
            string alias        = fullAlias.Substring(indexOfColon + 1);
            Module mod          = ModuleDataManager.GetInstance().GetMod(module);

            if (mod == null)
            {
                return(null);
            }

            return(mod.GetAliasFile(alias));
        }
Esempio n. 2
0
        public bool Clone(CloneObjectParameters parameters, HashSet <string> alreadyCloned, bool execute)
        {
            string newAlias      = parameters.TransformAlias(mAlias);
            string sourceModName = Module.Name;
            string targetModName = parameters.TargetModule == null ? sourceModName : parameters.TargetModule;
            Module targetModule  = ModuleDataManager.GetInstance().GetMod(targetModName);

            if (targetModule.GetAliasFile(newAlias) != null)
            {
                // MessageBox.Show("The alias " + newAlias + " already exists in manifest.json");
                return(false);
            }

            string modPath      = targetModule.ParentDirectory;
            string relativePath = ResolvedPath.Replace(mModule.Path + "/", "");
            string newPath      = parameters.TransformParameter(relativePath);
            string fullPath     = modPath + "/" + targetModName + "/" + newPath;

            if (!FileData.Clone(fullPath, parameters, alreadyCloned, execute))
            {
                return(false);
            }

            alreadyCloned.Add(targetModName + ':' + newAlias);
            if (execute)
            {
                string     fileLocation = "file(" + newPath + ")";
                ModuleFile file         = new ModuleFile(targetModule, newAlias, fileLocation);
                file.TryLoad();
                if (file.FileData != null)
                {
                    targetModule.AddToManifest(newAlias, fileLocation, parameters.manifestEntryType);
                    targetModule.WriteManifestToFile();
                    return(true);
                }
            }
            else
            {
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
            public bool OnAccept(string inputMessage)
            {
                // Do the cloning
                string newAliasName = inputMessage.Trim();

                if (newAliasName.Length <= 1)
                {
                    MessageBox.Show("You must enter a name longer than 1 character for the new alias!");
                    return(false);
                }

                if (mModule.GetAliasFile(newAliasName) != null)
                {
                    MessageBox.Show("An alias already exists with that name!");
                    return(false);
                }

                mModule.AddToManifest(newAliasName, "file(" + mFilePath + ")", mManifestEntryType);
                mModule.WriteManifestToFile();
                mOwner.Reload();
                return(true);
            }
Esempio n. 4
0
        public bool Clone(CloneObjectParameters parameters, HashSet <string> alreadyCloned, bool execute)
        {
            string newAlias = parameters.TransformAlias(mAlias);

            if (mModule.GetAliasFile(newAlias) != null)
            {
                // MessageBox.Show("The alias " + newAlias + " already exists in manifest.json");
                return(false);
            }

            string newPath = parameters.TransformParameter(ResolvedPath);

            if (!FileData.Clone(newPath, parameters, alreadyCloned, execute))
            {
                return(false);
            }

            alreadyCloned.Add(mModule.Name + ':' + newAlias);
            if (execute)
            {
                string     fileLocation = "file(" + newPath.Replace(mModule.Path + "/", "") + ")";
                ModuleFile file         = new ModuleFile(Module, newAlias, fileLocation);
                file.TryLoad();
                if (file.FileData != null)
                {
                    mModule.AddToManifest(newAlias, fileLocation);
                    mModule.WriteManifestToFile();
                    return(true);
                }
            }
            else
            {
                return(true);
            }

            return(false);
        }