private static KeyValuePair <string, IImmutableList <string> >[][] VariableIndexedCollectionsOfSets([NotNull] HeaderArrayFile arrayFile) { SetInformation[] setInformation = BuildAllSets(arrayFile).ToArray(); int[] pointerIntoVcsn = arrayFile["VCSP"].As <int>().Values.ToArray(); int[] setsPerVariable = arrayFile["VCNI"].As <int>().Values.ToArray(); int[] setPositions = arrayFile["VCSN"].As <int>().Values.ToArray(); KeyValuePair <string, IImmutableList <string> >[][] arraySetInfo = new KeyValuePair <string, IImmutableList <string> > [pointerIntoVcsn.Length][]; for (int i = 0; i < pointerIntoVcsn.Length; i++) { arraySetInfo[i] = new KeyValuePair <string, IImmutableList <string> > [setsPerVariable[i]]; int pointer = pointerIntoVcsn[i] - 1; for (int j = 0; j < arraySetInfo[i].Length; j++) { SetInformation set = setInformation[setPositions[pointer + j] - 1]; arraySetInfo[i][j] = new KeyValuePair <string, IImmutableList <string> >(set.Name, set.Elements); } } return(arraySetInfo); }
private static SetInformation[] BuildAllSets([NotNull] HeaderArrayFile arrayFile) { int[] sizes = arrayFile["SSZ "].As <int>().Values.ToArray(); char[] intertemporal = arrayFile["STTP"].As <char>().Values.ToArray(); string[] names = arrayFile["STNM"].As <string>().Values.ToArray(); string[] descriptions = arrayFile["STLB"].As <string>().Values.ToArray(); string[] elements = arrayFile["STEL"].As <string>().Values.ToArray(); SetInformation[] result = new SetInformation[names.Length]; int counter = 0; for (int i = 0; i < names.Length; i++) { result[i] = new SetInformation( names[i], descriptions[i], intertemporal[i] == 'i', sizes[i], new ArraySegment <string>(elements, counter, sizes[i])); counter += sizes[i]; } return(result); }
public void SetFileInformation(NtHandle handle, SetInformation information) { int maxOutputLength = 4096; Transaction2SetFileInformationRequest subcommand = new Transaction2SetFileInformationRequest { FID = ((Smb1Handle)handle).FID, }; subcommand.SetInformation(information); Transaction2Request request = new Transaction2Request { Setup = subcommand.GetSetup(), TransParameters = subcommand.GetParameters(m_client.Unicode), TransData = subcommand.GetData(m_client.Unicode) }; request.TotalDataCount = (ushort)request.TransData.Length; request.TotalParameterCount = (ushort)request.TransParameters.Length; request.MaxParameterCount = Transaction2SetFileInformationResponse.ParametersLength; request.MaxDataCount = (ushort)maxOutputLength; TrySendMessage(request); SMB1Message reply = m_client.WaitForMessage(CommandName.SMB_COM_TRANSACTION2); reply.IsSuccessElseThrow(); }
public NTStatus SetFileInformation(object handle, SetInformation information) { int maxOutputLength = 4096; Transaction2SetFileInformationRequest subcommand = new Transaction2SetFileInformationRequest(); subcommand.FID = (ushort)handle; subcommand.SetInformation(information); Transaction2Request request = new Transaction2Request(); request.Setup = subcommand.GetSetup(); request.TransParameters = subcommand.GetParameters(m_client.Unicode); request.TransData = subcommand.GetData(m_client.Unicode); request.TotalDataCount = (ushort)request.TransData.Length; request.TotalParameterCount = (ushort)request.TransParameters.Length; request.MaxParameterCount = Transaction2SetFileInformationResponse.ParametersLength; request.MaxDataCount = (ushort)maxOutputLength; TrySendMessage(request); SMB1Message reply = m_client.WaitForMessage(CommandName.SMB_COM_TRANSACTION2); if (reply != null) { return(reply.Header.Status); } return(NTStatus.STATUS_INVALID_SMB); }
void OpenUI() { //Enable/disable info ui and rotate buttons GetComponent <ObjectLoading>().LoadObjects(); GetComponent <ObjectLoading>().DisableObjects(); setInfo = infoCan.GetComponent <SetInformation>(); setInfo.SetCurrentInfo(num); setInfo.SetText(); }
internal static Transaction2SetFileInformationResponse GetSubcommandResponse(SMB1Header header, Transaction2SetFileInformationRequest subcommand, ISMBShare share, SMB1ConnectionState state) { SMB1Session session = state.GetSession(header.UID); OpenFileObject openFile = session.GetOpenFileObject(subcommand.FID); if (openFile == null) { header.Status = NTStatus.STATUS_INVALID_HANDLE; return(null); } if (share is FileSystemShare) { if (!((FileSystemShare)share).HasWriteAccess(session.SecurityContext, openFile.Path)) { state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. User '{2}' was denied access.", share.Name, openFile.Path, session.UserName); header.Status = NTStatus.STATUS_ACCESS_DENIED; return(null); } } SetInformation information; try { information = SetInformation.GetSetInformation(subcommand.InformationBytes, subcommand.InformationLevel); } catch (UnsupportedInformationLevelException) { state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: STATUS_OS2_INVALID_LEVEL", share.Name, openFile.Path, subcommand.InformationLevel); header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL; return(null); } catch (Exception) { state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: STATUS_INVALID_PARAMETER", share.Name, openFile.Path, subcommand.InformationLevel); header.Status = NTStatus.STATUS_INVALID_PARAMETER; return(null); } NTStatus status = SMB1FileStoreHelper.SetFileInformation(share.FileStore, openFile.Handle, information); if (status != NTStatus.STATUS_SUCCESS) { state.LogToServer(Severity.Verbose, "SetFileInformation on '{0}{1}' failed. Information level: {2}, NTStatus: {3}", share.Name, openFile.Path, subcommand.InformationLevel, status); header.Status = status; return(null); } state.LogToServer(Severity.Information, "SetFileInformation on '{0}{1}' succeeded. Information level: {2}", share.Name, openFile.Path, subcommand.InformationLevel); Transaction2SetFileInformationResponse response = new Transaction2SetFileInformationResponse(); return(response); }
public Window_NewWorkoutLine(int NoOfSets, int workoutLineId) { InitializeComponent(); currentWorkoutLineId = workoutLineId; for (int x = 1; x <= NoOfSets; x++) { SetInformation setInformation = new SetInformation(x); InformationValueObject vo = new InformationValueObject(); setInformation.DataContext = _vo; _valueObjects.Add(vo); StackPanel_Main.Children.Add(setInformation); } }
static User Registration() { User user = new User { Login = SetInformation.SetLogin(), Password = SetInformation.SetPassword(), Email = SetInformation.SetEmail(), Phone = SetInformation.SetPhoneNumber() }; ISender sender = GetSeneder.GetSender(Sender.TelegramSender); sender.Open(); sender.Send("Напишите боту 'Get code' чтобы плучить код"); CheckCode(); sender.Close(); return(user); }
static void Main(string[] args) { bool isFinish = false; do { switch (Menu.ActionMenu()) { case Actions.Add: switch (Menu.AddMenu()) { case Services.Models.Band: ModelCreator.CreateAndSaveBand(); break; case Services.Models.Music: do { try { var musicsBand = SelectInformation.SelectBandByIndex(Menu.BandSelectMenu()); ModelCreator.CreateAndSaveMusic(musicsBand.Id); break; } catch (ArgumentOutOfRangeException) { Console.WriteLine("Добвление новой группы:"); ModelCreator.CreateAndSaveBand(); } catch (IndexOutOfRangeException) { Console.WriteLine("Такая группа уже существует"); } } while (true); break; default: Console.WriteLine("Нет такого объекта"); break; } break; case Actions.View: switch (Menu.WhatShow()) { case Services.Models.Band: Menu.ShowAllBands(); break; case Services.Models.Music: switch (Menu.MusicShowChoseMenu()) { case Constants.SHOW_ALL: Menu.ShowAllMusics(); break; case Constants.SHOW_BY_NAME: Band musicBand = new Band(); string musicName = SetInformation.SetMusicName(); var music = SelectInformation.SelectMusicsByName(musicName, musicBand); Menu.ShowMusics(new List <Music>() { music }); break; case Constants.SHOW_BY_BAND: var bands = SelectInformation.SelectAllBand(); var band = bands[Menu.BandSelectMenu()]; var selectedMusics = SelectInformation.SelectMusicsByBandName(band.Name); Menu.ShowMusics(selectedMusics); break; case Constants.SHOW_BY_RATING: switch (Menu.ChoseSortTypeMenu()) { case SortType.Ascending: var sortedMusicAscending = SortingService.SortMusicAscendingRating(SelectInformation.SelectAllMusic()); Menu.ShowMusics(sortedMusicAscending); break; case SortType.Descending: var sortedMusicDescending = SortingService.SortMusicDescendingRating(SelectInformation.SelectAllMusic()); Menu.ShowMusics(sortedMusicDescending); break; default: Console.WriteLine("Нет такого типа сортировки"); break; } break; default: Console.WriteLine("Выберите из предложенных вариантов"); break; } break; default: Console.WriteLine("Нет такого объекта"); break; } break; case Actions.Exit: isFinish = true; break; default: Console.WriteLine("Нет такого действия"); break; } } while (!isFinish); }
private void DecrementRepCount(SetInformation setInformation) { setInformation.RepCount = setInformation.RepCount == 0 ? this.repetitionCount : setInformation.RepCount - 1; }
public static NTStatus SetFileInformation(INTFileStore fileStore, object handle, SetInformation information) { FileInformation fileInformation = SetInformationHelper.ToFileInformation(information); return(fileStore.SetFileInformation(handle, fileInformation)); }
static void Main(string[] args) { bool isFinish = false; bool isEnter = false; User currentUser = new User(); while (true) { switch (ProgramService.ChoseEnter()) { case Constants.REGISTRATION_CHOSE: try { using (TableDataService <User> dataService = new TableDataService <User>()) { User newUser = ProgramService.Registration(); dataService.Add(newUser); } } catch (ArgumentException exception) { Console.WriteLine(exception.Message); } break; case Constants.ENTRY_CHOSE: if (ProgramService.Enter(currentUser)) { isEnter = true; } else { Console.WriteLine("Нету такого user"); } break; case Constants.EXIT_CHOSE: isFinish = true; break; } if (isEnter == true) { using (TableDataService <BookingBook> dataService = new TableDataService <BookingBook>()) { Hotel.Models.Hotel chosenHotel = ProgramService.ChoseHotel(); Room chosenRoom = ProgramService.ChoseRoom(chosenHotel.Id); DateTime beginDate = SetInformation.SetBeginDateAndTime(); DateTime endDate = SetInformation.SetEndDateAndTime(beginDate); BookingBook bookingBook = new BookingBook() { UserId = currentUser.Id, RoomId = chosenRoom.Id, BeginDate = beginDate, EndDate = endDate }; dataService.Add(bookingBook); IPayer payer = GetPayers.GetPayer(Payers.PayPal); payer.Pay($"{chosenRoom.Number} room", ((endDate - beginDate).Days * chosenRoom.PricePerDay).ToString()); } isEnter = false; } else if (isFinish == true) { break; } } }
public static NTStatus SetFileInformation(INTFileStore fileStore, object handle, SetInformation information) { if (information is SetFileBasicInfo) { SetFileBasicInfo basicInfo = (SetFileBasicInfo)information; FileBasicInformation fileBasicInfo = new FileBasicInformation(); fileBasicInfo.CreationTime = basicInfo.CreationTime; fileBasicInfo.LastAccessTime = basicInfo.LastAccessTime; fileBasicInfo.LastWriteTime = basicInfo.LastWriteTime; fileBasicInfo.ChangeTime = basicInfo.LastChangeTime; fileBasicInfo.FileAttributes = (FileAttributes)basicInfo.ExtFileAttributes; fileBasicInfo.Reserved = basicInfo.Reserved; return(fileStore.SetFileInformation(handle, fileBasicInfo)); } else if (information is SetFileDispositionInfo) { FileDispositionInformation fileDispositionInfo = new FileDispositionInformation(); fileDispositionInfo.DeletePending = ((SetFileDispositionInfo)information).DeletePending; return(fileStore.SetFileInformation(handle, fileDispositionInfo)); } else if (information is SetFileAllocationInfo) { // This information level is used to set the file length in bytes. // Note: the input will NOT be a multiple of the cluster size / bytes per sector. FileAllocationInformation fileAllocationInfo = new FileAllocationInformation(); fileAllocationInfo.AllocationSize = ((SetFileAllocationInfo)information).AllocationSize; return(fileStore.SetFileInformation(handle, fileAllocationInfo)); } else if (information is SetFileEndOfFileInfo) { FileEndOfFileInformation fileEndOfFileInfo = new FileEndOfFileInformation(); fileEndOfFileInfo.EndOfFile = ((SetFileEndOfFileInfo)information).EndOfFile; return(fileStore.SetFileInformation(handle, fileEndOfFileInfo)); } else { return(NTStatus.STATUS_NOT_IMPLEMENTED); } }