public string Id(AssetData asset, string id) { return(ShowRawId ? id : TrimId(id, asset.IdTrimChars)); }
private void ReloadBilingualRowData(IAsset[] assets, Func <IAsset, IEnumerable <ITransPair> > get_pairs) { var props = _AdditionalProps ?? new List <AdditionalPropertiesInfo>(); var props_indexes = new Dictionary <string, int>(); for (int i = 0; i < props.Count; i++) { props_indexes[props[i].Key] = i; } foreach (var prop in assets.SelectMany(a => a.Properties)) { int index; if (!props_indexes.TryGetValue(prop.Key, out index)) { index = props_indexes[prop.Key] = props.Count; props.Add(new AdditionalPropertiesInfo(index, prop.Key, prop.Visible)); } else if (prop.Visible && !props[index].Visible) { props[index] = new AdditionalPropertiesInfo(index, prop.Key, prop.Visible); } } var rows = new List <IRowData>(); var seq = 0; var serial = 0; foreach (var asset in assets) { var mapper = new int[props.Count]; for (int i = 0; i < mapper.Length; i++) { mapper[i] = int.MaxValue; } for (int j = 0; j < asset.Properties.Count; j++) { mapper[props_indexes[asset.Properties[j].Key]] = j; } var ad = new AssetData() { LongPackageName = asset.Package, LongAssetName = asset.Original, BaseSerial = serial, SourceLang = asset.SourceLang, TargetLang = asset.TargetLang, PropMapper = mapper, }; var pairs = get_pairs(asset); ad.CalculateIdTrimmer(pairs); foreach (var pair in pairs) { rows.Add(new BilingualRowData(Renderer, ad, pair, seq++)); if (pair.Serial > 0) { serial++; } } } _AdditionalProps = props; AdditionalPropsChanged?.Invoke(this, EventArgs.Empty); _Rows.Rows = rows; _Rows.Reset(); }
public string AssetName(AssetData asset) { return(ShowLongAssetName ? asset.LongAssetName : asset.ShortAssetName); }