本文整理汇总了C#中AssetManager.Open方法的典型用法代码示例。如果您正苦于以下问题:C# AssetManager.Open方法的具体用法?C# AssetManager.Open怎么用?C# AssetManager.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetManager
的用法示例。
在下文中一共展示了AssetManager.Open方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLocationsFromCsvFile
internal static List<LocationItem> GetLocationsFromCsvFile(AssetManager assets)
{
if (LocationItems.Any())
return LocationItems;
using (var sr = new StreamReader(assets.Open("TopWorldCities.csv")))
{
var x = sr.ReadToEnd();
var position = 0;
foreach ( var line in x.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None))
{
try
{
var objectItems = line.Split(';');
if (objectItems.Length != 3)
continue;
LocationItems.Add(new LocationItem(position,
objectItems[0],
GetCorrectDoubleValue(objectItems[1]),
GetCorrectDoubleValue(objectItems[2])));
position++;
}
catch (Exception ex)
{
var tmp = ex.ToString();
}
}
return LocationItems;
}
}
示例2: WorkoutDataAdapter
public WorkoutDataAdapter(AssetManager assets)
{
_assetManager = assets;
var localFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var localFile = Path.Combine(localFolder, WorkoutFileName);
// Check if user file exists.
if (!File.Exists (localFile))
{
// Check if folder exists.
if (!Directory.Exists(localFolder)) {
Directory.CreateDirectory(localFolder);
}
using (var defaultData = _assetManager.Open("Workouts.xml"))
{
// Save default workouts to folder.
using (var fs = new FileStream(localFile, FileMode.CreateNew, FileAccess.Write))
{
defaultData.CopyTo (fs);
fs.Flush ();
fs.Close ();
}
defaultData.Close ();
}
}
// Now open local file.
var dataStream = new FileStream(localFile, FileMode.Open, FileAccess.Read);
LoadWorkouts (dataStream);
}
示例3: GetGordionCubePuzzle
public static PuzzleState GetGordionCubePuzzle(AssetManager asset)
{
using (var sr = new StreamReader(asset.Open ("GordionCube.txt")))
{
string text = sr.ReadToEnd();
return ReadPuzzle(text);
}
}
示例4: Mat
public Mat(AssetManager assets, String fileName)
: this()
{
using (Stream imageStream = assets.Open(fileName))
using (MemoryStream ms = new MemoryStream())
{
imageStream.CopyTo(ms);
CvInvoke.Imdecode(ms.ToArray(), LoadImageType.AnyColor | LoadImageType.AnyDepth, this);
}
}
示例5: CreateDrawable
public static Drawable CreateDrawable(PointStyleInfo styleInfo, AssetManager assetManager )
{
if (string.IsNullOrWhiteSpace(styleInfo.ImageUrl))
{
throw new NotSupportedException("point style for non-images not supported.");
}
var asset = assetManager.Open(styleInfo.ImageUrl);
return new BitmapDrawable(asset);
}
示例6: Mat
public Mat(AssetManager assets, String fileName)
: this()
{
using (Stream imageStream = assets.Open(fileName))
{
using (BinaryReader br = new BinaryReader(imageStream))
{
byte[] b = br.ReadBytes((int)imageStream.Length);
CvInvoke.Imdecode(b, LoadImageType.AnyColor | LoadImageType.AnyDepth, this);
}
}
}
示例7: GetFileLinesFromAssets
/// <summary>
/// Reads a file from the related AssetManager.
/// </summary>
/// <param name="fileName">The full name of the file.</param>
/// <param name="assets">The related AssetsManager instance.</param>
/// <returns>Returns the data of the file as an array of stringed lines.</returns>
public static string[] GetFileLinesFromAssets(string fileName, AssetManager assets)
{
Stream stream = assets.Open(fileName);
StreamReader streamReader = new StreamReader(stream);
List<string> fileLines = new List<string>();
while (!streamReader.EndOfStream)
{
fileLines.Add(streamReader.ReadLine());
}
return fileLines.ToArray();
}
示例8: Setup
public void Setup()
{
assets = Android.App.Application.Context.Assets;
input = assets.Open ("Data/titleTest2.csv");
}
示例9: ParseSvgFromAsset
public static Svg ParseSvgFromAsset (AssetManager pAssetManager, string pAssetPath, ISvgColorMapper pSVGColorMapper)
{
using (var stream = pAssetManager.Open (pAssetPath))
return ParseSvgFromStream (stream, pSVGColorMapper);
}