示例#1
0
 public FileReferenceModel(string fullDsPath, IncludeFile includeFile)
     : this()
 {
     //we should be able to figure out what it is based on it's save path
     refIncludeFile = includeFile;
     Type           = includeFile.DetermineSaveType(fullDsPath);
     RawName        = ConvertFullPathToName(fullDsPath);
     FullDSPath     = fullDsPath;
 }
示例#2
0
        public bool AddInventory(string inventory, ItemSaveType type)
        {
            if (inventory == null || inventory.Length < 1)
            {
                return(false);
            }

            //hack alert - gotta infer the item type from the directory.
            //This was added to make the 'import item' functionality work
            if (type == ItemSaveType.Unknown)
            {
                string[] path = inventory.Split('\\');
                type = Include.DetermineSaveType(path[path.Length - 2]);
                if (type == ItemSaveType.Unknown)
                {
                    return(false);
                }

                string inventoryName = path[path.Length - 1].Split('.')[0];
                if (!DomainFileReferences[THIS_DOMAIN].Inventory.ContainsKey(inventoryName))
                {
                    FileReferenceModel mod = new FileReferenceModel(inventoryName, type, Include, this.Name);
                    DomainFileReferences[THIS_DOMAIN].Inventory.Add(inventoryName, mod);
                }
            }
            else
            {
                if (!DomainFileReferences[THIS_DOMAIN].Inventory.ContainsKey(inventory))
                {
                    FileReferenceModel mod = new FileReferenceModel(inventory, type, Include, this.Name);
                    DomainFileReferences[THIS_DOMAIN].Inventory.Add(inventory, mod);
                }
            }

            return(true);
        }