//Custom Handling of this one because of it's size public override void GetTranslationStats(ref List <TranslationStatEntry> stats) { Console.WriteLine("Calculating Translation Statistic for " + AssetName); for (int k = 0; k < 4; k++) { SpreadsheetsResource.GetRequest request = GoogleSheetConnector.GetInstance().Service.Spreadsheets.Get(SheetId); request.Ranges = "A" + (k * 10000 + 2) + ":O" + ((k + 1) * 10000 + 2); request.IncludeGridData = true; Spreadsheet sheet = request.Execute(); IList <GridData> grid = sheet.Sheets[0].Data; //Getting each range (should only be one) AssetEntry tmpEntry = new AssetEntry(VariableDefinitions); foreach (GridData gridData in grid) { //For each row foreach (var row in gridData.RowData) { SheetCellWithColor[] rowRaw = new SheetCellWithColor[row.Values.Count]; for (int i = 0; i < row.Values.Count; i++) { rowRaw[i] = new SheetCellWithColor(row.Values[i]); } tmpEntry.CalculateTranslationStats(rowRaw, ref stats); } } } }
internal static W3xHierarchy Parse(BinaryReader reader, AssetEntry header) { return(new W3xHierarchy { Pivots = reader.ReadArrayAtOffset(() => W3xPivot.Parse(reader, header)) }); }
public static W3xPivot Parse(BinaryReader reader, AssetEntry header) { string name = null; uint? nameID = null; switch (header.TypeHash) { case 1002596986u: // Cnc3 name = reader.ReadUInt32PrefixedAsciiStringAtOffset(); break; case 3985956449u: // Ra3 nameID = reader.ReadUInt32(); break; default: throw new InvalidDataException(); } var result = new W3xPivot { Name = name, NameID = nameID, ParentIdx = reader.ReadInt32(), Translation = reader.ReadVector3(), Rotation = reader.ReadQuaternion() }; // Don't need fixup matrix reader.BaseStream.Seek(64, SeekOrigin.Current); return(result); }
public override void Read(AssetStream stream) { long position = stream.BaseStream.Position; base.Read(stream); Script.Read(stream); Name = stream.ReadStringAligned(); MonoScript script = Script.FindObject(File); if (script != null) { Structure = script.CreateStructure(); if (Structure != null) { Structure.Read(stream); return; } } AssetEntry info = File.GetAssetEntry(PathID); stream.BaseStream.Position = position + info.DataSize; }
public override void Read(AssetReader reader) { long position = reader.BaseStream.Position; base.Read(reader); Script.Read(reader); Name = reader.ReadString(); MonoScript script = Script.FindAsset(File); if (script != null) { Structure = script.CreateStructure(); if (Structure != null) { Structure.Read(reader); return; } } AssetEntry info = File.GetAssetEntry(PathID); reader.BaseStream.Position = position + info.DataSize; }
public virtual AssetEntry ToModel(AssetEntry asset, IBlobUrlResolver blobUrlResolver) { if (asset == null) { throw new ArgumentNullException(nameof(asset)); } asset.CreatedBy = CreatedBy; asset.CreatedDate = CreatedDate; asset.ModifiedBy = ModifiedBy; asset.ModifiedDate = ModifiedDate; asset.LanguageCode = LanguageCode; asset.Group = Group; asset.Id = Id; if (asset.BlobInfo == null) { asset.BlobInfo = AbstractTypeFactory <BlobInfo> .TryCreateInstance(); } asset.BlobInfo.Name = Name; asset.BlobInfo.ContentType = MimeType; asset.BlobInfo.RelativeUrl = RelativeUrl; asset.BlobInfo.Url = blobUrlResolver.GetAbsoluteUrl(RelativeUrl); asset.BlobInfo.Size = Size; if (asset.Tenant == null) { asset.Tenant = AbstractTypeFactory <TenantIdentity> .TryCreateInstance(); } asset.Tenant.Id = TenantId; asset.Tenant.Type = TenantType; return(asset); }
public override void Read(AssetReader reader) { long position = reader.BaseStream.Position; base.Read(reader); #if UNIVERSAL MonoBehaviourLayout layout = reader.Layout.MonoBehaviour; if (layout.HasEditorHideFlags) { EditorHideFlags = (HideFlags)reader.ReadUInt32(); } if (layout.HasGeneratorAsset) { GeneratorAsset.Read(reader); } #endif Script.Read(reader); Name = reader.ReadString(); #if UNIVERSAL if (layout.HasEditorClassIdentifier) { EditorClassIdentifier = reader.ReadString(); } #endif if (!ReadStructure(reader)) { AssetEntry info = File.GetAssetEntry(PathID); reader.BaseStream.Position = position + info.Size; } }
public override void Read(AssetReader reader) { long position = reader.BaseStream.Position; base.Read(reader); #if UNIVERSAL if (IsReadEditorHideFlags(reader.Version, reader.Flags)) { EditorHideFlags = (HideFlags)reader.ReadUInt32(); } #endif Script.Read(reader); Name = reader.ReadString(); #if UNIVERSAL if (IsReadEditorClassIdentifier(reader.Version, reader.Flags)) { EditorClassIdentifier = reader.ReadString(); } #endif MonoScript script = Script.FindAsset(File); if (script != null) { Structure = script.CreateStructure(); if (Structure != null) { Structure.Read(reader); return; } } AssetEntry info = File.GetAssetEntry(PathID); reader.BaseStream.Position = position + info.DataSize; }
internal static W3xMeshVertexData Parse(BinaryReader reader, AssetEntry header) { var vertexCount = reader.ReadUInt32(); var vertexSize = reader.ReadUInt32(); var result = new W3xMeshVertexData { VertexCount = vertexCount, VertexSize = vertexSize, VertexData = reader.ReadAtOffset(() => reader.ReadBytes((int)(vertexCount * vertexSize))) }; switch (header.TypeHash) { case 3386369912u: // Cnc3 case 1750982594u: // Cnc3KanesWrath - not sure what changed result.VertexDescription = D3d9VertexDescription.Parse(reader); break; case 3448375452u: // Ra3 and above result.VertexDescription = RnaVertexDescription.Parse(reader); break; default: throw new ArgumentOutOfRangeException(); } result.BoneNumbers = reader.ReadArrayAtOffset(() => reader.ReadUInt16()); return(result); }
private void OnAssetEntryKeyUp(KeyCode key, AssetEntry context) { var obj = context.asset; int entryIndex = m_filteredAssets.IndexOf(context); int delta = 0; if (key == KeyCode.UpArrow) { delta = -1; } else if (key == KeyCode.DownArrow) { delta = 1; } else if (key == KeyCode.PageUp) { delta = -Mathf.FloorToInt(ui.gridHeight / Skin.LineHeight); } else if (key == KeyCode.PageDown) { delta = +Mathf.FloorToInt(ui.gridHeight / Skin.LineHeight); } else if (key == KeyCode.Home) { delta = -m_filteredAssets.Count; } else if (key == KeyCode.End) { delta = +m_filteredAssets.Count; } var newIndex = Mathf.Clamp(entryIndex + delta, 0, m_filteredAssets.Count - 1); if (newIndex == entryIndex) { return; } var scrollMode = delta > 0 ? ScrollMode.SelectionLast : ScrollMode.SelectionFirst; if (Event.current.shift || EditorGUI.actionKey) { if (ui.prevSelectedIndex != -1) { SelectRange(Mathf.Min(ui.prevSelectedIndex, newIndex), Mathf.Max(ui.prevSelectedIndex, newIndex), scrollTo: newIndex, scrollMode: scrollMode, needsRefresh: false); } } else { // we'll refresh onKeyUp SelectRange(newIndex, newIndex, scrollTo: newIndex, scrollMode: scrollMode, needsRefresh: false); ui.prevSelectedIndex = newIndex; } Event.current.Use(); GUIUtility.keyboardControl = m_filteredAssets[newIndex].controlId; Repaint(); }
public ActionResult DeleteConfirmed(int id) { AssetEntry assetEntry = _db.AssetEntries.Find(id); _db.AssetEntries.Remove(assetEntry); _db.SaveChanges(); return(RedirectToAction("Index")); }
public void UpdateAssetEntry(AssetEntry entry) { if (!AssetEntryMap.ContainsKey(entry.Key)) { throw new ContentManifestException("Can't update asset entry since key is not found: " + entry.Key); } AssetEntryMap[entry.Key] = entry; }
void SyncAssetEntry(AssetEntry entry) { var asset = entry.asset; var name = asset.name; var path = AssetDatabase.GetAssetPath(asset) + "." + name; entry.path = path; entry.rpath = ReverseString(path); entry.name = name; }
private void ReadAsset(AssetReader reader, ref AssetEntry info) { AssetInfo assetInfo = new AssetInfo(this, info.PathID, info.ClassID); Object asset = ReadAsset(reader, assetInfo, Header.DataOffset + info.Offset, info.Size); if (asset != null) { AddAsset(info.PathID, asset); } }
private void validateNewAssetEntry(ref AssetEntry entry) { if (AssetEntryMap.ContainsKey(entry.Key)) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"Two assets have the same key and this is not allowed: key = '{entry.Key}'. "); stringBuilder.AppendLine("The asset will not be added to the manifest."); throw new ContentManifestException(stringBuilder.ToString()); } }
/// <summary> /// Function that collects a list of file dependencies from the specified list of objects. /// </summary> static List <AssetEntry> GetDependencyList(Object[] objects, bool reverse) { Object[] deps = reverse ? EditorUtility.CollectDeepHierarchy(objects) : EditorUtility.CollectDependencies(objects); List <AssetEntry> list = new List <AssetEntry>(); { var __array2 = deps; var __arrayLength2 = __array2.Length; for (int __i2 = 0; __i2 < __arrayLength2; ++__i2) { var obj = (Object)__array2[__i2]; { string path = AssetDatabase.GetAssetPath(obj); if (!string.IsNullOrEmpty(path)) { bool found = false; System.Type type = obj.GetType(); { var __list5 = list; var __listCount5 = __list5.Count; for (int __i5 = 0; __i5 < __listCount5; ++__i5) { var ent = (AssetEntry)__list5[__i5]; { if (ent.path.Equals(path)) { if (!ent.types.Contains(type)) { ent.types.Add(type); } found = true; break; } } } } if (!found) { AssetEntry ent = new AssetEntry(); ent.path = path; ent.types.Add(type); list.Add(ent); } } } } } deps = null; objects = null; return(list); }
public new void AppendToFile(StreamWriter sw, AssetEntry thisEntry) { for (int i = 1; i < VariableDefinitions.Count; i++) { if (i > 1) { sw.Write('\t'); } Variables[i].AppendToFile(sw); } sw.Write('\r'); }
public void Write(SerializedWriter writer) { writer.Write(FileID); if (AssetEntry.IsLongID(writer.Generation)) { writer.AlignStream(); writer.Write(PathID); } else { writer.Write((int)PathID); } }
public void Read(SerializedReader reader) { FileID = reader.ReadInt32(); if (AssetEntry.IsLongID(reader.Generation)) { reader.AlignStream(); PathID = reader.ReadInt64(); } else { PathID = reader.ReadInt32(); } }
public static void CombineFormats(FileGeneration generation, SerializedFileMetadata origin) { RTTIClassHierarchyDescriptorConverter.CombineFormats(generation, ref origin.Hierarchy); if (AssetEntry.HasTypeIndex(generation)) { for (int i = 0; i < origin.Entries.Length; i++) { ref AssetEntry entry = ref origin.Entries[i]; ref RTTIBaseClassDescriptor type = ref origin.Hierarchy.Types[entry.TypeIndex]; entry.TypeID = type.ClassID == ClassIDType.MonoBehaviour ? (-type.ScriptID - 1) : (int)type.ClassID; entry.ClassID = type.ClassID; entry.ScriptID = type.ScriptID; }
private void addEntryToolStripMenuItem_Click(object sender, EventArgs e) { BIGBank bank = (BIGBank)treeView.SelectedNode.Tag; AssetEntry entry = CreateEntry(bank); if (entry != null) { bank.AddEntry(entry); treeView.SelectedNode = AddToTree( treeView.SelectedNode, entry.DevSymbolName, entry); } }
// GET: AssetEntries/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AssetEntry assetEntry = _db.AssetEntries.Find(id); if (assetEntry == null) { return(HttpNotFound()); } return(View(assetEntry)); }
public static void AddEntry(GameObject go, string asset, string[] tokens) { AssetBridge bridge = go.GetComponent <AssetBridge>(); if (bridge == null) { bridge = go.AddComponent <AssetBridge>(); } AssetEntry entry = new AssetEntry(); entry.asset = asset; entry.tokens = tokens; AssetBridge.AddEntry(bridge, entry); }
private T InternalLoad <T>(string assetName, string path, bool weakReference) { T result = default(T); bool useContentReader = true; try { //Special types if (typeof(T) == typeof(string)) { //TODO: No need CCContent, use TileContainer var content = ReadAsset <CCContent>(path, null); result = (T)(object)content.Content; useContentReader = false; } else { // Load the asset. result = ReadAsset <T>(path, null); } } catch (ContentLoadException) { if (typeof(T) == typeof(PlistDocument)) { //TODO: No need CCContent, use TileContainer var content = ReadAsset <CCContent>(path, null); result = (T)(object)new PlistDocument(content.Content); useContentReader = false; } else { throw new ContentLoadException("Failed to load the asset file from " + assetName); } } var assetEntry = new AssetEntry(result, path, weakReference, useContentReader); _loadedAssets[assetName] = assetEntry; if (result is GraphicsResource) { (result as GraphicsResource).Disposing += AssetDisposing; } return(result); }
void SelectionSingle(AssetEntry asset) { RecordCurrentSelection(asset.asset); bool same_obj = currentSelectionEntry == asset; currentSelectionEntry = startSelectionEntry = asset; selections.Clear(); selections.Add(asset.asset); SelectionChanged(); if (same_obj) { EditorGUIUtility.PingObject(asset.asset); } }
AssetEntry CreateAssetEntry(UnityEngine.Object asset) { var name = asset.name; var path = AssetDatabase.GetAssetPath(asset) + "." + name; var entry = new AssetEntry() { path = path, rpath = ReverseString(path), name = name, asset = asset }; return(entry); }
private void RefreshDisplay() { lvEntries.Items.Clear(); UInt32[] entries = m_TextGroup.Entries; for (int i = 0; i < entries.Length; i++) { AssetEntry content = m_Entry.Bank.FindEntryByID(entries[i]); string[] items = new string[2]; items[0] = entries[i].ToString(); if (content != null) { items[1] = (new BIGText(content)).Content; } lvEntries.Items.Add(new ListViewItem(items)); } }
void ReadAssetPath(XmlNode node) { AssetEntry entry = new AssetEntry(); entry.archiveType = node.Attributes["type"].Value; entry.archiveSource = node.Attributes["src"].Value; if (node.Attributes["resource"] != null) { entry.resourceType = node.Attributes["resource"].Value; } else { entry.resourceType = "Common"; } assetEntries.Add(entry); }
private void AssetFill(ComboBox box, AssetTemplate item) { BIGBank bank; if (item.Type == ContentType.Text) { bank = ContentManager.Instance.TextBank; for (int i = 0; i < bank.EntryCount; ++i) { AssetEntry entry = bank.get_Entries(i); if (entry.Type == 0) { box.Items.Add(new AssetComboBoxItem(entry)); } } } else if (item.Type == ContentType.Graphics) { bank = ContentManager.Instance.GraphicsBank; for (int i = 0; i < bank.EntryCount; ++i) { AssetEntry entry = bank.get_Entries(i); uint type = entry.Type; if (type == 0x1 || type == 0x2 || type == 0x4 || type == 0x5) { box.Items.Add(new AssetComboBoxItem(entry)); } } } else if (item.Type == ContentType.MainTextures) { bank = ContentManager.Instance.MainTextureBank; for (int i = 0; i < bank.EntryCount; ++i) { box.Items.Add(new AssetComboBoxItem(bank.get_Entries(i))); } } }
public override void Read(AssetReader reader) { long position = reader.BaseStream.Position; base.Read(reader); #if UNIVERSAL MonoBehaviourLayout layout = reader.Layout.MonoBehaviour; if (layout.HasEditorHideFlags) { EditorHideFlags = (HideFlags)reader.ReadUInt32(); } if (layout.HasGeneratorAsset) { GeneratorAsset.Read(reader); } #endif Script.Read(reader); Name = reader.ReadString(); #if UNIVERSAL if (layout.HasEditorClassIdentifier) { EditorClassIdentifier = reader.ReadString(); } #endif MonoScript script = Script.FindAsset(File); if (script != null) { SerializableType behaviourType = script.GetBehaviourType(); if (behaviourType == null) { Logger.Log(LogType.Warning, LogCategory.Import, $"Unable to read {ValidName}, because definition for script {script.ValidName} wasn't found"); } else { Structure = behaviourType.CreateSerializableStructure(); Structure.Read(reader); return; } } AssetEntry info = File.GetAssetEntry(PathID); reader.BaseStream.Position = position + info.Size; }
/// <summary> /// Function that collects a list of file dependencies from the specified list of objects. /// </summary> static List<AssetEntry> GetDependencyList (Object[] objects, bool reverse) { Object[] deps = reverse ? EditorUtility.CollectDeepHierarchy(objects) : EditorUtility.CollectDependencies(objects); List<AssetEntry> list = new List<AssetEntry>(); foreach (Object obj in deps) { string path = AssetDatabase.GetAssetPath(obj); if (!string.IsNullOrEmpty(path)) { bool found = false; System.Type type = obj.GetType(); foreach (AssetEntry ent in list) { if (ent.path.Equals(path)) { if (!ent.types.Contains(type)) ent.types.Add(type); found = true; break; } } if (!found) { AssetEntry ent = new AssetEntry(); ent.path = path; ent.types.Add(type); list.Add(ent); } } } deps = null; objects = null; return list; }
void ReadAssetPath(XmlNode node) { AssetEntry entry = new AssetEntry(); entry.archiveType = node.Attributes["type"].Value; entry.archiveSource = node.Attributes["src"].Value; if (node.Attributes["resource"] != null) entry.resourceType = node.Attributes["resource"].Value; else entry.resourceType = "Common"; assetEntries.Add(entry); }