Пример #1
0
 public DiskSpaceNotification(string path, PathType pathType, double freeSpaceInBytes, double freeSpaceInPercentage)
 {
     Path = path;
     PathType = pathType;
     FreeSpaceInBytes = freeSpaceInBytes;
     FreeSpaceInPercentage = freeSpaceInPercentage;
 }
Пример #2
0
		private static string GetPathFromRegistry(PathType type)
		{
			var mainKey = type == PathType.User ? Registry.CurrentUser : Registry.LocalMachine;

			try
			{
				var subKey = mainKey.OpenSubKey(type == PathType.User ? UserPathKey : SystemPathKey);
				if (subKey == null)
					throw new Exception();
				var path = subKey
					.GetValue("Path", "", RegistryValueOptions.DoNotExpandEnvironmentNames) as string;
				return path;
			}
			catch (SecurityException)
			{
				MessageBox.Show("An error has occured while trying to open registry.\n" +
								"Your account probably doesn't have necessary permissions.");
				Application.Current.Shutdown();
			}
			catch (UnauthorizedAccessException)
			{
				MessageBox.Show("An error has occured while trying to open registry.\n" +
								"Your account probably doesn't have necessary permissions.");
				Application.Current.Shutdown();
			}
			catch (Exception e)
			{
				MessageBox.Show("An unknown error has occured while trying to open registry:\n" + e.Message);
				Application.Current.Shutdown();
			}
			return "";
		}
Пример #3
0
        public void AddOption(PathType type, Delivery delivery)
        {
            if (delivery == null)
                throw new ArgumentException("Delivery cannot be null", "delivery");

            options[type] = delivery;
        }
Пример #4
0
        private void FillPathData(Windows.UI.Xaml.Shapes.Path pathInstance, PathType typeOfPath){
            
            var dataPath = string.Empty ;

            if (typeOfPath == PathType.Book)
            {
                dataPath = "M8.15192985534668,0L8.16493034362793,0 8.16493034362793,39.189998626709C8.16493034362793,39.6419982910156 8.31793022155762,40.0549983978271 8.55592918395996,40.2599983215332 8.79993057250977,40.4699993133545 9.08692932128906,40.4329986572266 9.30992889404297,40.173999786377L15.2389297485352,33.1699991226196 20.8559303283691,40.1579990386963C20.9839305877686,40.3139991760254,21.1359310150146,40.3959999084473,21.2879314422607,40.3959999084473L21.6139316558838,40.2689990997314C21.8609313964844,40.0629997253418,22.0179309844971,39.6469993591309,22.0179309844971,39.189998626709L22.0179309844971,0 52.1599340438843,0C53.090934753418,0,53.8439350128174,0.757999420166016,53.8439350128174,1.6879997253418L53.8439350128174,49.3569984436035C53.8439350128174,50.2879981994629,53.090934753418,51.0459976196289,52.1599340438843,51.0459976196289L52.1399345397949,51.0410003662109C52.0039348602295,51.0699996948242,51.8759346008301,51.0909996032715,51.7449340820313,51.0909996032715L8.14793014526367,51.0909996032715C5.61592864990234,51.0909996032715 3.5399284362793,53.0789985656738 3.39693069458008,55.5789985656738 3.39693069458008,55.7309989929199 3.40092849731445,55.8460006713867 3.40092849731445,55.9209976196289L3.39292907714844,56.0529975891113C3.49493026733398,58.5929985046387,5.58692932128906,60.6279983520508,8.14793014526367,60.6279983520508L50.4719343185425,60.6279983520508 50.4719343185425,55.9669990539551C50.4719343185425,55.0359992980957 51.2299346923828,54.2779998779297 52.1599340438843,54.2779998779297 53.090934753418,54.2779998779297 53.8439350128174,55.0359992980957 53.8439350128174,55.9669990539551L53.8439350128174,62.3120002746582C53.8439350128174,63.246997833252,53.090934753418,64,52.1599340438843,64L7.89292907714844,64 7.63792991638184,63.9749984741211C3.3879280090332,63.7070007324219,0.00792694091796875,60.1749992370605,0.00792694091796875,55.8589973449707L0.0229301452636719,55.5669975280762C-0.0290718078613281,50.5599994659424,0.0229301452636719,12.4609990119934,0.0279273986816406,8.3179988861084L0.0119285583496094,8.14099884033203C0.0119285583496094,3.65299892425537,3.6649284362793,0,8.15192985534668,0z";
               
            }
            else if (typeOfPath == PathType.Key) {

                dataPath = "M16.547848,26.872497C14.451092,26.916562 12.365034,27.710413 10.729302,29.266098 7.2240894,32.589393 7.0834706,38.118687 10.403706,41.615683 13.72137,45.118677 19.252512,45.263676 22.752474,41.941881 26.247238,38.621584 26.401036,33.097193 23.078072,29.594298 21.314234,27.73567 18.92417,26.822555 16.547848,26.872497z M47.555126,0.0002117157C47.726013,0.0044841766,47.895291,0.073574066,48.021641,0.20638657L52.778168,5.1985388C53.03077,5.4641666,53.020371,5.888484,52.754769,6.1409225L52.232945,6.6370945 58.379608,13.115402C58.632122,13.382402,58.621121,13.806803,58.354809,14.058203L56.356011,15.956708C56.089798,16.207609,55.665879,16.197409,55.413365,15.930308L49.269745,9.4546347 48.00716,10.655153 52.407509,15.294587C52.660187,15.560289,52.649086,15.984593,52.382813,16.237495L50.384396,18.133013C50.118122,18.386015,49.694359,18.375215,49.441685,18.109612L45.04353,13.473104 30.99349,26.832494 31.170538,27.124847C35.031944,33.685067 34.017586,42.279621 28.253817,47.748075 21.549486,54.107365 10.954499,53.828564 4.5965569,47.125475 -1.7705653,40.417484 -1.4855343,29.826198 5.21898,23.462906 10.672487,18.294763 18.680851,17.507213 24.908787,20.994482L25.088602,21.09812 47.078934,0.18294907C47.211735,0.056484222,47.384236,-0.0040607452,47.555126,0.0002117157z";
            }


            if (!string.IsNullOrEmpty(dataPath))
            {
                var b = new Binding { Source = dataPath };

                BindingOperations.SetBinding(pathInstance, Windows.UI.Xaml.Shapes.Path.DataProperty, b);
            }
        


        }
Пример #5
0
        /// <summary>
        /// Create a path from XZ nodes defined in a pathFile.
        /// The file must be accessible from the executable environment.
        /// </summary>
        /// <param name="theStage"> "world's stage" </param>
        /// <param name="aPathType"> SINGLE, REVERSE, or LOOP path traversal</param>
        /// <param name="pathFile"> text file, each line a node of X Z values, separated by a single space </x></param>
        public Path(Stage theStage, PathType aPathType, string pathFile)
            : base(theStage)
        {
            node = new List<NavNode>();
            stage = theStage;
            nextNode = 0;
            pathType = aPathType;
            done = false;

            // read file
            using (StreamReader fileIn = File.OpenText(pathFile)) {
                int x, z;
                string line;
                string[] tokens;
                line = fileIn.ReadLine();

                do {
                    // use default separators
                    tokens = line.Split(new char[] { });
                    x = Int32.Parse(tokens[0]);
                    z = Int32.Parse(tokens[1]);
                    node.Add(new NavNode(new Vector3(x, 0, z), NavNode.NavNodeEnum.WAYPOINT));
                    line = fileIn.ReadLine();
                }
                while (line != null);
            }
        }
