Пример #1
0
        /// <summary>
        /// Gets the asset from a filesystem folder path.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static ArkAsset GetAssetFromFolderPath(string path, ArkInstall install)
        {
            //Get the fileinfo
            FileInfo info = new FileInfo(path);

            //Get the parent namespace
            ArkNamespace parent = ArkNamespace.GetNamespaceFromFolderPath(info.Directory.FullName, install);

            //Create object
            ArkAsset a = new ArkAsset
            {
                info         = info,
                filename     = path,
                parent       = parent,
                installation = install
            };

            //Get the name without the extension
            if (info.Name.Contains("."))
            {
                a.name      = info.Name.Substring(0, info.Name.LastIndexOf('.'));
                a.extension = info.Name.Substring(a.name.Length + 1);
            }
            else
            {
                a.name      = info.Name;
                a.extension = "";
            }

            //Set name
            a.fullName = parent.fullName + a.name;

            return(a);
        }
Пример #2
0
        /// <summary>
        /// Returns children namespaces
        /// </summary>
        /// <returns></returns>
        public List <ArkNamespace> GetChildren()
        {
            List <ArkNamespace> children = new List <ArkNamespace>();

            string[] paths = Directory.GetDirectories(contentFolder);
            foreach (var p in paths)
            {
                children.Add(ArkNamespace.GetNamespaceFromFolderPath(p, this));
            }
            return(children);
        }