public static string GetDefaultPrefix(AssetTypes type) { if (knownPackages == null) { PopulateKnownPackages(defaultPrefices, defaultURIs); } switch (type) { default: case AssetTypes.Img: return(defaultPrefices[0]); case AssetTypes.Snd: return(defaultPrefices[1]); case AssetTypes.Fnt: return(defaultPrefices[2]); case AssetTypes.Swf: return(defaultPrefices[3]); case AssetTypes.Fxg: return(defaultPrefices[4]); case AssetTypes.Svg: return(defaultPrefices[5]); case AssetTypes.Txt: return(defaultPrefices[6]); case AssetTypes.Bin: return(defaultPrefices[7]); } }
/// <summary> /// Initializes a new instance of the <see cref="ConfigurationDictionary"/> class. /// </summary> /// <param name="assetType">Type of the asset.</param> /// <param name="itemPart">The item part.</param> public ConfigurationDictionary(AssetTypes assetType, ItemParts itemPart) { this.dictionary = new Dictionary <string, string>(); this.Changed = true; this.AssetType = assetType; this.ItemPart = itemPart; switch (itemPart) { case ItemParts.Identity: this.assigner = "="; this.separator = ", "; this.preSeparator = null; this.postSeparator = Environment.NewLine; break; case ItemParts.Values: this.assigner = "="; this.separator = Environment.NewLine + "\t"; this.preSeparator = "\t"; this.postSeparator = Environment.NewLine; break; default: this.assigner = "="; this.separator = ", "; this.preSeparator = null; this.postSeparator = null; break; } }
public void AddFiles(string[] files, AssetTypes ofType) { FileInfo fi; string generatedName; foreach (string n in files) { try { fi = new FileInfo(n); Console.WriteLine("fi " + fi); generatedName = TemplateGenerator.AddFile(new FileInfo(n), AssetTypes.Img, this.project.GetAssetPath(ofType)); TemplateGenerator.AddEntry(generatedName, TemplateGenerator.GetDefaultPrefix(ofType), TemplateGenerator.GetDefaultURI(ofType), new FileInfo(this.project.Directory + Path.DirectorySeparatorChar + this.project.CompileTargets[0]), 0); } catch (Exception e) { Console.WriteLine(e.StackTrace); } } }
/// <summary> /// Initializes a new instance of the <see cref="Item"/> class. /// </summary> /// <param name="assetType">Type of the asset.</param> public Item(AssetTypes assetType) { this.AssetType = assetType; this.Identity = new ConfigurationDictionary(assetType, ItemParts.Identity); this.Values = new ConfigurationDictionary(assetType, ItemParts.Values); }
public void AddFiles(string[] files, AssetTypes ofType) { /*FileInfo fi; * string generatedName; * foreach (string n in files) * { * try * { * fi = new FileInfo(n); * Console.WriteLine("fi " + fi); * generatedName = TemplateGenerator.AddFile(new FileInfo(n), * AssetTypes.Img, this.project.GetAssetPath(ofType)); * TemplateGenerator.AddEntry(generatedName, * TemplateGenerator.GetDefaultPrefix(ofType), * TemplateGenerator.GetDefaultURI(ofType), * new FileInfo(this.project.Directory + * Path.DirectorySeparatorChar + * this.project.CompileTargets[0]), 0); * } * catch (Exception e) * { * Console.WriteLine(e.StackTrace); * } * }*/ }
public void RemoveAssetType(string value) { List <UpdatableAsset> assets = mAssets[value]; foreach (UpdatableAsset asset in assets) { if (asset.CurrentStatus != UpdatableAsset.Status.NEW) { mAdmin.DeleteAsset(asset, (Asset resultAsset, NPNFError error) => { string assetName = (resultAsset != null ? resultAsset.Name : "<Name Unknown>"); if (error != null) { Debug.Log("Deleting asset failed: " + assetName); } else { Debug.Log("Deleting asset succeeded: " + assetName); } }); } } mAssets.Remove(value); AssetTypes.Remove(value); if (CurrentAssetType == value) { CurrentAssetType = null; } }
public AssetTypeModel GetAssetTypeModel(int?Id = null, int assetCategoryID = -1) { if (Id.HasValue) { AssetTypes assetType = _assetAssetTypeRepository.GetAssetTypeByID(Id.Value); if (assetType != null) { return(new AssetTypeModel { ID = assetType.ID, Description = assetType.Description, AssetCategoryID = assetType.AssetCategoryID, AssetCategoryName = assetType.AssetCategory.Description, AssetCategories = _assetCategoryService.GetDropdownAssetCategories(assetType.AssetCategoryID) }); } else { throw new EntryPointNotFoundException(); } } else { return(new AssetTypeModel { AssetCategories = _assetCategoryService.GetDropdownAssetCategories(assetCategoryID) }); } }
/// <summary> /// Fill method for populating an entire collection of AssetTypes /// </summary> public virtual void Fill(AssetTypes assetTypes) { // create the connection to use SqlConnection cnn = new SqlConnection(AssetType.GetConnectionString()); try { using (cnn) { // open the connection cnn.Open(); // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectAssetTypes"); // Send the collection and data to the object factory CreateObjectsFromData(assetTypes, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
public Dependency(AssetTypes type, string id, string name, int assetHandle) { Type = type; Id = id; Name = name; AssetHandle = assetHandle; }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(AssetTypes assettypes, System.Data.DataSet data) { // Do nothing if we have nothing if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0) { return; } // Create a local variable for the new instance. AssetType newobj = null; // Create a local variable for the data row instance. System.Data.DataRow dr = null; // Iterate through the table rows for (int i = 0; i < data.Tables[0].Rows.Count; i++) { // Get a reference to the data row dr = data.Tables[0].Rows[i]; // Create a new object instance newobj = System.Activator.CreateInstance(assettypes.ContainsType[0]) as AssetType; // Let the instance set its own members newobj.SetMembers(ref dr); // Add the new object to the collection instance assettypes.Add(newobj); } }
private void ExecuteAddNew(object parameter) { AssetTypes.Add(new AssetTypeModel { ID = 0, Name = string.Empty, AssetGroupID = this.AssetGroupID }); ScrollToSelectedItem = AssetTypes.Count - 1; }
public object Get(AssetTypes request) { ApiUser hdUser = request.ApiUser; CheckAssets(hdUser); return(Models.AssetTypes.GetAssetTypes(hdUser.OrganizationId, hdUser.DepartmentId, request.category_id)); }
private void ExecuteDelete(object parameter) { Collection <AssetTypeModel> deleteditems = new Collection <AssetTypeModel>(); IMessageBoxService msg = new MessageBoxService(); string title = "Deleting Asset Type"; string confirmtxt = "Do you want to delete the selected item"; if (AssetTypes.Count(x => x.Selected) > 1) { title = title + "s"; confirmtxt = confirmtxt + "s"; } if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK)) { foreach (AssetTypeModel si in AssetTypes) { if (si.Selected) { if (si.ID > 0) { DeleteItem(si.ID, "AssetTypes"); } deleteditems.Add(si); } } foreach (AssetTypeModel pm in deleteditems) { AssetTypes.Remove(pm); } deleteditems.Clear(); } msg = null; }
public AssetPreviewModel(Uri contentUrl, AssetTypes contentType, string assetKey, string contextKey, string deleteScriptName = null) { ContentUrl = contentUrl; AssetType = contentType; AssetKey = assetKey; ContextKey = contextKey; DeleteScriptName = deleteScriptName; }
public void AddAssetType(string value) { if (!mAssets.ContainsKey(value)) { AssetTypes.Add(value); mAssets.Add(value, new List <UpdatableAsset>()); } }
public MetaAsset LoadMetaAsset(string Name, AssetTypes Type) { MetaAsset asset = new MetaAsset(); asset.Name = Name; asset.InfoType = Type; FSWorker.LoadAssetFile(asset); return(asset); }
public void AddAsset(InstalledFile file, AssetTypes assetType, Generation generation, Gender gender) { if (!Cache.TryGetValue(assetType, out GenerationCache gen)) { gen = new GenerationCache(); Cache.Add(assetType, gen); } gen.AddAsset(file, generation, gender); }
internal string[] DetectAssetsNamesByType(AssetTypes type) { string path = GetAssetTypePath(type); if (!Directory.Exists(path)) { return(new string[0]); } return(Directory.GetFiles(path)); }
// register all possible build processors form the assembly public void RegisterClasses(Assembly assembly) { foreach (Type classType in assembly.GetTypes()) { if (!classType.IsClass || classType.IsAbstract) { continue; } if (classType.IsSubclassOf(typeof(AssetProcessor))) { var buildProcessor = Activator.CreateInstance(classType) as AssetProcessor; bool result = ProcessorByName.TryAdd(buildProcessor.Name, buildProcessor); if (!result) { ToolDebug.Warning("Duplicated processor {0}", buildProcessor.Name); } result = ProcessorByType.TryAdd(buildProcessor.GetType(), buildProcessor); if (!result) { ToolDebug.Warning("Duplicated processor {0}", buildProcessor.Name); } foreach (var inputType in buildProcessor.GetInputAssetTypes()) { List <AssetProcessor> processorList; if (!ProcessorByInputType.TryGetValue(inputType, out processorList)) { processorList = new List <AssetProcessor>(); ProcessorByInputType.TryAdd(inputType, processorList); } if (processorList.IndexOf(buildProcessor) >= 0) { ToolDebug.Warning("Duplicated processor {0}", buildProcessor.Name); } else { processorList.Add(buildProcessor); } } } else if (classType.IsSubclassOf(typeof(Asset))) { var assetData = Activator.CreateInstance(classType) as Asset; AssetTypes.AddOrUpdate(assetData.AssetTypeName, classType, (name, oldValue) => { return(classType); }); } else { continue; } } }
private bool CreateAssetTypeDirectory(AssetTypes type) { string path = NativeFSWorker.GetAssetTypePath(type); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); Console.WriteLine("Create directory: {0}", path); } return(true); }
private string[] DetectAssetsNamesByType(AssetTypes type) { string[] result = FSWorker.DetectAssetsNamesByType(type); for (int i = 0; i < result.Length; i++) { string[] arr = result[i].Split('/'); arr = arr[arr.Length - 1].Split('.'); result[i] = arr[0]; } return(result); }
public Asset CreateAssetByExt(string ext) { Type found; if (AssetTypes.TryGetValue(ext.ToLower(), out found)) { return(Activator.CreateInstance(found) as Asset); } return(null); }
public override void Read(XmlElement node) { this.Name = this.GetAttribute(node, "Name", true); this.Filename = this.GetAttribute(node, "Filename", true); this.Type = this.GetEnumAttribute(node, "Type", true, AssetTypes.None); if (this.Type == AssetTypes.None) { throw new Exception("The type of the name '" + this.Name + "' is not valid!"); } }
Asset CreateAssetByExt(string ext, params object[] args) { Type found; if (AssetTypes.TryGetValue(ext.ToLower(), out found)) { return(Activator.CreateInstance(found, args) as Asset); } return(null); }
public int CreateAssetType(AssetTypeModel assetTypeModel) { AssetTypes assetType = null; assetType = this._assetAssetTypeRepository.CreateAssetType(new AssetTypes() { Description = assetTypeModel.Description, AssetCategoryID = assetTypeModel.AssetCategoryID }); return(assetType.ID); }
public int UpdateAssetType(AssetTypeModel assetTypeModel) { AssetTypes assetType = _assetAssetTypeRepository.GetAssetTypeByID(assetTypeModel.ID); if (assetType != null) { assetType.Description = assetTypeModel.Description; assetType.AssetCategoryID = assetTypeModel.AssetCategoryID; } _assetAssetTypeRepository.UpdateAssetType(assetType); return(assetType.ID); }
/// <summary> /// Initializes a new instance of the <see cref="Configuration" /> class. /// </summary> /// <param name="itemType">Type of the item.</param> /// <param name="assetType">Type of the asset.</param> /// <param name="cityName">Name of the city.</param> public Configuration(ItemTypes itemType, AssetTypes assetType, string cityName) { this.ItemType = itemType; this.assetType = assetType; this.items = new List <Item>(); this.cityName = cityName; if (itemType == ItemTypes.Configuration) { this.index = new Dictionary <string, int>(); } }
public Asset(int id, string name, AssetTypes type, Faction faction, Clan clan, int designId, int expansionStage, Vector position, Spacemap map, bool invisible, bool visibleOnWarnRadar, bool detectedByWarnRadar) : base(id, position, map) { Type = type; Name = name; Faction = faction; Clan = clan; DesignId = designId; ExpansionStage = expansionStage; Invisible = invisible; VisibleOnWarnRadar = visibleOnWarnRadar; DetectedByWarnRadar = detectedByWarnRadar; }
/// <summary> /// Gets all the available objects. /// </summary> public virtual AssetTypes GetAll() { // create a new instance of the return object AssetTypes objects = new AssetTypes(); // fill the objects this.Fill(objects); // return the filled object from the service return(objects); }
public IHttpActionResult InsertLoanValueRatio(LoanValueRatioModel model) { AssetTypes type = (AssetTypes)Int32.Parse(model.AssetType); edisRepo.FeedDataForLoanValueRatios(new LoanValueRatioFeed { AssetType = type, CreateOn = model.CreateOn, Lender = model.Lender, Ratio = model.Ratio, Ticker = model.Ticker }); return(Ok()); }
private Model GetAssetModel(AssetTypes a) { return assetManager.GetModel((int) a); }
private void PickPiece(AssetTypes p) { currentPiece = GetAssetModel(p); }
void IAssetService.SetAssetInfo(long assetNo, AssetTypes assetType, long BoyzbeMemberNo) { throw new NotImplementedException(); }