Пример #6
0
		internal CookieStatus(string name, string path, BrowserType browserType, PathType pathType)
		{
			_name = name;
			_path = path;
			_browserType = browserType;
			_pathType = pathType;
			_displayName = null;
		}
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the FileChecksum class, and loads the file's hash (computed immediately)
        /// </summary>
        /// <param name="fileName">File to compute hash of</param>
        /// <param name="basePath">Base path</param>
        /// <param name="pathType">Path type</param>
        /// <param name="checksumType">Checksum type</param>
        public FileChecksum(string fileName, string basePath, PathType pathType, ChecksumType checksumType)
        {
            FilePath = fileName;

            ResolvedFileName = GetFileName(FilePath, basePath, pathType);

            Checksum = FileUtils.GetFileChecksum(fileName, checksumType);
        }
Пример #8
0
		public static IEnumerable<PathEntry> ReadDisabledItems(PathType type)
		{
			var name = type == PathType.User ? DisabledUserItemsFileName : DisabledSystemItemsFileName;
			var fullPath = Path.Combine(AppDataPath.AppDataDirPath, name);
			if (!File.Exists(fullPath))
				return new List<PathEntry>();
			return File.ReadAllLines(fullPath).Select(x => new PathEntry(x) { Enabled = false });
		}
Пример #9
0
 /// <summary>
 /// Create a path
 /// </summary>
 /// <param name="theStage"> "world's stage" </param>
 /// <param name="apath"> collection of nodes in path</param>
 /// <param name="aPathType"> SINGLE, REVERSE, or LOOP path traversal</param>
 public Path(Stage theStage, List<NavNode> aPath, PathType aPathType)
     : base(theStage)
 {
     node = aPath;
     nextNode = 0;
     pathType = aPathType;
     stage = theStage;
     done = false;
 }
Пример #10
0
		public static void SavePathToRegistry(PathType type, string path)
		{
#if DEBUG
			System.Diagnostics.Debug.WriteLine(path);
#else
			Environment.SetEnvironmentVariable("Path", path,
				type == PathType.User ? EnvironmentVariableTarget.User : EnvironmentVariableTarget.Machine);
#endif
		}
Пример #11
0
 public PathElement(string name, PathType type)
 {
     if (string.IsNullOrEmpty(name) && type != PathType.Root)
     {
         throw new ArgumentException("Can't have empty name for non root path element");
     }
     _pathType = type;
     _name = name;
 }
Пример #12
0
		public static void SaveDisabledItems(PathType type, IEnumerable<PathEntry> items)
		{
			var name = type == PathType.User ? DisabledUserItemsFileName : DisabledSystemItemsFileName;
			var fullPath = Path.Combine(AppDataPath.AppDataDirPath, name);

			var disabledItems = items.Where(x => x.Enabled == false).Select(x => x.Path);

			File.WriteAllLines(fullPath, disabledItems);
		}
Пример #13
0
 /** 初始化处理 */
 protected virtual void Config(string vRes, PathType vType)
 {
     if (vType == PathType.localResource)
     {
         resPath = vRes;
         loadLinesFromResource ();
         readLines ();
         lines = null; // 处理完后清理源缓存
     }
 }
 public static PathSpec CreateTemporaryPath(PathType type)
 {
     var path = Path.GetRandomFileName();
     var spec = path.ToPathSpec().Value;
     if (type == PathType.File)
         spec.Create(PathType.File);
     if (type == PathType.Folder)
         spec.Create(PathType.Folder);
     return spec;
 }
Пример #15
0
        // ***********************************************************************************
        // CONSTRUCTOR
        // ***********************************************************************************

        public Path(PathType type, Vector3[] waypoints, int subdivisionsXSegment, Color? gizmoColor = null)
        {
            this.type = type;
            this.subdivisionsXSegment = subdivisionsXSegment;
            if (gizmoColor != null) this.gizmoColor = (Color)gizmoColor;
            AssignWaypoints(waypoints, true);
            AssignDecoder(type);

            if (DOTween.isUnityEditor) DOTween.GizmosDelegates.Add(Draw);
        }
Пример #16
0
        public static bool Contains(Route route, PathType type)
        {
            for (uint i = 0x0; i < route.GetNumPaths(); i++)
            {
                PathData pathData = route.GetPathData(i);
                if (pathData.PathType == type) return true;
            }

            return false;
        }
Пример #17
0
 /// <summary>
 /// Create a path
 /// </summary>
 /// <param name="theStage"> "world's stage" </param>
 /// <param name="apath"> collection of nodes in path</param>
 /// <param name="aPathType"> SINGLE, REVERSE, or LOOP path traversal</param>
 public Path(Stage theStage, List<NavNode> aPath, PathType aPathType, bool flag)
     : base(theStage)
 {
     node = aPath;
     nextNode = 0;
     pathType = aPathType;
     stage = theStage;
     done = false;
     drawFlag = flag;
 }
Пример #18
0
        public Path(Point startPoint, Point endPoint, int radius, int width, PathType direction)
        {
            this.startPoint = startPoint;
            this.endPoint = endPoint;
            this.radius = radius;
            this.width = width;
            this.direction = direction;
            this.StepDistance = 40;
            CalculateOrigin();

            this.outliner = new PathOutliner(this, this.Origin);
        }
        /// <summary>
        /// Tests whether the given file contents uses the framework.
        /// </summary>
        /// <param name="fileContents">Contents of the file as a string to test.</param>
        /// <param name="bestGuess">True if the method should fall back from definitive to best guess detection.</param>
        /// <param name="pathType">The type of the file being tests</param>
        /// <returns>True if the file is a framework dependency, otherwise false.</returns>
        public virtual bool FileUsesFramework(string fileContents, bool bestGuess, PathType pathType)
        {
            if (bestGuess)
            {
                var regex = FrameworkSignatureJavaScript;
                return regex != null && regex.IsMatch(fileContents);
            }

            Match match = FrameworkReferenceRegex.Match(fileContents);
            return match.Success &&
                   match.Groups["framework"].Value.Equals(FrameworkKey, StringComparison.OrdinalIgnoreCase);
        }
Пример #20
0
 public ScmRepository(string scmtype, string path, PathType type)
 {
     Path = DeserializePath (path);
     origPath = path;
     pathType = type;
     this.scmType = scmtype;
     Status = ScmRepositoryStatus.Unknown;
     statusUpdateTime = DateTime.MinValue;
     ActiveStatusUpdateInterval = -1;
     IdleStatusUpdateInterval = -1;
     Disable = false;
 }
