Example #1
0
 bool ContainsKey(ref PathKey p)
 {
     if (p.start == p.end)
     {
         return(false);
     }
     return(paths.ContainsKey(p));
 }
Example #2
0
        void ActivateNextPath()
        {
            if (currentPaths.Count == 0)
            {
                return;
            }

            PathKey key = currentPaths.Peek();

            paths [key].UpdateStatus(Path.Mode.Play);
        }
Example #3
0
        bool CompilePath(string [] points, FlightMode mode, out Queue <PathKey> currentPaths)
        {
            currentPaths = new Queue <PathKey>();
            if (points.Length < 3)
            {
                return(false);
            }
            for (int i = 2; i < points.Length; i++)
            {
                PathKey p = new PathKey(points [i - 1], points [i]);
                if (ContainsKey(ref p))
                {
                    currentPaths.Enqueue(p);
                }
                else
                {
                    return(false);
                }
            }

            if (mode == FlightMode.Circle)
            {
                PathKey p = new PathKey(points [points.Length - 1], points [1]);
                if (ContainsKey(ref p))
                {
                    currentPaths.Enqueue(p);
                }
                else
                {
                    return(false);
                }
            }

            if (mode == FlightMode.Patrol)
            {
                for (int i = points.Length - 1; i >= 1; i++)
                {
                    PathKey p = new PathKey(points [i], points [i - 1]);
                    if (ContainsKey(ref p))
                    {
                        currentPaths.Enqueue(p);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #4
0
        void CheckPaths()
        {
            PathKey key = currentPaths.Peek();

            if (paths [key].Status == Path.Mode.None)
            {
                thrust.Reset();
                gyros.Reset();

                currentPaths.Dequeue();
                if (mode != FlightMode.OneWay)
                {
                    currentPaths.Enqueue(key);
                }
                ActivateNextPath();
            }
        }
        static DeveelDbConnectionStringBuilder()
        {
            defaults = new Dictionary <string, object>();
            defaults.Add(HostKey, DefaultHost);
            defaults.Add(PortKey, DefaultPort);
            defaults.Add(DatabaseKey, DefaultDatabase);
            defaults.Add(UserNameKey, DefaultUserName);
            defaults.Add(PasswordKey, DefaultPassword);
            defaults.Add(SchemaKey, DefaultSchema);
            defaults.Add(PathKey, DefaultPath);
            defaults.Add(CreateKey, DefaultCreate);
            defaults.Add(BootOrCreateKey, DefaultBootOrCreate);
            defaults.Add(ParameterStyleKey, DefaultParameterStyle);
            defaults.Add(VerboseColumnNamesKey, DefaultVerboseColumnName);
            defaults.Add(PersistSecurityInfoKey, DefaultPersistSecurityInfo);
            defaults.Add(RowCacheSizeKey, DefaultRowCacheSize);
            defaults.Add(MaxCacheSizeKey, DefaultMaxCacheSize);
            defaults.Add(FetchSizeKey, DefaultFetchSize);
            defaults.Add(MaxFetchSizeKey, DefaultMaxFetchSize);
            defaults.Add(AutoCommitKey, DefaultAutoCommit);
            defaults.Add(QueryTimeoutKey, DefaultQueryTimeout);

            keymaps = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);
            keymaps[HostKey.ToUpper()]     = HostKey;
            keymaps["ADDRESS"]             = HostKey;
            keymaps["SERVER"]              = HostKey;
            keymaps[PortKey.ToUpper()]     = PortKey;
            keymaps[DatabaseKey.ToUpper()] = DatabaseKey;
            keymaps["CATALOG"]             = DatabaseKey;
            keymaps["INITIAL CATALOG"]     = DatabaseKey;
            keymaps["DB"] = DatabaseKey;
            keymaps[SchemaKey.ToUpper()]   = SchemaKey;
            keymaps["DEFAULT SCHEMA"]      = SchemaKey;
            keymaps[PathKey.ToUpper()]     = PathKey;
            keymaps["DATA PATH"]           = PathKey;
            keymaps["DATABASE PATH"]       = PathKey;
            keymaps["DATAPATH"]            = PathKey;
            keymaps["DATABASEPATH"]        = PathKey;
            keymaps[CreateKey.ToUpper()]   = CreateKey;
            keymaps[BootOrCreateKey]       = BootOrCreateKey;
            keymaps["BOOT OR CREATE"]      = BootOrCreateKey;
            keymaps["CREATE OR BOOT"]      = BootOrCreateKey;
            keymaps["CREATEORBOOT"]        = BootOrCreateKey;
            keymaps[CreateKey.ToUpper()]   = CreateKey;
            keymaps["CREATE DATABASE"]     = CreateKey;
            keymaps[UserNameKey.ToUpper()] = UserNameKey;
            keymaps["USER"]                             = UserNameKey;
            keymaps["USER NAME"]                        = UserNameKey;
            keymaps["USER ID"]                          = UserNameKey;
            keymaps["USERID"]                           = UserNameKey;
            keymaps["UID"]                              = UserNameKey;
            keymaps[PasswordKey.ToUpper()]              = PasswordKey;
            keymaps["PASS"]                             = PasswordKey;
            keymaps["PWD"]                              = PasswordKey;
            keymaps["SECRET"]                           = PasswordKey;
            keymaps[ParameterStyleKey.ToUpper()]        = ParameterStyleKey;
            keymaps["PARAMSTYLE"]                       = ParameterStyleKey;
            keymaps["PARAMETER STYLE"]                  = ParameterStyleKey;
            keymaps["USEPARMAMETER"]                    = ParameterStyleKey;
            keymaps["USE PARAMETER"]                    = ParameterStyleKey;
            keymaps[VerboseColumnNamesKey.ToUpper()]    = VerboseColumnNamesKey;
            keymaps["VERBOSE COLUMNS"]                  = VerboseColumnNamesKey;
            keymaps["VERBOSE COLUMN NAMES"]             = VerboseColumnNamesKey;
            keymaps["VERBOSECOLUMNS"]                   = VerboseColumnNamesKey;
            keymaps["COLUMNS VERBOSE"]                  = VerboseColumnNamesKey;
            keymaps[PersistSecurityInfoKey.ToUpper()]   = PersistSecurityInfoKey;
            keymaps["PERSIST SECURITY INFO"]            = PersistSecurityInfoKey;
            keymaps[RowCacheSizeKey.ToUpper()]          = RowCacheSizeKey;
            keymaps["ROW CACHE SIZE"]                   = RowCacheSizeKey;
            keymaps["CACHE SIZE"]                       = RowCacheSizeKey;
            keymaps[MaxCacheSizeKey.ToUpper()]          = MaxCacheSizeKey;
            keymaps["MAX CACHE SIZE"]                   = MaxCacheSizeKey;
            keymaps["MAX CACHE"]                        = MaxCacheSizeKey;
            keymaps[QueryTimeoutKey.ToUpper()]          = QueryTimeoutKey;
            keymaps["QUERY TIMEOUT"]                    = QueryTimeoutKey;
            keymaps[IgnoreIdentifiersCaseKey.ToUpper()] = IgnoreIdentifiersCaseKey;
            keymaps["IGNORE CASE"]                      = IgnoreIdentifiersCaseKey;
            keymaps["IGNORE ID CASE"]                   = IgnoreIdentifiersCaseKey;
            keymaps["ID CASE IGNORED"]                  = IgnoreIdentifiersCaseKey;
            keymaps[StrictGetValueKey.ToUpper()]        = StrictGetValueKey;
            keymaps["STRICT"]                           = StrictGetValueKey;
            keymaps["STRICT GETVALUE"]                  = StrictGetValueKey;
            keymaps["STRICT VALUE"]                     = StrictGetValueKey;
            keymaps["STRICTVALUE"]                      = StrictGetValueKey;
            keymaps[FetchSizeKey.ToUpper()]             = FetchSizeKey;
            keymaps["FETCH SIZE"]                       = FetchSizeKey;
            keymaps["ROW COUNT"]                        = FetchSizeKey;
            keymaps["ROWCOUNT"]                         = FetchSizeKey;
            keymaps[MaxFetchSizeKey.ToUpper()]          = MaxFetchSizeKey;
            keymaps["MAX FETCH SIZE"]                   = MaxFetchSizeKey;
            keymaps["MAXFETCHSIZE"]                     = MaxFetchSizeKey;
            keymaps["MAX ROW COUNT"]                    = MaxFetchSizeKey;
            keymaps["MAX ROWCOUNT"]                     = MaxFetchSizeKey;
            keymaps["MAXROWCOUNT"]                      = MaxFetchSizeKey;
            keymaps[AutoCommitKey.ToUpper()]            = AutoCommitKey;
            keymaps["AUTOCOMMIT"]                       = AutoCommitKey;
            keymaps["AUTO-COMMIT"]                      = AutoCommitKey;
            keymaps["AUTO_COMMIT"]                      = AutoCommitKey;
            keymaps["AUTO COMMIT"]                      = AutoCommitKey;
            keymaps["COMMIT AUTO"]                      = AutoCommitKey;
            keymaps["COMMIT_AUTO"]                      = AutoCommitKey;
            keymaps["COMMITAUTO"]                       = AutoCommitKey;
            keymaps["COMMIT-AUTO"]                      = AutoCommitKey;
            keymaps["COMMIT"]                           = AutoCommitKey;
            keymaps["ENLIST"]                           = EnlistKey;
        }
Example #6
0
 /// <summary>
 /// Set a directory path setting
 /// </summary>
 /// <param name="setting">The setting</param>
 /// <param name="value">The path</param>
 public static void SetDirectoryPath(PathKey setting, string value) => Settings.ToolPaths.SetDirectoryPath(setting, value);
Example #7
0
        void Command(string command)
        {
            string [] args = command.Split(';');

            switch (args [0])
            {
            case ("halt"):
                Runtime.UpdateFrequency = UpdateFrequency.None;
                break;

            case ("record"):     // path;start;end
                if (args.Length == 3 && args [1] != args [2])
                {
                    Stop();
                    PathKey p    = new PathKey(args [1], args [2]);
                    Path    path = new Path();
                    paths [p] = path;
                    path.UpdateStatus(Path.Mode.Recording);
                    recordingPath = path;
                }
                break;

            case ("stop"):
                Stop();
                break;

            case ("oneway"):     // oneway;id1;id2;... | Navigates to all of the points in one direction, then stops.
                if (args.Length > 2)
                {
                    Queue <PathKey> newCurrentPaths;
                    if (CompilePath(args, FlightMode.OneWay, out newCurrentPaths))
                    {
                        currentPaths = newCurrentPaths;
                    }
                    else
                    {
                        return;
                    }
                    ActivateNextPath();
                    mode = FlightMode.OneWay;
                }
                break;

            case ("patrol"):     // patrol;id1;id2;... | Navigates to all of the points in one direction, then in the reverse direction, and starts over.
                if (args.Length > 2)
                {
                    Queue <PathKey> newCurrentPaths;
                    if (CompilePath(args, FlightMode.Patrol, out newCurrentPaths))
                    {
                        currentPaths = newCurrentPaths;
                    }
                    else
                    {
                        return;
                    }
                    ActivateNextPath();
                    mode = FlightMode.Patrol;
                }
                break;

            case ("circle"):     // circle;id1;id2;... | Navigates to all of the points in one direction, then back to the first point, and starts over.
                if (args.Length > 2)
                {
                    Queue <PathKey> newCurrentPaths;
                    if (CompilePath(args, FlightMode.Circle, out newCurrentPaths))
                    {
                        currentPaths = newCurrentPaths;
                    }
                    else
                    {
                        return;
                    }
                    ActivateNextPath();
                    mode = FlightMode.Circle;
                }
                break;
            }
        }
Example #8
0
 public static string GetServicePath(PathKey k)
 {
     return(typeof(AdfsServicePathPairs).GetField(k.ToString()).GetRawConstantValue().ToString());
 }