Esempio n. 1
0
        static private void TryToGetKeyProvider()
        {
            const string flbPath = "simulation\\attrib\\fieldnames.flb";

            if (!ToolSettings.IsInRetributionMode)
            {
                LoggingManager.SendMessage("ModManager - not in Retribuion-mode, no need to load KeyProvider");
                return;
            }
            LoggingManager.SendMessage("ModManager - Trying to load the KeyProvider (FLB-file)");
            try
            {
                FSNodeFile file = FileManager.AttribTree.RootNode.GetFileByPath(flbPath);
                if (file == null)
                {
                    UIHelper.ShowWarning("Unable to find the FLB file! You probably won't be able to open RBFs.");
                    LoggingManager.SendWarning("ModManager - Failed to load FLB-file from path " + flbPath);
                    return;
                }
                UniFile uni     = file.GetUniFile();
                var     flbFile = new FieldNameFile(uni);
                flbFile.ReadData();
                RBFKeyProvider = flbFile;
            }
            catch (Exception ex)
            {
                UIHelper.ShowError("Unable to open or read the FLB file! You probably won't be able to open RBFs.");
                LoggingManager.SendError("ModManager - Error while loading FLB-file");
                LoggingManager.HandleException(ex);
                return;
            }
            LoggingManager.SendMessage("ModManager - Successfully loaded KeyProvider from " + flbPath);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds all nodes from this FileTree to a TreeNodeCollection.
        /// </summary>
        /// <param name="owner">The owner of the TreeNodeCollection, e.g. the TreeView.</param>
        /// <param name="collection">The collection to add the File nodes to.</param>
        /// <param name="rootName">The name of the rootnode.</param>
        /// <param name="usePictures">Set to true to set the picture index for the TreeNodes.</param>
        /// <param name="noVirtual">Set to true to exclude virtual files.</param>
        /// <param name="noLocal">Set to true to exclude local files.</param>
        /// <param name="colorLocalFiles">Set to true to color local files.</param>
        /// <param name="colorLocalDirs">Set to true to color local directories.</param>
        public void TransferIntoTreeNodeCollection(Control owner, TreeNodeCollection collection, string rootName, bool usePictures = true,
                                                   bool noVirtual = false, bool noLocal = false, bool colorLocalFiles = true, bool colorLocalDirs = true)
        {
            if (m_rootNode == null)
            {
                LoggingManager.SendWarning("Tried to convert a FileTree without a RootNode to a node collection");
                return;
            }
            var root = new TreeNode(rootName)
            {
                Name = 'D' + rootName
            };

            TransferIntoTnc(owner, m_rootNode, root.Nodes, noVirtual, noLocal, usePictures, colorLocalFiles, colorLocalDirs);
            if (owner.InvokeRequired)
            {
                MethodInvoker k = () => collection.Add(root);
                owner.Invoke(k);
            }
            else
            {
                collection.Add(root);
            }
        }