Пример #21
0
        public EventLogQuery(string path, PathType pathType, string query) {

            this.session = EventLogSession.GlobalSession;
            this.path = path;   // can be null
            this.pathType = pathType;

            if (query == null) {
                if (path == null)
                    throw new ArgumentNullException("path");
            }
            else {
                this.query = query;
            }
        }
 public static void Create(this PathSpec path, PathType pathType)
 {
     switch (pathType)
     {
         case PathType.Folder:
             Directory.CreateDirectory(path.ToString());
             break;
         case PathType.File:
             File.WriteAllText(path.ToString(), string.Empty);
             break;
         default:
             throw new ArgumentException(nameof(pathType));
     }
 }
Пример #23
0
 public static void AssertBadPath(
     string path, 
     PathType type)
 {
     try
     {
         ParsedPath pp = new ParsedPath(path, type);
         Assert.IsNotNull(pp);
         Assert.Fail("Badly formed path not caught");
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is ArgumentException);
     }
 }
Пример #24
0
		static async Task copyToSource(PathChange change, PathType kind)
		{
			switch (kind)
			{
				case PathType.Directory:
					DirectorySynchronizer.createDirectory(change, change.Source);
					if (change.Mode == ChangeMode.Deep && change.Configuration.Sync)
						await sync(change);
					break;

				case PathType.File:
					await FileSynchronizer.copyFile(change, change.Target, change.Source);
					break;
			}
		}
        internal EventLogInformation(EventLogSession session, string channelName, PathType pathType) {
            EventLogPermissionHolder.GetEventLogPermission().Demand();

            EventLogHandle logHandle = NativeWrapper.EvtOpenLog(session.Handle, channelName, pathType);

            using (logHandle) {
                creationTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogCreationTime);
                lastAccessTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogLastAccessTime);
                lastWriteTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogLastWriteTime);
                fileSize = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogFileSize));
                fileAttributes = (int?)((uint?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogAttributes));
                recordCount = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogNumberOfLogRecords));
                oldestRecordNumber = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogOldestRecordNumber));
                isLogFull = (bool?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogFull);
            }
        }
Пример #26
0
        /// <summary>
        /// Standard way of creating file paths in the Framework 
        /// </summary>
        /// <param name="type">Use ConfigurableControl.PathType enum</param>
        /// <param name="filePath">path to process</param>
        /// <param name="global">non-site specific path</param>
        /// <param name="useSite">site specific path</param>
        /// <param name="useDefault"></param>
        /// <param name="useSection"></param>
        /// <returns></returns>
        protected virtual string GetPath(
            PathType type,
            string filePath,
            bool global,
            bool useSite,
            bool useDefault,
            bool useSection)
        {
            //check if starts with pages or content, remove "/pages/v*/" or "/content/v*/"
            if (filePath.StartsWith("/pages")) {
                filePath = filePath.Remove(0, 9);
            } else if (filePath.StartsWith("pages")) {
                filePath = filePath.Remove(0, 8);
            } else if (filePath.StartsWith("/content")) {
                filePath = filePath.Remove(0, 11);
            } else if (filePath.StartsWith("content")) {
                filePath = filePath.Remove(0, 10);
            }

            string site;
            //if the path is global or not site specific, set site to nothing
            if (useSite && !global) {
                site = "/" + this.Page.Site;
            } else {
                site = "";
            }

            string rootPath = "";
            switch (type) {
                case PathType.CONTENT:
                    rootPath = WebInfo.ContentPath;
                    //if pages language defined then append it to the site
                    string language = (this.Page.Language == null) ? "" : "/" + this.Page.Language;
                    site = site + language;
                    break;

                case PathType.PAGES:
                    if (useDefault) {
                        site = "default";
                    }
                    rootPath = WebInfo.PagesPath;
                    break;
            }

            return string.Format("/{0}v{1}{2}{3}", rootPath, this.Page.Version, site, filePath);
        }
Пример #27
0
 /// <summary>
 /// Create a path from array
 /// </summary>
 /// <param name="theStage"> "world's stage" </param>
 /// <param name="apath"> collection of nodes in path</param>
 /// <param name="pathNode"> int[x,z] array of WayPoint positions for path</param>
 /// <param name="aPathType"> SINGLE, REVERSE, or LOOP path traversal</param>
 public Path(Stage theStage, int[,] pathNode, PathType aPathType)
     : base(theStage)
 {
     nextNode = 0;
     pathType = aPathType;
     stage = theStage;
     done = false;
       int spacing = stage.Spacing;
     int x, z;
       // make a simple path, show how to set the type of the NavNode outside of construction.
     node = new List<NavNode>();
     for(int i = 0; i < pathNode.Length/2; i++) {
     x = pathNode[i, 0];
     z = pathNode[i, 1];
     node.Add(new NavNode(new Vector3(x * spacing, stage.Terrain.surfaceHeight(x, z), z * spacing),
        NavNode.NavNodeEnum.WAYPOINT) );
     }
 }
Пример #28
0
 public static string GetPath(PathType type)
 {
     switch (type) {
     case PathType.Desktop:
         return Paths.GetDesktopPath();
         break;
     case PathType.WindowsStartMenu:
         return Paths.GetWindowsStartMenuPath();
         break;
     case PathType.UnixLocalXDGApplications:
         return Paths.UnixLocalXDGApplications();
         break;
     case PathType.UnixGlobalXDGApplications:
         return Paths.UnixGlobalXDGApplications();
         break;
     }
     return null;
 }
Пример #29
0
        public void AddItemToFileBrowser(string name, string size, PathType type, int imageIndex)
        {
            try
            {
                ListViewItem lvi = new ListViewItem(new string[] { name, size, (type != PathType.Back) ? type.ToString() : string.Empty })
                {
                    Tag = type,
                    ImageIndex = imageIndex
                };

                lstDirectory.Invoke((MethodInvoker)delegate
                {
                    lstDirectory.Items.Add(lvi);
                });
            }
            catch (InvalidOperationException)
            {
            }
        }
Пример #30
0
        /// <summary>
        /// Creates an engine of the specified directory under corpus\.
        /// <para />
        /// The database .xml file should be in corpus\, named the same as the subdirectory.
        /// </summary>
        /// <param name="subdirectory">Subdirectory of corpus\ to use</param>
        /// <param name="excludePattern">Exclude pattern</param>
        /// <param name="matchPattern">Match pattern</param>
        /// <param name="matchType">Match type</param>
        /// <param name="pathType">Path type</param>
        /// <param name="checksumType">Checksum type</param>
        /// <returns>Checksum Engine</returns>
        protected static Engine CreateEngine(
            string subdirectory,
            string excludePattern = "",
            string matchPattern = "*",
            MatchType matchType = MatchType.Wildcard,
            PathType pathType = PathType.RelativePath,
            ChecksumType checksumType = ChecksumType.MD5)
        {
            Engine engine = new Engine(
                GetCorpusDatabase(subdirectory),
                new NullReporter(),
                GetCorpusDirectory(subdirectory),
                excludePattern,
                matchPattern,
                matchType,
                pathType,
                checksumType);

            return engine;
        }
Пример #31
0
 protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List <List <SampleInfo> > nodeSamples)
 {
     return(new ConvertSlider
     {
         X = position.X,
         ControlPoints = controlPoints,
         Distance = length,
         PathType = pathType,
         NodeSamples = nodeSamples,
         RepeatCount = repeatCount
     });
 }
