Example #1
0
        private void Watcher_Changed(object sender, FileSystemEventArgs e)
        {
            if (e.ChangeType == WatcherChangeTypes.Changed)
            {
                try
                {
                    LastCommand = File.ReadAllText(e.FullPath);
                    switch (LastCommand.ToLower().GetValue())
                    {
                    case CONFIG_CLOSE_COMMAND1:
                    case CONFIG_CLOSE_COMMAND2:
                    case CONFIG_CLOSE_COMMAND3:
                    case CONFIG_CLOSE_COMMAND4:
                    case CONFIG_CLOSE_COMMAND5:
                    case CONFIG_CLOSE_COMMAND6:
                    case CONFIG_CLOSE_COMMAND7:
                        Close();
                        break;

                    case CONFIG_UP_COMMAND:
                        ComeOnUp();
                        break;

                    default:
                        // it means the command is unknown to us.
                        Debug.Print(UnknownCommandError +
                                    LastCommand.GetValue());
                        break;
                    }
                }
                catch (Exception _e)
                {
                    // it means there was an error here ..
                    // so, never mind it and just continue the game :|
                    Debug.Print(_e.Message);
                    return;
                }
            }
        }