public ManifestItem(string path, AssetTypeEnum @enum, List <string> depend = null) { this.Path = path; //this.AB = ab; this.Type = (int)@enum; this.Depend = depend; }
public static AssetType Create(AssetTypeEnum v) { return(new AssetType { InnerValue = v }); }
private string MakeDestinationFile(AssetTypeEnum assetType, string s, AssetFileEnum fileType, int fileNumber) { bool unrootedOther = (assetType == AssetTypeEnum.Other || fileType == AssetFileEnum.Other) && !Path.IsPathRooted(s); string directory = unrootedOther ? Path.GetDirectoryName(s) : AssetFile.DirectoryForFileEnum(assetType, fileNumber == 0, fileType); string targetFile = directory + "\\" + Path.GetFileName(s); return(targetFile); }
public ManifestItem(string name, string hash, string package, AssetTypeEnum @enum, List <string> Depend = null) { this.Name = name; this.Hash = hash; this.Package = package; this.Type = (int)@enum; if (Depend == null) { Depend = new List <string>(); } this.Depend = Depend; }
private void setupCategoryComboBox(AssetTypeEnum assetTypeEnum) { categoryComboBox.Items.Clear(); string [] categories = RepositoryClass.GetCategoriesForType(assetTypeEnum); if (categories != null) { foreach (string category in categories) { categoryComboBox.Items.Add(category); } } categoryPanel.Visible = categories != null; }
public Asset(string code, KeyPair issuer) { Code = CheckNotNull(code, "资产代码不能为空"); Issuer = CheckNotNull(issuer, "发行方不能为空"); if (code.Length >= 1 && code.Length <= 4) { Type = AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4; } else if (code.Length >= 5 && code.Length <= 12) { Type = AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12; } else { throw new ArgumentException("无效地资产代码, 请确保代码长度正确,且长度不能大于12位"); } }
public Asset(string code, KeyPair issuer) { Code = CheckNotNull(code, "code cannot be null."); Issuer = CheckNotNull(issuer, "issuer cannot be null."); if (code.Length >= 1 && code.Length <= 4) { Type = AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4; } else if (code.Length >= 5 && code.Length <= 12) { Type = AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12; } else { throw new ArgumentException("Invalid code, should have positive length, no larger than 12."); } }
public Importer() { inhibit = true; InitializeComponent(); for (AssetTypeEnum i = AssetTypeEnum.Mesh; i <= AssetTypeEnum.Other; i++) { assetTypeComboBox.Items.Add(AssetTypeDesc.AssetTypeEnumName(i)); } List <string> log = RepositoryClass.Instance.InitializeRepository(); CheckLogAndMaybeExit(log); updateRepositoryPath(); somethingChanged = false; cameFromFile = false; setEnables(); categoryPanel.Visible = false; genOffset = filesListBox.Left + filesListBox.Width; inhibit = false; }
private void createControlsForAssetType(AssetTypeEnum typeEnum) { SuspendLayout(); RemoveDynamicControls(); allControls = new List <FileDescControls>(); AssetTypeDesc type = AssetTypeDesc.FindAssetTypeDesc(typeEnum); int index = 0; int y = 180; foreach (AssetTypeFileDesc desc in type.FileTypes) { FileDescControls c; y = createAssetTypeFileControls(index, y, desc, out c); allControls.Add(c); index++; } ResumeLayout(false); PerformLayout(); }
public ExtensionMapping(AssetTypeEnum assetType, string fileExtension, string assetDirectory, AssetFileEnum fileTypeEnum) { this.primaryMatchEnum = ExtensionPrimaryEnum.DontCare; this.typeEnum = assetType; this.fileExtension = fileExtension; this.assetDirectory = assetDirectory; this.fileTypeEnum = fileTypeEnum; }
public AssetDefinition(string name, AssetTypeEnum typeEnum, AssetFile file) { this.name = name; description = ""; category = ""; this.typeEnum = typeEnum; status = AssetStatusEnum.Complete; breakage = ""; List<AssetFile> files = new List<AssetFile>(); files.Add(file); this.files = files; properties = new List<AssetProperty>(); }
public static AssetTypeDesc FindAssetTypeDesc(AssetTypeEnum typeEnum) { foreach(AssetTypeDesc t in assetTypes) { if (t.typeEnum == typeEnum) return t; } return null; }
public AssetDefinition() { name = ""; description = ""; category = ""; typeEnum = AssetTypeEnum.None; status = AssetStatusEnum.Incomplete; breakage = ""; files = new List<AssetFile>(); properties = new List<AssetProperty>(); }
public static string AssetTypeEnumName(AssetTypeEnum e) { return assetTypeEnumNames[(int)e]; }
protected void AddParsedReferences(AssetDefinition def, string referee, List<string> references, Dictionary<string, List<string>> introducers, string introducer, AssetTypeEnum assetType, AssetFileEnum fileType) { List<string> usedNames; if (introducers.TryGetValue(introducer, out usedNames)) { string dir = AssetFile.DirectoryForFileEnum(assetType, false, fileType); foreach (string referredTo in usedNames) { string referredToFile = MakeFullFilePath(dir, referredTo); if (references.IndexOf(referredToFile) >= 0) continue; if (!new FileInfo(MakeRepositoryFilePath(referredToFile)).Exists) { Warn("Skipping file '{0}', referenced by '{1}', because the file does not exist", referredToFile, referee); continue; } references.Add(referredToFile); AssetFile assetFile = new AssetFile(referredToFile, fileType); def.Files.Add(assetFile); } } }
public static string DirectoryForFileEnum(AssetTypeEnum type, bool primaryFile, AssetFileEnum fileTypeEnum) { foreach (ExtensionMapping mapping in extensionMappings) { if ((fileTypeEnum == mapping.FileTypeEnum) && (type == mapping.AssetType || mapping.AssetType == AssetTypeEnum.None) && (mapping.PrimaryMatch == ExtensionPrimaryEnum.DontCare || (mapping.PrimaryMatch == ExtensionPrimaryEnum.MatchPrimary) == primaryFile)) return mapping.AssetDirectory; } return "Misc"; }
protected bool ReadXmlFileInternal(XmlReader r, List<string> log) { //Debug.Assert(root.LocalName == "AssetDefinition"); while(r.Read()) { if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.EndElement) { break; } switch (r.Name) { case "Name": name = r.ReadElementString(); break; case "Description": description = r.ReadElementString(); break; case "Category": category = r.ReadElementString(); break; case "Type": typeEnum = AssetTypeDesc.AssetTypeEnumFromName(r.ReadElementString()); break; case "Status": status = AssetTypeDesc.AssetStatusEnumFromName(r.ReadElementString()); break; case "Breakage": breakage = r.ReadElementString(); break; case "Files": while (r.Read()) { if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.EndElement) { break; } switch (r.Name) { case "AssetFile": files.Add(AssetFile.FromXml(r, log)); break; } } break; case "Properties": while (r.Read()) { if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.EndElement) { break; } switch (r.Name) { case "Property": properties.Add(AssetProperty.FromXml(r)); break; } } break; default: log.Add(string.Format("In AssetDefinition.ReadXmlFileInternal, unknown attribute '{0}'", r.Name)); break; } } return true; }
private void setupCategoryComboBox(AssetTypeEnum assetTypeEnum) { categoryComboBox.Items.Clear(); string []categories = RepositoryClass.GetCategoriesForType(assetTypeEnum); if (categories != null) { foreach (string category in categories) categoryComboBox.Items.Add(category); } categoryPanel.Visible = categories != null; }
private void setAssetType(AssetTypeEnum assetTypeEnum) { createControlsForAssetType(assetTypeEnum); setupCategoryComboBox(assetTypeEnum); }
private string MakeDestinationFile(AssetTypeEnum assetType, string s, AssetFileEnum fileType, int fileNumber) { bool unrootedOther = (assetType == AssetTypeEnum.Other || fileType == AssetFileEnum.Other) && !Path.IsPathRooted(s); string directory = unrootedOther ? Path.GetDirectoryName(s) : AssetFile.DirectoryForFileEnum(assetType, fileNumber == 0, fileType); string targetFile = directory + "\\" + Path.GetFileName(s); return targetFile; }
private void createControlsForAssetType(AssetTypeEnum typeEnum) { SuspendLayout(); RemoveDynamicControls(); allControls = new List<FileDescControls>(); AssetTypeDesc type = AssetTypeDesc.FindAssetTypeDesc(typeEnum); int index = 0; int y = 180; foreach (AssetTypeFileDesc desc in type.FileTypes) { FileDescControls c; y = createAssetTypeFileControls(index, y, desc, out c); allControls.Add(c); index++; } ResumeLayout(false); PerformLayout(); }
public ExtensionMapping(AssetTypeEnum assetType, bool primaryMatch, string fileExtension, string assetDirectory, AssetFileEnum fileTypeEnum) { this.primaryMatchEnum = (primaryMatch ? ExtensionPrimaryEnum.MatchPrimary : ExtensionPrimaryEnum.DontMatchPrimary); this.typeEnum = assetType; this.fileExtension = fileExtension; this.assetDirectory = assetDirectory; this.fileTypeEnum = fileTypeEnum; }
public static string[] GetCategoriesForType(AssetTypeEnum type) { if (type == AssetTypeEnum.Mesh) return new string[] { "Buildings", "Props", "Wall", "Characters", "Creatures" }; else if (type == AssetTypeEnum.Material) return new string[] { "", "Skybox" }; return null; }
public static AssetType Create(AssetTypeEnum v) { return new AssetType { InnerValue = v }; }
protected void BuildSingleFileAssets(string dir, AssetTypeEnum assetType, AssetFileEnum fileType) { List<string> extensions = AssetFile.AllExtensionsForEnum(fileType); DirectoryInfo info = new DirectoryInfo(MakeRepositoryFilePath(dir)); FileInfo[] files = info.GetFiles(); foreach (FileInfo fileInfo in files) { string extension = fileInfo.Extension.ToLower(); if (extensions.IndexOf(extension) < 0) continue; string baseName = Path.GetFileNameWithoutExtension(fileInfo.Name) + "_" + AssetTypeDesc.AssetTypeEnumFileName(assetType); string defPath = MakeRepositoryFilePath("AssetDefinitions\\" + baseName + ".asset"); if (new FileInfo(defPath).Exists) { Warn("Skipping generated of asset definition '{0}', because it already exists", defPath); continue; } AssetFile file = new AssetFile(MakeFullFilePath(dir, fileInfo.Name), fileType); AssetDefinition def = new AssetDefinition(baseName, assetType, file); def.SetDescriptionFromName(); def.WriteXmlFile(defPath); } }
public static string DirectoryForFile(AssetTypeEnum type, bool primaryFile, string fileName) { string extension = Path.GetExtension(fileName); AssetFileEnum fileTypeEnum = EnumForExtension(extension); return DirectoryForFileEnum(type, primaryFile, fileTypeEnum); }
public Asset() { Type = AssetTypeEnum.ASSET_TYPE_NATIVE; }
public AssetTypeDesc(AssetTypeEnum typeEnum, AssetTypeFileDesc[] fileTypes) { this.typeEnum = typeEnum; this.fileTypes = fileTypes; }
protected bool ReadXmlFileInternal(string path, List<string> log) { try { XmlDocument doc = new XmlDocument(); doc.Load(path); XmlElement root = doc.DocumentElement; //Debug.Assert(root.LocalName == "AssetDefinition"); XmlElement child = (XmlElement)root.FirstChild; while (child != null) { switch (child.LocalName) { case "Name": name = child.InnerText; break; case "Description": description = child.InnerText; break; case "Category": category = child.InnerText; break; case "Type": typeEnum = AssetTypeDesc.AssetTypeEnumFromName(child.InnerText); break; case "Status": status = AssetTypeDesc.AssetStatusEnumFromName(child.InnerText); break; case "Breakage": breakage = child.InnerText; break; case "Files": XmlElement fileElement = (XmlElement)child.FirstChild; while (fileElement != null) { files.Add(AssetFile.FromXml(fileElement, log)); fileElement = (XmlElement)fileElement.NextSibling; } break; case "Properties": XmlElement propertyElement = (XmlElement)child.FirstChild; while (propertyElement != null) { properties.Add(AssetProperty.FromXml(propertyElement)); propertyElement = (XmlElement)propertyElement.NextSibling; } break; default: log.Add(string.Format("In AssetDefinition.ReadXmlFileInternal, unknown attribute '{0}'", child.LocalName)); break; } child = (XmlElement)child.NextSibling; } return true; } catch (Exception e) { log.Add(string.Format("Error reading asset definition file '{0}': {1}", path, e.Message)); return false; } }