Пример #32
0
 public static Sprite[] GetPathSprite(PathType type)
 {
     LazyInit();
     return(pathSprites[type]);
 }
Пример #33
0
 public SvnRepository(string path, PathType type) : base("Svn", path, type)
 {
 }
Пример #34
0
        public TestContext BuildContext(IEnumerable <PathInfo> files, TestOptions options)
        {
            if (files == null)
            {
                throw new ArgumentNullException("testFilePathInfo");
            }

            if (!files.Any())
            {
                ChutzpahTracer.TraceInformation("No files given to build test context for");
                return(null);
            }

            var fileCount = files.Count();

            var allFilePathString = string.Join(",", files.Select(x => x.FullPath));

            ChutzpahTracer.TraceInformation("Building test context for '{0}'", allFilePathString);

            // Make sure all test paths have been resolved to real files
            var missingPaths = files.Where(x => x.FullPath == null).ToList();

            if (missingPaths.Any())
            {
                throw new FileNotFoundException("Unable to find files: " + string.Join(",", missingPaths.Select(x => x.Path)));
            }

            // Make sure all test paths have a valid file type
            if (!files.Select(x => x.Type).All(IsValidTestPathType))
            {
                throw new ArgumentException("Expecting a .js, .ts, .coffee or .html file or a url");
            }

            if (fileCount > 1 && files.Any(x => x.Type == PathType.Url || x.Type == PathType.Html))
            {
                throw new InvalidOperationException("Cannot build a batch context for Url or Html test files");
            }

            // We use the first file's directory to find the chutzpah.json file and to test framework
            // since we assume all files in the batch must have the same values for those
            PathType firstFileKind = files.First().Type;
            string   firstFilePath = files.First().FullPath;

            var chutzpahTestSettings = settingsService.FindSettingsFile(firstFilePath, options.ChutzpahSettingsFileEnvironments);

            // Exclude any files that are not included based on the settings file
            var testedPaths = files.Select(f => new { File = f, IsIncluded = IsTestPathIncluded(f.FullPath, chutzpahTestSettings) }).ToList();

            if (testedPaths.Any(x => !x.IsIncluded))
            {
                var pathString = string.Join(",", testedPaths.Where(x => !x.IsIncluded).Select(x => x.File.FullPath));
                ChutzpahTracer.TraceInformation("Excluding test files {0} given chutzpah.json settings", pathString);
                files = testedPaths.Where(x => x.IsIncluded).Select(x => x.File).ToList();

                if (!files.Any())
                {
                    return(null);
                }
            }

            string firstTestFileText;

            if (firstFileKind == PathType.Url)
            {
                firstTestFileText = httpClient.GetContent(firstFilePath);
            }
            else
            {
                firstTestFileText = fileSystem.GetText(firstFilePath);
            }

            IFrameworkDefinition definition;

            if (TryDetectFramework(firstTestFileText, firstFileKind, chutzpahTestSettings, out definition))
            {
                // For HTML test files we don't need to create a test harness to just return this file
                if (firstFileKind == PathType.Html || firstFileKind == PathType.Url)
                {
                    ChutzpahTracer.TraceInformation("Test kind is {0} so we are trusting the supplied test harness and not building our own", firstFileKind);

                    return(new TestContext
                    {
                        ReferencedFiles = new List <ReferencedFile> {
                            new ReferencedFile {
                                IsFileUnderTest = true, Path = firstFilePath
                            }
                        },
                        InputTestFiles = new[] { firstFilePath },
                        FirstInputTestFile = firstFilePath,
                        InputTestFilesString = firstFilePath,
                        TestHarnessPath = firstFilePath,
                        IsRemoteHarness = firstFileKind == PathType.Url,
                        TestRunner = definition.GetTestRunner(chutzpahTestSettings),
                    });
                }

                var temporaryFiles = new List <string>();

                string firstInputTestFileDir = Path.GetDirectoryName(firstFilePath);
                var    testHarnessDirectory  = GetTestHarnessDirectory(chutzpahTestSettings, firstInputTestFileDir);

                var referencedFiles = GetFilesUnderTest(files, chutzpahTestSettings).ToList();

                referenceProcessor.GetReferencedFiles(referencedFiles, definition, chutzpahTestSettings);

                IEnumerable <string> deps = definition.GetFileDependencies(chutzpahTestSettings);

                var coverageEngine = SetupCodeCoverageEngine(options, chutzpahTestSettings, definition, referencedFiles);

                AddTestFrameworkDependencies(deps, referencedFiles);

                var testFiles = referencedFiles.Where(x => x.IsFileUnderTest).Select(x => x.Path).ToList();
                return(new TestContext
                {
                    FrameworkDefinition = definition,
                    CoverageEngine = coverageEngine,
                    InputTestFiles = testFiles,
                    FirstInputTestFile = testFiles.FirstOrDefault(),
                    InputTestFilesString = string.Join(",", testFiles),
                    TestHarnessDirectory = testHarnessDirectory,
                    ReferencedFiles = referencedFiles,
                    TestRunner = definition.GetTestRunner(chutzpahTestSettings),
                    TemporaryFiles = temporaryFiles,
                    TestFileSettings = chutzpahTestSettings
                });
            }
            else
            {
                ChutzpahTracer.TraceWarning("Failed to detect test framework for '{0}'", firstFilePath);
            }

            return(null);
        }
Пример #35
0
 public Boolean IsValidPath(PathType type, PathStatus status)
 {
     return(PathUtils.IsValidPath(Text, type, status));
 }
