SourceData GetSourceData() { var sourceData = new SourceData(); sourceData.curveTypePosition = CurveTypePosition; sourceData.roundedLineCurvatureRadius = RoundedLineCurvatureRadius; sourceData.curveTypeRotation = CurveTypeRotation; sourceData.curveTypeScale = CurveTypeScale; sourceData.timeScale = TimeScale; var points = GetComponents <Component_CurveInSpacePoint>(onlyEnabledInHierarchy: true); sourceData.points = new SourceData.Point[1 + points.Length]; sourceData.points[0] = new SourceData.Point() { transform = Transform, time = Time }; for (int n = 0; n < points.Length; n++) { sourceData.points[n + 1] = new SourceData.Point() { transform = points[n].Transform, time = points[n].Time } } ; //sort by time bool allPointsZeroTime = sourceData.points.All(p => p.time == 0); if (!allPointsZeroTime) { CollectionUtility.MergeSort(sourceData.points, delegate(SourceData.Point a, SourceData.Point b) { if (a.time < b.time) { return(-1); } if (a.time > b.time) { return(1); } return(0); }); } return(sourceData); }
//!!!! //public static bool InsidePackage( string path ) //{ // lock( VirtualFileSystem.lockObject ) // { // if( !VirtualFileSystem.initialized ) // Log.Fatal( "VirtualFileSystem: File system is not initialized." ); // if( VirtualFileSystem.LoggingFileOperations ) // Log.Info( "Logging file operations: VirtualDirectory.IsInArchive( \"{0}\" )", path ); // string realPath = VirtualPathUtils.GetRealPathByVirtual( path ); // if( Directory.Exists( realPath ) ) // return false; // return PackageManager.IsDirectoryExists( path ); // } //} /// <summary> /// Returns the names of files in the specified directory that match the specified /// search pattern, using a value to determine whether to search subdirectories. /// </summary> /// <param name="path">The directory from which to retrieve the files.</param> /// <param name="searchPattern"> /// The search string to match against the names of files in path. The parameter /// cannot end in two periods ("..") or contain two periods ("..") followed by /// System.IO.Path.DirectorySeparatorChar or System.IO.Path.AltDirectorySeparatorChar, /// nor can it contain any of the characters in System.IO.Path.InvalidPathChars. /// /// </param> /// <param name="searchOption"> /// One of the System.IO.SearchOption values that specifies whether the search /// operation should include all subdirectories or only the current directory. /// </param> /// <returns> /// A <b>String</b> array containing containing the names of files in the /// specified directory that match the specified search pattern. /// </returns> public static string[] GetFiles(string path, string searchPattern = "*", SearchOption searchOption = SearchOption.TopDirectoryOnly) { if (!VirtualFileSystem.initialized) { Log.Fatal("VirtualFileSystem: File system is not initialized."); } if (VirtualFileSystem.LoggingFileOperations) { Log.Info("Logging file operations: VirtualDirectory.GetFiles( \"{0}\", \"{1}\", \"{2}\" )", path, searchPattern, searchOption); } if (searchPattern.IndexOfAny(new char[] { '\\', '/', '?' }) != -1) { throw new ArgumentException("searchPattern: following characters: \\, /, ? is not supported."); } if (path.Contains("..")) { throw new ArgumentException("path: \"..\" is not supported."); } if (searchPattern.Contains("..")) { throw new ArgumentException("searchPattern: \"..\" is not supported."); } string realPath = VirtualPathUtility.GetRealPathByVirtual(path); //!!!!redirections string[] files; if (Directory.Exists(realPath)) { files = Directory.GetFiles(realPath, searchPattern, searchOption); } else { files = new string[0]; } if (VirtualPathUtility.IsUserDirectoryPath(path)) { int prefixLength = VirtualFileSystem.Directories.UserSettings.Length + 1; for (int n = 0; n < files.Length; n++) { files[n] = "user:" + files[n].Substring(prefixLength); } CollectionUtility.MergeSort(files, StringComparer.Ordinal); return(files); } else { int prefixLength = VirtualFileSystem.Directories.Assets.Length + 1; for (int n = 0; n < files.Length; n++) { files[n] = files[n].Substring(prefixLength); } //!!!!! //List<string> result = new List<string>( 64 ); //PackageManager.GetFiles( path, searchPattern, searchOption, result ); //if( result.Count != 0 ) //{ // foreach( string name in files ) // result.Add( name ); // ListUtils.MergeSort( result, StringComparer.Ordinal ); // //remove replies // for( int n = result.Count - 1; n >= 1; n-- ) // { // if( string.Compare( result[ n ], result[ n - 1 ], true ) == 0 ) // result.RemoveAt( n ); // } // files = result.ToArray(); //} //else //{ CollectionUtility.MergeSort(files, StringComparer.Ordinal); //} return(files); } }