/// <summary> /// Copy the given resource file into a given base folder. /// </summary> private void CopyResourceToFolder(string folder, string resourceFile, ResourceType resourceType) { var outputPath = ResourceExtensions.GetNormalizedResourcePath(folder, resourceFile, resourceType); var outputFolder = Path.GetDirectoryName(outputPath); if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } // Collect last modification date var modified = File.GetLastWriteTime(resourceFile); if (modified > lastModified) { lastModified = modified; } // Copy the resource file File.Copy(resourceFile, outputPath, true); // Make sure file is not readonly. File.SetAttributes(outputPath, FileAttributes.Normal); // Post process ProcessResource(outputPath, resourceType); }
/// <summary> /// Format a drawable resource id. /// </summary> internal static string FormatResourceId(string id, ResourceType defaultType) { ResourceId resId; if (ResourceId.TryParse(id, defaultType, out resId)) { return(resId.ToString(ResourceIdFormat.AndroidXml)); } throw new ArgumentException(string.Format("Unsupported resource id '{0}'", id)); }
/// <summary> /// Post process the given resource path. /// </summary> private void ProcessResource(string outputPath, ResourceType resourceType) { // Process contents if needed switch (resourceType) { case ResourceType.Layout: layoutProcessor.Process(outputPath, true); break; case ResourceType.Values: valuesResourceProcessor.Process(outputPath, true); break; } // Set the timestamp File.SetLastWriteTime(outputPath, DateTime.Now); }
/// <summary> /// Format a drawable resource id. /// </summary> internal static string FormatResourceId(string id, ResourceType defaultType) { ResourceId resId; if (ResourceId.TryParse(id, defaultType, out resId)) return resId.ToString(ResourceIdFormat.AndroidXml); throw new ArgumentException(string.Format("Unsupported resource id '{0}'", id)); }
/// <summary> /// Copy the given resource file into a given base folder. /// </summary> private void CopyResourceToFolder(string folder, string resourceFile, ResourceType resourceType) { var outputPath = ResourceExtensions.GetNormalizedResourcePath(folder, resourceFile, resourceType); var outputFolder = Path.GetDirectoryName(outputPath); if (!Directory.Exists(outputFolder)) Directory.CreateDirectory(outputFolder); // Collect last modification date var modified = File.GetLastWriteTime(resourceFile); if (modified > lastModified) lastModified = modified; // Copy the resource file File.Copy(resourceFile, outputPath, true); // Make sure file is not readonly. File.SetAttributes(outputPath, FileAttributes.Normal); // Post process ProcessResource(outputPath, resourceType); }