Пример #36
0
        public string GetPath(int tutorialId, PathType pType)
        {
            switch (tutorialId)
            {
            case 0:
                break;

            case 1:
                switch (pType)
                {
                case PathType.BaseSolutionFolder:
                    return(_commonTutorialPath + "\\Tutorial1_EssentialShortcuts");

                case PathType.BaseContentFolder:
                    return(_commonTutorialPath + "\\Content\\Tutorial1");

                case PathType.BaseSolutionFile:
                    return(_commonTutorialPath +
                           "\\Tutorial1_EssentialShortcuts\\Tutorial1_EssentialShortcuts.sln");

                case PathType.BaseContentFile:
                    return(_commonTutorialPath + "\\Content\\Tutorial1\\Tutorial1Content.xml");

                case PathType.WorkCopySolutionFolder:
                    return(_commonWorkCopyPath + "\\Tutorial1_EssentialShortcuts");

                case PathType.WorkCopyContentFolder:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial1");

                case PathType.WorkCopySolutionFile:
                    return(_commonWorkCopyPath +
                           "\\Tutorial1_EssentialShortcuts\\Tutorial1_EssentialShortcuts.sln");

                case PathType.WorkCopyContentFile:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial1\\Tutorial1Content.xml");

                default:
                    throw new ArgumentOutOfRangeException(nameof(pType), pType, null);
                }

            case 2:
                break;

            case 3:
                switch (pType)
                {
                case PathType.BaseSolutionFolder:
                    return(_commonTutorialPath + "\\Tutorial3_WhatsNewReSharper2016.3");

                case PathType.BaseContentFolder:
                    return(_commonTutorialPath + "\\Content\\Tutorial3");

                case PathType.BaseSolutionFile:
                    return(_commonTutorialPath +
                           "\\Tutorial3_WhatsNewReSharper2016.3\\Tutorial3_WhatsNewReSharper2016.3.sln");

                case PathType.BaseContentFile:
                    return(_commonTutorialPath + "\\Content\\Tutorial3\\Tutorial3Content.xml");

                case PathType.WorkCopySolutionFolder:
                    return(_commonWorkCopyPath + "\\Tutorial3_WhatsNewReSharper2016.3");

                case PathType.WorkCopyContentFolder:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial3");

                case PathType.WorkCopySolutionFile:
                    return(_commonWorkCopyPath +
                           "\\Tutorial3_WhatsNewReSharper2016.3\\Tutorial3_WhatsNewReSharper2016.3.sln");

                case PathType.WorkCopyContentFile:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial3\\Tutorial3Content.xml");

                default:
                    throw new ArgumentOutOfRangeException(nameof(pType), pType, null);
                }

            case 4:
                switch (pType)
                {
                case PathType.BaseSolutionFolder:
                    return(_commonTutorialPath + "\\Tutorial4_WhatsNewReSharper2017.1");

                case PathType.BaseContentFolder:
                    return(_commonTutorialPath + "\\Content\\Tutorial4");

                case PathType.BaseSolutionFile:
                    return(_commonTutorialPath +
                           "\\Tutorial4_WhatsNewReSharper2017.1\\Tutorial4_WhatsNewReSharper2017.1.sln");

                case PathType.BaseContentFile:
                    return(_commonTutorialPath + "\\Content\\Tutorial4\\Tutorial4Content.xml");

                case PathType.WorkCopySolutionFolder:
                    return(_commonWorkCopyPath + "\\Tutorial4_WhatsNewReSharper2017.1");

                case PathType.WorkCopyContentFolder:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial4");

                case PathType.WorkCopySolutionFile:
                    return(_commonWorkCopyPath +
                           "\\Tutorial4_WhatsNewReSharper2017.1\\Tutorial4_WhatsNewReSharper2017.1.sln");

                case PathType.WorkCopyContentFile:
                    return(_commonWorkCopyPath + "\\Content\\Tutorial4\\Tutorial4Content.xml");

                default:
                    throw new ArgumentOutOfRangeException(nameof(pType), pType, null);
                }

            case 5:
                break;
            }
            return(null);
        }
Пример #37
0
 public void ExportLogAndMessages(string path, PathType pathType, string query, string targetFilePath)
 {
     this.ExportLogAndMessages(path, pathType, query, targetFilePath, false, CultureInfo.CurrentCulture);
 }
Пример #38
0
 public SliderPath(PathType type, Vector2[] controlPoints, double?expectedDistance = null)
     : this(controlPoints.Select((c, i) => new PathControlPoint(c, i == 0 ? (PathType?)type : null)).ToArray(), expectedDistance)
 {
 }
Пример #39
0
        // ***********************************************************************************
        // CONSTRUCTOR
        // ***********************************************************************************

        /// <summary>
        ///     Creates a new <see cref="PathPreview" /> based on the given array of <see cref="Vector3" /> points.
        /// </summary>
        /// <param name="p_type">Type of path</param>
        /// <param name="p_path">
        ///     The <see cref="Vector3" /> array used to create the path.
        /// </param>
        public PathPreview(PathType p_type, params Vector3[] p_path)
        {
            pathType = p_type;
            path     = new Vector3[p_path.Length];
            Array.Copy(p_path, path, path.Length);
        }
Пример #40
0
        //##### Main path request method #####
        public void RequestPath(Vector3 pathStart, Vector3 pathEnd, Action <List <Node>, Vector3[], bool> callback, PathType pathType)
        {
            ThreadStart threadStart = delegate {
                FindPath(pathStart, pathEnd, callback, pathType);   //Method on other page
            };

            threadStart.Invoke();
        }
Пример #41
0
 /// <summary>Creates a new instance of <see cref="DecompilerContext"/>.</summary>
 /// <param name="InputPath">The input path that points to a folder/file.</param>
 /// <param name="PathInputType">The type of path being inputted.</param>
 public DecompilerContext(String InputPath = "", PathType PathInputType = PathType.File)
 {
     this._Path     = InputPath;
     this._PathType = PathInputType;
 }
