public AssetLoadResultByLoader Load(AssetLoadInfo loadInfo) { try { var asset = BuildAsset(loadInfo); return(AssetLoadResultByLoader.Success(asset)); } catch (Exception ex) { return(AssetLoadResultByLoader.Failure("EXCEPTION", ex)); } }
public AssetLoadResultByLoader Load(AssetLoadInfo loadInfo) { try { var asset = BuildAsset(loadInfo); return(AssetLoadResultByLoader.Success(asset)); } catch (Exception ex) { return(AssetLoadResultByLoader.Failure(ex.GetType().Name, ex)); } }
public AssetLoadResultByLoader Load(AssetLoadInfo loadInfo) { try { initializer.EnsureInitialized(); var asset = CreateAsset(loadInfo); return(AssetLoadResultByLoader.Success(asset)); } catch (Exception ex) { return(AssetLoadResultByLoader.Failure(ex.GetType().Name, ex)); } }
public AssetLoadResultByLoader Load(AssetLoadInfo loadInfo) { // todo: use file system try { if (Path.GetExtension(loadInfo.LoadPath) == ".dcm") { return(LoadSingle(loadInfo)); } if (Path.GetExtension(loadInfo.LoadPath) == ".dcmf") { return(LoadFolder(loadInfo)); } return(AssetLoadResultByLoader.Failure("Neither .dcm nor .dcmf", null)); } catch (Exception ex) { return(AssetLoadResultByLoader.Failure(ex.GetType().Name, ex)); } }
public AssetLoadResultByLoader Load(AssetLoadInfo loadInfo) { try { var points = new List <Vector3>(); var loadPath = loadInfo.LoadPath; var fileData = loadInfo.FileSystem.ReadAllBytes(loadPath); using (var reader = new StreamReader(new MemoryStream(fileData))) while (true) { var line = reader.ReadLine(); if (line == null) { break; } var match = PointRegex.Match(line); if (!match.Success) { continue; } points.Add(new Vector3( float.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture), float.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture), float.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture) )); } var resource = new SpherePackingResult(points); var hash = AssetHashMd5.FromSingleFile(fileData); var asset = new Asset(loadInfo.AssetName, resource, loadInfo.StorageType, hash, loadInfo.ReferencePath, Path.GetFileName(loadInfo.ReferencePath)); return(AssetLoadResultByLoader.Success(asset)); } catch (Exception ex) { return(AssetLoadResultByLoader.Failure("EXCEPTION", ex)); } }