当前位置: 首页>>代码示例>>C#>>正文


C# AssetManager.Open方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:EAbychkov,项目名称:AlarmApp,代码行数:30,代码来源:LocationFileWorker.cs

示例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);
        }
开发者ID:sloscialo,项目名称:EllipticalWorkout,代码行数:33,代码来源:WorkoutDataAdapter.cs

示例3: GetGordionCubePuzzle

 public static PuzzleState GetGordionCubePuzzle(AssetManager asset)
 {
     using (var sr = new StreamReader(asset.Open ("GordionCube.txt")))
     {
         string text = sr.ReadToEnd();
         return ReadPuzzle(text);
     }
 }
开发者ID:deapsquatter,项目名称:DisentanglementPort,代码行数:8,代码来源:PuzzleParser.cs

示例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);
    }
 }
开发者ID:joelmuzz,项目名称:Emgu-CV,代码行数:10,代码来源:MatAndroid.cs

示例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);
        }
开发者ID:knji,项目名称:mvvmcross.plugins,代码行数:10,代码来源:MapquestStyleFactory.cs

示例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);
       }
    }
 }
开发者ID:Warren-GH,项目名称:emgucv,代码行数:12,代码来源:MatAndroid.cs

示例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();
        }
开发者ID:sagisprojects,项目名称:Virtual-Guitar-Teacher,代码行数:19,代码来源:Generic.cs

示例8: Setup

 public void Setup()
 {
     assets = Android.App.Application.Context.Assets;
     input = assets.Open ("Data/titleTest2.csv");
 }
开发者ID:Aciho,项目名称:DevTest-Xamarin,代码行数:5,代码来源:CSVParser_Tests.cs

示例9: ParseSvgFromAsset

		public static Svg ParseSvgFromAsset (AssetManager pAssetManager, string pAssetPath, ISvgColorMapper pSVGColorMapper)
		{
			using (var stream = pAssetManager.Open (pAssetPath))
				return ParseSvgFromStream (stream, pSVGColorMapper);
		}
开发者ID:jdluzen,项目名称:xamsvg,代码行数:5,代码来源:SvgParser.cs


注:本文中的AssetManager.Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。