Пример #42
0
        public override HitObject Parse(string text)
        {
            string[] split = text.Split(',');

            Vector2 pos = new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));

            double startTime = Parsing.ParseDouble(split[2]) + Offset;

            LegacyHitObjectType type = (LegacyHitObjectType)Parsing.ParseInt(split[3]);

            int comboOffset = (int)(type & LegacyHitObjectType.ComboOffset) >> 4;

            type &= ~LegacyHitObjectType.ComboOffset;

            bool combo = type.HasFlag(LegacyHitObjectType.NewCombo);

            type &= ~LegacyHitObjectType.NewCombo;

            var soundType = (LegacyHitSoundType)Parsing.ParseInt(split[4]);
            var bankInfo  = new SampleBankInfo();

            HitObject result = null;

            if (type.HasFlag(LegacyHitObjectType.Circle))
            {
                result = CreateHit(pos, combo, comboOffset);

                if (split.Length > 5)
                {
                    readCustomSampleBanks(split[5], bankInfo);
                }
            }
            else if (type.HasFlag(LegacyHitObjectType.Slider))
            {
                PathType pathType = PathType.Catmull;
                double?  length   = null;

                string[] pointSplit = split[5].Split('|');

                int pointCount = 1;

                foreach (var t in pointSplit)
                {
                    if (t.Length > 1)
                    {
                        pointCount++;
                    }
                }

                var points = new Vector2[pointCount];

                int pointIndex = 1;

                foreach (string t in pointSplit)
                {
                    if (t.Length == 1)
                    {
                        switch (t)
                        {
                        case @"C":
                            pathType = PathType.Catmull;
                            break;

                        case @"B":
                            pathType = PathType.Bezier;
                            break;

                        case @"L":
                            pathType = PathType.Linear;
                            break;

                        case @"P":
                            pathType = PathType.PerfectCurve;
                            break;
                        }

                        continue;
                    }

                    string[] temp = t.Split(':');
                    points[pointIndex++] = new Vector2((int)Parsing.ParseDouble(temp[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(temp[1], Parsing.MAX_COORDINATE_VALUE)) - pos;
                }

                int repeatCount = Parsing.ParseInt(split[6]);

                if (repeatCount > 9000)
                {
                    throw new FormatException(@"Repeat count is way too high");
                }

                // osu-stable treated the first span of the slider as a repeat, but no repeats are happening
                repeatCount = Math.Max(0, repeatCount - 1);

                if (split.Length > 7)
                {
                    length = Math.Max(0, Parsing.ParseDouble(split[7], Parsing.MAX_COORDINATE_VALUE));
                    if (length == 0)
                    {
                        length = null;
                    }
                }

                if (split.Length > 10)
                {
                    readCustomSampleBanks(split[10], bankInfo);
                }

                // One node for each repeat + the start and end nodes
                int nodes = repeatCount + 2;

                // Populate node sample bank infos with the default hit object sample bank
                var nodeBankInfos = new List <SampleBankInfo>();
                for (int i = 0; i < nodes; i++)
                {
                    nodeBankInfos.Add(bankInfo.Clone());
                }

                // Read any per-node sample banks
                if (split.Length > 9 && split[9].Length > 0)
                {
                    string[] sets = split[9].Split('|');

                    for (int i = 0; i < nodes; i++)
                    {
                        if (i >= sets.Length)
                        {
                            break;
                        }

                        SampleBankInfo info = nodeBankInfos[i];
                        readCustomSampleBanks(sets[i], info);
                    }
                }

                // Populate node sound types with the default hit object sound type
                var nodeSoundTypes = new List <LegacyHitSoundType>();
                for (int i = 0; i < nodes; i++)
                {
                    nodeSoundTypes.Add(soundType);
                }

                // Read any per-node sound types
                if (split.Length > 8 && split[8].Length > 0)
                {
                    string[] adds = split[8].Split('|');

                    for (int i = 0; i < nodes; i++)
                    {
                        if (i >= adds.Length)
                        {
                            break;
                        }

                        int.TryParse(adds[i], out var sound);
                        nodeSoundTypes[i] = (LegacyHitSoundType)sound;
                    }
                }

                // Generate the final per-node samples
                var nodeSamples = new List <IList <HitSampleInfo> >(nodes);
                for (int i = 0; i < nodes; i++)
                {
                    nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
                }

                result = CreateSlider(pos, combo, comboOffset, convertControlPoints(points, pathType), length, repeatCount, nodeSamples);

                // The samples are played when the slider ends, which is the last node
                result.Samples = nodeSamples[^ 1];
Пример #43
0
 public EventLogQuery(string path, PathType pathType)
     : this(path, pathType, null)
 {
 }
Пример #44
0
 public static void AddPathSprite(PathType type, DungeonSet set)
 {
     dungeonSets.Add(type, set);
 }
        public override void Reset()
        {
            base.Reset();

            gameObject = null;

            duration = new FsmFloat {
                UseVariable = false
            };
            setSpeedBased = new FsmBool {
                UseVariable = false, Value = false
            };
            pathType   = PathType.Linear;
            pathMode   = PathMode.Full3D;
            resolution = new FsmInt {
                UseVariable = false, Value = 10
            };
            gizmoColor = new FsmColor {
                UseVariable = false
            };

            closePath = new FsmBool {
                UseVariable = false, Value = false
            };
            lockPosition = AxisConstraint.None;
            lockRotation = AxisConstraint.None;

            lookAt         = LookAt.nothing;
            lookAtPosition = new FsmVector3 {
                UseVariable = false, Value = Vector3.zero
            };
            lookAtTarget = new FsmGameObject {
                UseVariable = false, Value = null
            };
            lookAhead = new FsmFloat {
                UseVariable = false, Value = 0
            };

            forwardDirection = new FsmVector3 {
                UseVariable = false, Value = Vector3.forward
            };
            up = new FsmVector3 {
                UseVariable = false, Value = Vector3.up
            };

            startEvent        = null;
            finishEvent       = null;
            finishImmediately = new FsmBool {
                UseVariable = false, Value = false
            };

            startDelay = new FsmFloat {
                Value = 0
            };
            easeType = Ease.Linear;

            loops = new FsmInt {
                Value = 0
            };
            loopType = LoopType.Restart;

            autoKillOnCompletion = new FsmBool {
                Value = true
            };
            recyclable = new FsmBool {
                Value = false
            };

            updateType          = UpdateType.Normal;
            isIndependentUpdate = new FsmBool {
                Value = false
            };

            debugThis = new FsmBool {
                Value = false
            };
        }
Пример #46
0
 public EventLogReader(string path, PathType pathType)
     : this(new EventLogQuery(path, pathType), null)
 {
 }
Пример #47
0
 public PathInfo(PathType type, string path)
 {
     Type = type;
     Path = path;
 }
Пример #48
0
 public CompareTextLine(string line)
 {
     Line = line;
     Hash = line.Replace("\t", "    ").GetHashCode();
     Type = PathType.File;
 }
Пример #49
0
 public void ExportLogAndMessages(string path, PathType pathType, string query, string targetFilePath, bool tolerateQueryErrors, CultureInfo targetCultureInfo)
 {
     ExportLog(path, pathType, query, targetFilePath, tolerateQueryErrors);
     // Ignore the CultureInfo, pass 0 to use the calling thread's locale
     NativeWrapper.EvtArchiveExportedLog(this.Handle, targetFilePath, 0, 0);
 }
Пример #50
0
 internal static partial EventLogHandle EvtOpenLog(
     EventLogHandle session,
     [MarshalAs(UnmanagedType.LPWStr)] string path,
     PathType flags);
Пример #51
0
 public void ExportLog(string path, PathType pathType, string query, string targetFilePath)
 {
     this.ExportLog(path, pathType, query, targetFilePath, false);
 }
        ///<summary>Main method for starting the pathfinding process.</summary>
        ///<param name="pathStart">Starting coords</param>
        ///<param name="pathEnd">Ending coords</param>
        ///<param name="callback">Callback delegate</param>
        ///<param name="pathType">Type of path</param>
        public void FindPath(Vector3 pathStart, Vector3 pathEnd, Action <List <Node>, Vector3[], bool> callback, PathType pathType)
        {
            List <Node> nodeWaypoints = new List <Node>();              //All waypoints as Node

            Vector3[] waypoints   = new Vector3[0];                     //All waypoints as Vector3
            bool      pathSuccess = false;                              //By default the pathSuccess will be false

            Node startNode = Grid.main.NodeFromWorldPoint(pathStart);   //The starting node
            Node endNode   = Grid.main.NodeFromWorldPoint(pathEnd);     //The ending node


            if (pathType == PathType.PointToPoint)
            {
                if (CreatePath(startNode, endNode))
                {
                    List <Node> waypointNodes       = RetracePath(startNode, endNode);
                    List <Node> waypointSimpilifyed = SimplifyPath(waypointNodes);
                    waypoints = ExtractPath(waypointSimpilifyed);
                }
            }
            else if (pathType == PathType.AllPoints)
            {
                if (CreatePath(startNode, endNode))
                {
                    List <Node> waypointNodes = RetracePath(startNode, endNode);
                    waypoints = ExtractPath(waypointNodes);

                    nodeWaypoints = waypointNodes;  //Info
                }
            }
            else if (pathType == PathType.EndOfTheLine)
            {
                if (CreatePath(startNode, endNode, true))
                {
                    List <Node> waypointNodes = RetracePath(startNode, endNode);

                    //If the last node is unwalkable (Special feature)
                    if (!waypointNodes[0].isWalkable)
                    {
                        UnityEngine.Debug.Log("Last node is unwalkable!");

                        List <Node> waypointNodes2 = new List <Node>();
                        bool        delNodes       = true;

                        //Node: WAYPOINTS IS BACKWARDS RIGHT NOW
                        foreach (Node node in waypointNodes)
                        {
                            //The first iteration should always be true VVV
                            if (!node.isWalkable && delNodes)
                            {
                            }
                            else
                            {
                                delNodes = false;
                                waypointNodes2.Add(node);
                            }
                        }

                        Node startWaypointNode = waypointNodes2[waypointNodes2.Count - 1];
                        Node endWaypointNode   = waypointNodes2[0];

                        //AllPoints
                        if (CreatePath(startWaypointNode, endWaypointNode))
                        {
                            List <Node> waypointNodes3 = RetracePath(startWaypointNode, endWaypointNode);
                            waypoints = ExtractPath(waypointNodes3);
                        }
                    }
                    //If the last node is walkable (Special feature not applyed)
                    else
                    {
                        //Normal PointToPoint
                        if (CreatePath(startNode, endNode))
                        {
                            List <Node> waypointNodes2      = RetracePath(startNode, endNode);
                            List <Node> waypointSimpilifyed = SimplifyPath(waypointNodes2);
                            waypoints = ExtractPath(waypointSimpilifyed);
                        }
                    }


                    //Node: WAYPOINTS IS BACKWARDS RIGHT NOW
                    for (int i = 0; i < waypointNodes.Count; i++)
                    {
                        Node currentNode = waypointNodes[i];

                        if (!currentNode.isWalkable && i == 0)
                        {
                            //UnityEngine.Debug.Log("Last node is unwalkable");
                        }
                    }
                }
            }

            if (waypoints.Length > 0)
            {
                pathSuccess = true;
            }
            else
            {
                pathSuccess = false;
            }


            //Method message
            OnFinishedProcessingPath(new PathResult(nodeWaypoints, waypoints, pathSuccess, callback));   //Method on other page
        }
Пример #53
0
        private static void RegisterPath(string path, PathType pathType, Action action)
        {
            // Check for duplicates
            bool duplicateFound = false;

            ActionOnRecursiveMenuItems(Instance.menus, x =>
            {
                if (x.path == path)
                {
                    duplicateFound = true;
                    Debug.LogError($"The {pathType} \"{path}\" already exists.");
                    return;
                }
            });

            if (duplicateFound)
            {
                return;
            }

            // Get all items in the path
            var    split = path.Split('/');
            string menu  = split[0];
            string item  = split[split.Length - 1];

            // Determine path type
            MenuType menuType = pathType == PathType.Action ? MenuType.Action : MenuType.Window;

            if (split.Length == 1)
            {
                if (!Instance.menus.Any(x => x.name == menu))
                {
                    Instance.menus.Add(new MenuItem(menu, menuType, action));
                }

                var endMenu = Instance.menus.First(x => x.name == menu);
                if (endMenu.menuType == MenuType.Window)
                {
                    Instance.windows.Add(endMenu);
                }
            }
            else
            {
                // Find the menu
                if (!Instance.menus.Any(x => x.name == menu))
                {
                    Instance.menus.Add(new MenuItem(menu, MenuType.Menu));
                }
                var rootMenu = Instance.menus.First(x => x.name == menu);

                // Start at the root and work down adding sub menus
                MenuItem parent = rootMenu;
                for (int i = 1; i < split.Length; i++)
                {
                    // If the submenu doesn't exist, add it
                    if (!parent.menuItems.Any(x => x.name == split[i]))
                    {
                        if (i == split.Length - 1)
                        {
                            parent.menuItems.Add(new MenuItem(split[i], menuType, action, parent));

                            var endMenu = parent.menuItems.First(x => x.name == split[i]);
                            if (endMenu.menuType == MenuType.Window)
                            {
                                Instance.windows.Add(endMenu);
                            }
                        }
                        else
                        {
                            parent.menuItems.Add(new MenuItem(split[i], MenuType.SubMenu, parent));
                        }
                    }

                    // Set the new parent
                    parent = parent.menuItems.First(x => x.name == split[i]);
                }
            }
        }
 public LuzMovingPlatformPath(BinaryReader reader, uint version, NiString pathName, PathType type) : base(reader, version, pathName, type)
 {
     if (Version >= 18)
     {
         reader.ReadByte();
     }
     else if (Version >= 13)
     {
         MovingPlatformSound = new NiString(reader, true, true);
     }
 }
Пример #55
0
    public void calculatePath()
    {
        Vector2 currentDir = Utilities.FlattenedDir2D(redirectionManager.currDirReal).normalized;
        Vector2 currentPos = Utilities.FlattenedPos2D(redirectionManager.currPosReal);
        float   x1 = currentPos.x, y1 = currentPos.y; //(x1, y1) + m*(s1,t1) = (x2,y2)+n*(s2,t2)
        float   x2 = targetPos.x, y2 = targetPos.y;
        float   s1 = currentDir.x, t1 = currentDir.y; //(s1,t1)是当前方向单位向量
        float   s2 = targetDir.x, t2 = targetDir.y;
        float   D  = s1 * (-t2) + s2 * t1;            //用cramer法则,用行列式算m,n
        float   D1 = (x2 - x1) * (-t2) + s2 * (y2 - y1);
        float   D2 = s1 * (y2 - y1) - t1 * (x2 - x1);
        float   m  = D1 / D;
        float   n  = D2 / D;



        if (Vector2.Dot(currentDir, targetDir) > 0 && m > 0 && n < 0)                                //a,b情况
        {
            Vector2 targetOrthoDir = new Vector2(-targetDir.y, targetDir.x).normalized;              //目标点的法向量,方向可能有两个
            targetOrthoDir = Mathf.Sign(Vector2.Dot(targetOrthoDir, currentDir)) * targetOrthoDir;   //确定目标点的法向量方向
            Vector2 currentOrthoDir = new Vector2(-currentDir.y, currentDir.x).normalized;           //当前方向的法向量
            currentOrthoDir = Mathf.Sign(Vector2.Dot(currentOrthoDir, targetDir)) * currentOrthoDir; //法向量有两个,选对的那个
            float u1 = currentOrthoDir.x, v1 = currentOrthoDir.y;                                    //(u1,v1)为(s1,t1)法向量
            float u2 = targetOrthoDir.x, v2 = targetOrthoDir.y;                                      //(u2,v2)为(s2,t2)法向量
            //(x2-x1-u1*r,y2-y1-v1*r)·(u2,v2) = r
            r = ((x2 - x1) * u2 + (y2 - y1) * v2) / (1 + u1 * u2 + v1 * v2);                         //求出半径
            Vector2 tangentPos = currentPos + (currentOrthoDir * (float)r) + r * targetOrthoDir;     //为a中大圆弧切点的位置
            if ((targetPos - tangentPos).x / targetDir.x > 0)                                        //a情况
            {
                pathType  = PathType.a;
                middlePos = tangentPos;
            }
            else//b情况
            {
                pathType = PathType.b;
                //(x1,y1)+p(s1,t1)+r(u1,v1)+r(u2,v2)=(x2,y2)可解出p,r
                float d  = s1 * (v1 + v2) - t1 * (u1 + u2);//利用cramer法则,算行列式
                float d1 = (x2 - x1) * (v1 + v2) - (y2 - y1) * (u1 + u2);
                float d2 = s1 * (y2 - y1) - t1 * (x2 - x1);
                float p  = d1 / d;
                r         = d2 / d;
                middlePos = currentPos + p * currentDir;
            }
        }
        else if (m < 0 && n < 0) //c情况
        {
            //假设两个圆弧半径相等
            pathType = PathType.c;
            Vector2 targetOrthoDir = new Vector2(-targetDir.y, targetDir.x).normalized;              //目标点的法向量,方向可能有两个
            targetOrthoDir = Mathf.Sign(Vector2.Dot(targetOrthoDir, currentDir)) * targetOrthoDir;   //确定目标点的法向量方向
            Vector2 currentOrthoDir = new Vector2(-currentDir.y, currentDir.x).normalized;           //当前方向的法向量
            currentOrthoDir = Mathf.Sign(Vector2.Dot(currentOrthoDir, targetDir)) * currentOrthoDir; //法向量有两个,选对的那个
            float u1 = currentOrthoDir.x, v1 = currentOrthoDir.y;                                    //(u1,v1)为(s1,t1)法向量
            float u2 = targetOrthoDir.x, v2 = targetOrthoDir.y;                                      //(u2,v2)为(s2,t2)法向量
            //|(x2+ru2-x1-ru1,y2+rv2-y1-rv1)|=2r  假设两个圆弧半径相等
            float a = Mathf.Pow((u2 - u1), 2) + Mathf.Pow(v2 - v1, 2) - 4;
            float b = 2 * (x2 - x1) * (u2 - u1) + 2 * (y2 - y1) * (v2 - v1);
            float c = Mathf.Pow((x2 - x1), 2) + Mathf.Pow(y2 - y1, 2);
            r         = solveEquation(a, b, c);
            middlePos = (currentPos + r * currentOrthoDir + targetPos + targetOrthoDir * r) / 2;
        }
        else//d情况
        {
            pathType = PathType.d;
            Vector2 targetOrthoDir = new Vector2(-targetDir.y, targetDir.x).normalized;               //目标点的法单位向量,方向可能有两个
            targetOrthoDir = -Mathf.Sign(Vector2.Dot(targetOrthoDir, currentDir)) * targetOrthoDir;   //确定目标点的法向量方向
            Vector2 currentOrthoDir = new Vector2(-currentDir.y, currentDir.x).normalized;            //当前方向的法向量
            currentOrthoDir = -Mathf.Sign(Vector2.Dot(currentOrthoDir, targetDir)) * currentOrthoDir; //法向量有两个,选对的那个
            float u1 = currentOrthoDir.x, v1 = currentOrthoDir.y;                                     //(u1,v1)为(s1,t1)法向量
            float u2 = targetOrthoDir.x, v2 = targetOrthoDir.y;                                       //(u2,v2)为(s2,t2)法向量
            //(x1,y1)+p(s1,t1)+r(u1,v1)+r(u2,v2)=(x2,y2)可解出p,r
            float d  = s1 * (v1 + v2) - t1 * (u1 + u2);                                               //利用cramer法则,算行列式
            float d1 = (x2 - x1) * (v1 + v2) - (y2 - y1) * (u1 + u2);
            float d2 = s1 * (y2 - y1) - t1 * (x2 - x1);
            float p  = d1 / d;
            r         = d2 / d;
            middlePos = currentPos + p * currentDir;
        }
        //不考虑e情况,因为可以把e情况当a情况考虑,虽然可能会有圆弧的曲率过大,但是这篇论文算法本身就不能保证所有路径曲率在max范围内
    }
Пример #56
0
 /// <summary>
 /// Initializes a new <see cref="ConfigurationOptionAttribute"/> that represents a path.
 /// Represents one option in an emulator configuration inside a configuration section.
 /// Typically configuration options must be a double, bool, integer or an enum value in order to be safe,
 /// type information may be lost when serializing into a wire format.
 /// </summary>
 /// <param name="optionName">The name of the option</param>
 /// <param name="default">The default value of the option. Note that only strings, enums and primitive types are supported.</param>
 /// <param name="pathType">The type of the path this points to.</param>
 public ConfigurationOptionAttribute(string optionName, string @default, PathType pathType)
     : this(optionName, @default, typeof(string))
 {
     this.PathType = pathType;
 }
Пример #57
0
 public static void AddPathSprite(PathType type, Sprite[] sprites)
 {
     pathSprites.Add(type, sprites);
 }
Пример #58
0
 /// <summary>
 ///  Constructs a path
 /// </summary>
 /// <param name="path"></param>
 /// <param name="type"></param>
 public FilesystemDynamicPath(string path, PathType type)
 {
     Platform.CheckForEmptyString(path, "path");
     _path = path;
     _type = type;
 }
Пример #59
0
    static int BezierMove(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(RepeatType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float                 arg2      = (float)LuaDLL.lua_tonumber(L, 3);
                InterpType            arg3      = (InterpType)ToLua.ToObject(L, 4);
                RepeatType            arg4      = (RepeatType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2     = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3      = (float)LuaDLL.lua_tonumber(L, 4);
                InterpType            arg4      = (InterpType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                float        arg4           = (float)LuaDLL.lua_tonumber(L, 5);
                InterpType   arg5           = (InterpType)ToLua.ToObject(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(InterpType), typeof(float), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float        arg2           = (float)LuaDLL.lua_tonumber(L, 3);
                RepeatType   arg3           = (RepeatType)ToLua.ToObject(L, 4);
                InterpType   arg4           = (InterpType)ToLua.ToObject(L, 5);
                float        arg5           = (float)LuaDLL.lua_tonumber(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(RepeatType), typeof(int), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0      = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1      = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2      = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3       = (float)LuaDLL.lua_tonumber(L, 4);
                float                 arg4       = (float)LuaDLL.lua_tonumber(L, 5);
                RepeatType            arg5       = (RepeatType)ToLua.ToObject(L, 6);
                int                   arg6       = (int)LuaDLL.lua_tonumber(L, 7);
                InterpType            arg7       = (InterpType)ToLua.ToObject(L, 8);
                bool                  arg8       = LuaDLL.lua_toboolean(L, 9);
                PathType              arg9       = (PathType)ToLua.ToObject(L, 10);
                UnityEngine.Vector3[] arg10      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 11);
                AnimCallBack          arg11      = null;
                LuaTypes              funcType12 = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(int), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                RepeatType   arg4           = (RepeatType)ToLua.ToObject(L, 5);
                int          arg5           = (int)LuaDLL.lua_tonumber(L, 6);
                float        arg6           = (float)LuaDLL.lua_tonumber(L, 7);
                InterpType   arg7           = (InterpType)ToLua.ToObject(L, 8);
                bool         arg8           = LuaDLL.lua_toboolean(L, 9);
                PathType     arg9           = (PathType)ToLua.ToObject(L, 10);
                float[]      arg10          = ToLua.CheckNumberArray <float>(L, 11);
                AnimCallBack arg11          = null;
                LuaTypes     funcType12     = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: AnimSystem.BezierMove"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #60
0
 public DoPathDelete(string path, PathType pathtype)
 {
     this.Path     = path;
     this.PathType = pathtype;
 }