public PerformInspectionViewModel() : base() { //SelectedInpection = new InspectionViewModel(Context.Inspections.FirstOrDefault()); PopulateQuestions(); SaveChanges = new AuthCommand(Save); AddMedia = new AuthCommand(AddFile); SaveInspection = new RelayCommand(Save); UploadingVisibility = "Hidden"; FileNames = new ObservableCollection<string>(); if (CheckInternetConnection()) { InitAzure(); ConnectionImage = "Resources/Generic/Online.png"; } else ConnectionImage = "Resources/Generic/Offline.png"; RaisePropertyChanged("ConnectionImage"); }
public UsersViewModel() : base() { Populate(); AddUserCommand = new RelayCommand(AddUserTab); DeleteUserCommand = new RelayCommand(DeleteUserTab); SaveUserCommand = new RelayCommand(SaveUser); ChangeToAvailable = new RelayCommand(OnChangeToAvailable); ChangeToUsed = new RelayCommand(OnChangeToUsed); StopAddingUser = new AuthCommand(ToggleLightBoxOff); }
public ServerAuthProof(BinaryReader reader) : this() { command = AuthCommand.LOGON_PROOF; error = (AuthResult)reader.ReadByte(); if (error != AuthResult.SUCCESS) { reader.ReadUInt16(); return; } M2 = reader.ReadBytes(20); unk1 = reader.ReadUInt32(); unk2 = reader.ReadUInt32(); unk3 = reader.ReadUInt16(); }
public InspectionsViewModel() : base() { PopulateCompanies(); PopulateUsers(); Populate(); ChangeToAddMode = new AuthCommand(ChangeVisibility); SaveInspection = new AuthCommand(SaveCurrentInspection); DeleteInspection = new AuthCommand(DeleteCurrentInspection); AddInspection = new AuthCommand(AddNewInspection); StopAddingInspection = new AuthCommand(StopAddInspection); Visibility = "Hidden"; }
public ServerAuthChallenge(BinaryReader reader) : this() { command = AuthCommand.LOGON_CHALLENGE; unk2 = reader.ReadByte(); error = (AuthResult)reader.ReadByte(); if (error != AuthResult.SUCCESS) return; B = reader.ReadBytes(32); gLen = reader.ReadByte(); g = reader.ReadBytes(1); nLen = reader.ReadByte(); N = reader.ReadBytes(32); salt = reader.ReadBytes(32); unk3 = reader.ReadBytes(16); securityFlags = reader.ReadByte(); }
/// <summary> /// Visit an AUTH command. /// </summary> /// <param name="command">The command that is being visited.</param> protected override void Visit(AuthCommand command) { _output.WriteLine("AUTH: Method={0}, Parameter={1}", command.Method, command.Parameter); }
private static void Main(string[] args) { var record = new Command("rec") { new Argument <FileInfo>("file") { Description = "The filename to save the record" }, new Option(new [] { "--command", "-c" }, "The command to record, default to be powershell.exe") { Argument = new Argument <string>() } }; record.Description = "Record and save a session"; record.Handler = CommandHandler.Create((FileInfo file, string command) => { var recordCmd = new RecordCommand(new RecordArgs { Filename = file.FullName, Command = command }); recordCmd.Execute(); }); var play = new Command("play") { new Argument <FileInfo>("file") { Description = "The record session" } }; play.Description = "Play a recorded session"; play.Handler = CommandHandler.Create((FileInfo file) => { var playCommand = new PlayCommand(new PlayArgs { Filename = file.FullName, EnableAnsiEscape = true }); playCommand.Execute(); }); var auth = new Command("auth") { Handler = CommandHandler.Create(() => { var authCommand = new AuthCommand(); authCommand.Execute(); }), Description = "Auth with asciinema.org" }; var upload = new Command("upload") { new Argument <FileInfo>("file") { Description = "The file to be uploaded" } }; upload.Description = "Upload a session to ascinema.org"; upload.Handler = CommandHandler.Create((FileInfo file) => { var uploadCommand = new UploadCommand(file.FullName); uploadCommand.Execute(); }); var rooCommand = new RootCommand { record, play, auth, upload }; rooCommand.Description = "Record, Play and Share your PowerShell Session."; rooCommand.InvokeAsync(args).Wait(); }
protected async Task SendAuthCommand(AuthCommand command) { command.SetUserId(User.Identity.GetId()); await Mediator.Send(command); }
public DataCleanPageViewModel() { SaveCmd = new AuthCommand(SaveSysConfigs); InitConfigs(); }
internal static void Update() { if (State == ConnectionState.CONNECTED) { lock (userDatasLock) { // Check if user changed string uuid = APIUser.CurrentUser == null ? "" : APIUser.CurrentUser.id ?? ""; string displayName = APIUser.CurrentUser == null ? "" : APIUser.CurrentUser.displayName ?? ""; string authToken = ApiCredentials.GetAuthToken() ?? ""; Credentials c = ApiCredentials.GetWebCredentials() as Credentials; if (!uuid.Equals(userUuid)) { VRCModLogger.Log("new UUID: " + uuid); DiscordManager.UserChanged(displayName); if (!uuid.Equals("") && "".Equals(authToken)) { string password = typeof(ApiCredentials).GetField("password", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null) as string; authToken = Convert.ToBase64String(Encoding.UTF8.GetBytes(ApiCredentials.GetUsername() + ":" + password)); } if (uuid.Equals("")) { userUuid = uuid; VRCModLogger.Log("Resetting data"); ResetDatas(); VRCModLogger.Log("Logging out"); LogoutCommand logoutCommand = CommandManager.CreateInstance("LOGOUT", client) as LogoutCommand; logoutCommand.LogOut(); VRCModLogger.Log("Done"); } else { userUuid = uuid; VRCModLogger.Log("Getting current instanceId"); if (RoomManager.currentRoom != null && RoomManager.currentRoom.id != null && RoomManager.currentRoom.currentInstanceIdOnly != null) { userInstanceId = RoomManager.currentRoom.id + ":" + RoomManager.currentRoom.currentInstanceIdOnly; } VRCModLogger.Log("Getting current modList"); modlist = ModDesc.GetAllMods(); VRCModLogger.Log("Getting current environment"); ApiServerEnvironment env = VRCApplicationSetup._instance.ServerEnvironment; string stringEnv = ""; if (env == ApiServerEnvironment.Dev) { stringEnv = "dev"; } if (env == ApiServerEnvironment.Beta) { stringEnv = "beta"; } if (env == ApiServerEnvironment.Release) { stringEnv = "release"; } VRCModLogger.Log("Env: " + env); VRCModLogger.Log("Authenticating"); AuthCommand authCommand = CommandManager.CreateInstance("AUTH", client) as AuthCommand; authCommand.Auth(authToken, stringEnv, userInstanceId, modlist); VRCModLogger.Log("Done"); } } if (IsAuthenticated) { string roomId = ""; if (RoomManager.currentRoom != null && RoomManager.currentRoom.id != null && RoomManager.currentRoom.currentInstanceIdOnly != null) { roomId = RoomManager.currentRoom.id + ":" + RoomManager.currentRoom.currentInstanceIdOnly; } if (!userInstanceId.Equals(roomId)) { VRCModLogger.Log("Updating instance id"); userInstanceId = roomId; if (roomId != "") { DiscordManager.RoomChanged(RoomManager.currentRoom.name, roomId, RoomManager.currentRoom.currentInstanceAccess, RoomManager.currentRoom.capacity); } else { DiscordManager.RoomChanged("", roomId, ApiWorldInstance.AccessType.InviteOnly, 0); } ((InstanceChangedCommand)CommandManager.CreateInstance("INSTANCECHANGED", client)).Send(userInstanceId); VRCModLogger.Log("Done"); } } } } }