public static Images.Asset[] insertAssetByIndex(Images.Asset[] old_assets, Images.Asset asset, int index = -1) { Images.Asset[] new_assets = new Images.Asset[old_assets.Length + 1]; if (index == -1) { index = new_assets.Length - 1; } int _index = 0; int _index_old = 0; foreach (Images.Asset _item in new_assets) { Images.Asset item; if (_index != index) { item = old_assets[_index_old++]; } else { item = asset; } new_assets[_index++] = item; } return(new_assets); }
public static void throwSignleAssetAtConsole(Images.Asset asset) { string log = string.Empty; log += "Used: "; log += asset.Check.ToString().PadRight(5) + ", "; log += "Key: "; log += "\"" + asset.Key.Trim() + "\", "; log += "File: "; log += "\"" + asset.Path.Trim() + "\", "; log += "Text: "; log += "\"" + asset.Text.Trim() + "\""; Console.WriteLine(log); }
public static Images.Asset[] removeAssetByIndex(Images.Asset[] old_assets, int index) { Images.Asset[] new_assets = new Images.Asset[old_assets.Length - 1]; old_assets[index].Key = null; int _index = 0; foreach (Images.Asset item in old_assets.Where(i => i.Key != null)) { new_assets[_index++] = item; } return(new_assets); }
private static Images.Asset[] _deconstruct_file(string[] _file) { Images.Asset[] Asset = new Images.Asset[_file.Length]; int index = 0; char[] separator = { ';' }; foreach (string row in _file) { string[] splitrow = row.Split(separator, 3); Images.Asset item = new Images.Asset(); item.Check = true; item.Key = splitrow[0]; item.Path = (splitrow.Length > 1) ? splitrow[1] : string.Empty; item.Text = (splitrow.Length > 2) ? splitrow[2] : string.Empty; Asset[index] = item; index++; } return(Asset); }