예제 #1
0
        private void ProcessDataSource()
        {
            if (Pageable.Enabled && DataSource.PageSize == 0)
            {
                DataSource.PageSize = 10;
            }

            var binder = new DataSourceRequestModelBinder();

            if (this.PrefixUrlParameters)
            {
                binder.Prefix = Name;

                if (DataSource.Type == DataSourceType.Server)
                {
                    DataSource.Transport.Prefix = Name + "-";
                }
            }

            var controller     = ViewContext.Controller;
            var bindingContext = new ModelBindingContext()
            {
                ValueProvider = controller.ValueProvider
            };

            var request = (DataSourceRequest)binder.BindModel(controller.ControllerContext, bindingContext);

            DataSource.Process(request, !EnableCustomBinding);

            if (DataSource.Schema.Model.Id != null)
            {
                DataKeys.Add(DataSource.Schema.Model.Id);
            }
        }
        public void viewUpdated(EModelUpdateType updateType)
        {
            //Get data from model
            ModelUser student = this.model.getItem <ModelUser>(DataKeys.getUserKey(studentId));

            //change data into list of AssignmentViewCellData

            Collection <StudentAssignmentViewCellData> assignments = new Collection <StudentAssignmentViewCellData>();

            Collection <AssignmentListItem> listItems = student.makeStudentAssignmentListItems();

            foreach (AssignmentListItem assignment in listItems)
            {
                int dueDateResult = DateTime.Compare(assignment.dueDate, DateTime.Now);


                if (!(dueDateResult <= 0 && assignment.isDone == true))
                {
                    StudentAssignmentViewCellData viewCell = new StudentAssignmentViewCellData(
                        assignment,
                        this
                        );

                    assignments.Add(viewCell);
                }
            }

            //set datacells as item source for list
            this.assignmentListView.ItemsSource = assignments;
        }
예제 #3
0
        public AuthenticationRepo(YamlSettings yamlSettings, DataKeys dataKeys, AuthSkeleton authSkeleton)
        {
            _yamlSettings = yamlSettings;
            _dataKeys     = dataKeys;
            _authSkeleton = authSkeleton;
            _auths        = new List <Auth>();

            var data = YamlConfigurationFileParser.Parse(_yamlSettings.YamlDataFile);

            foreach (KeyValuePair <string, YamlSequenceNode> entry in data)
            {
                if (entry.Key.Contains(_dataKeys.AuthKey))
                {
                    foreach (YamlMappingNode node in entry.Value) // Auths
                    {
                        Auth auth = new Auth();
                        foreach (var item in node.Children) // each auth
                        {
                            var key   = item.Key.ToString();
                            var value = item.Value;

                            if (key.Equals(_authSkeleton.UserName))
                            {
                                auth.UserName = value.ToString();
                            }
                            else if (key.Equals(_authSkeleton.Password))
                            {
                                auth.Password = value.ToString();
                            }
                        }
                        _auths.Add(auth);
                    }
                }
            }
        }
예제 #4
0
        public string Get(DataKeys key)
        {
            string val = null;

            Data.TryGetValue(key, out val);

            return val;
        }
예제 #5
0
        public void register(IHomeWorkModel model, int studentId)
        {
            this.model     = model;
            this.studentId = studentId;


            model.addWatcher(viewUpdated, DataKeys.getUserKey(studentId));
        }
예제 #6
0
        public async Task <string> execute()
        {
            Response response = await this.model.editAssignment(
                this.assignmentName,
                this.assignmentDueDate,
                this.assignmentDescription,
                this.isClosed,
                this.assignmentId,
                this.teacherId

                );

            if (!response.isOk)
            {
                return(response.message);
            }

            ModelUser teacher = this.model.getItem <ModelUser>(DataKeys.getUserKey(this.teacherId));

            ModelAssignment assignment = null;

            foreach (ModelAssignment ass in teacher.assignments)
            {
                if (ass.id == this.assignmentId)
                {
                    assignment = ass;
                }
            }

            if (assignment == null)
            {
                return("Failure, assignment not on model");
            }

            AssignmentFetchObject aFO = new AssignmentFetchObject(this.assignmentId,
                                                                  assignment.classRoomName,
                                                                  this.assignmentDueDate,
                                                                  this.assignmentDescription,
                                                                  this.isClosed,
                                                                  this.assignmentName
                                                                  );

            ServerResponse serverResponse = await this.model.fetchDataBaseObject(aFO, ECmdObjType.assignmentFetchObj);

            if (!serverResponse.errorResponse.isOk)
            {
                return(serverResponse.errorResponse.message);
            }

            if (aFO.isSame(serverResponse.fetchObject))
            {
                return("Success! \n" + aFO.render());
            }
            else
            {
                return("Failure :(");
            }
        }
예제 #7
0
        public ClassRoomPage(string classRoomName, int teacherId)
        {
            this.classRoomName = classRoomName;

            this.model = ((App)Application.Current).model;
            this.model.initializeForClassRoom(classRoomName);

            InitializeComponent();

            this.classRoomName_Label.Text = classRoomName;

            ModelUser user = this.model.getItem <ModelUser>(DataKeys.getUserKey(teacherId));

            this.assignmentListView.register(model, user, classRoomName);

            ClassRoomPageControler controler = new ClassRoomPageControler(this, addAssignment_button, teacherId, classRoomName, assignmentListView, user);
        }
예제 #8
0
        public CustomerRepo(YamlSettings yamlSettings, DataKeys dataKeys, CustomerSkeleton customerSkeleton)
        {
            _customers        = new List <Customer>();
            _yamlSettings     = yamlSettings;
            _dataKeys         = dataKeys;
            _customerSkeleton = customerSkeleton;

            var data = YamlConfigurationFileParser.Parse(_yamlSettings.YamlDataFile);

            foreach (KeyValuePair <string, YamlSequenceNode> entry in data)
            {
                if (entry.Key.Contains(_dataKeys.CustomerKey))
                {
                    foreach (YamlMappingNode node in entry.Value) // customers
                    {
                        Customer customer = new Customer();
                        foreach (var item in node.Children) // each customer
                        {
                            var key   = item.Key.ToString();
                            var value = item.Value;

                            if (key.Equals(_customerSkeleton.Id))
                            {
                                customer.Id = value.ToString();
                            }
                            else if (key.Equals(_customerSkeleton.Name))
                            {
                                customer.Name = value.ToString();
                            }
                            else if (key.Equals(_customerSkeleton.EmpNum))
                            {
                                customer.EmpNum = value.ToString();
                            }
                            else if (key.Equals(_customerSkeleton.Tags))
                            {
                                var tags = Regex.Replace(value.ToString(), @"[\[\]\s+]", string.Empty).Replace(",", " ");
                                customer.Tags = tags;
                            }
                        }
                        _customers.Add(customer);
                    }
                }
            }
        }
예제 #9
0
        public void viewUpdated(EModelUpdateType updateType)
        {
            //Get data from model
            ModelUser student = model.getItem <ModelUser>(DataKeys.getUserKey(studentId));

            //change data into list of classRoomViewCellData

            Collection <SubscriptionViewCellData> subscriptions = new Collection <SubscriptionViewCellData>();

            Collection <Students_SubscriptionListItem> subscriptionsListItems = student.makeSubscriptionListItems();

            foreach (Students_SubscriptionListItem subscription in subscriptionsListItems)
            {
                SubscriptionViewCellData viewCell = new SubscriptionViewCellData(subscription.name, subscription.nextDue);

                subscriptions.Add(viewCell);
            }

            //set datacells as item source for list
            this.subscriptionsListView.ItemsSource = subscriptions;
        }
예제 #10
0
        public TestContext()
        {
            DataClient = new MockRedisClientWrapper ();

            Settings = new DataManagerSettings ();
            Settings.IsVerbose = true;

            Keys = new DataKeys (Settings);

            IdManager = new DataIdManager (Keys, DataClient);
            TypeManager = new DataTypeManager (Keys, DataClient);

            EntityLinker = new EntityLinker ();

            var preparer = new DataPreparer (DataClient);
            Preparer = preparer;

            var reader = new DataReader (TypeManager, IdManager, Keys, DataClient);
            Reader = reader;

            var checker = new DataChecker (reader, Settings);
            Checker = checker;

            var saver = new DataSaver (Settings, TypeManager, IdManager, Keys, preparer, null, checker, DataClient); // The linker argument is null because it needs to be set after it's created below
            Saver = saver;

            var updater = new DataUpdater (Settings, Keys, null, preparer, checker, DataClient); // The linker argument is null because it needs to be set after it's created below
            Updater = updater;

            var linker = new DataLinker (Settings, reader, saver, updater, checker, EntityLinker);
            Linker = linker;

            // TODO: Is there a way to avoid this messy hack?
            // Make sure the linker is set to the saver and updater
            saver.Linker = linker;
            updater.Linker = linker;
        }
예제 #11
0
        protected override void WriteHtml(HtmlTextWriter writer)
        {
            if (!Columns.Any() && AutoGenerateColumns)
            {
                foreach (GridColumnBase <T> column in new GridColumnGenerator <T>(this).GetColumns())
                {
                    Columns.Add(column);
                }
            }

            var orignalClientValidationEnabled = ViewContext.ClientValidationEnabled;
            var originalFormContext            = ViewContext.FormContext;

            try
            {
                ViewContext.ClientValidationEnabled = true;
                ViewContext.FormContext             = new FormContext
                {
                    FormId = Name + "form"
                };

                if (Editable.Enabled && IsClientBinding)
                {
                    InitializeEditors();
                }

                AdjustColumnsTypesFromDynamic();

                if (!HtmlAttributes.ContainsKey("id"))
                {
                    HtmlAttributes["id"] = Id;
                }

                var builder = htmlBuilderFactory.CreateBuilder(Scrollable.Enabled);

                if (DataSource.Type != DataSourceType.Custom || DataSource.CustomType == "aspnetmvc-ajax")
                {
                    ProcessDataSource();
                }

                if (DataSource.Schema.Model.Id != null)
                {
                    DataKeys.Add(DataSource.Schema.Model.Id);
                }

                var renderingData = CreateRenderingData();

                var functionalData = CreateFunctionalData();

                var container = builder.CreateGrid(HtmlAttributes, functionalData, renderingData);

                if (Editable.Mode == GridEditMode.PopUp && (CurrentItemMode == GridItemMode.Insert || CurrentItemMode == GridItemMode.Edit))
                {
                    AppendPopupEditor(container, renderingData);
                }

                container.WriteTo(writer);

                if (ViewContext.FormContext != null)
                {
                    ValidationMetadata.Add("Fields", ProcessValidationMetadata());

                    ValidationMetadata.Add("FormId", ViewContext.FormContext.FormId);
                }
            }
            finally
            {
                ViewContext.FormContext             = originalFormContext;
                ViewContext.ClientValidationEnabled = orignalClientValidationEnabled;
            }

            base.WriteHtml(writer);
        }
예제 #12
0
        public override void VerifySettings()
        {
            base.VerifySettings();

            this.ThrowIfClassIsPresent("k-grid-rtl", Exceptions.Rtl);

            if (!IsClientBinding && Scrollable.Enabled && Scrollable.Virtual)
            {
                throw new NotSupportedException(Exceptions.CannotUseVirtualScrollWithServerBinding);
            }

            if (AutoBind.HasValue)
            {
                if (!IsClientBinding || (IsClientBinding && DataSource.Data != null))
                {
                    throw new NotSupportedException(Exceptions.CannotSetAutoBindIfBoundDuringInitialization);
                }
            }

            if (Columns.Any(c => c.Locked) && !IsClientBinding)
            {
                throw new NotSupportedException(Exceptions.CannotUseLockedColumnsAndServerBinding);
            }

            if (IsClientBinding)
            {
                if (Columns.OfType <IGridTemplateColumn <T> >().Where(c => c.Template != null && string.IsNullOrEmpty(c.ClientTemplate)).Any())
                {
                    throw new NotSupportedException(Exceptions.CannotUseTemplatesInAjaxOrWebService);
                }

                if (DetailTemplate != null && DetailTemplate.HasValue() && string.IsNullOrEmpty(ClientDetailTemplateId))
                {
                    throw new NotSupportedException(Exceptions.CannotUseTemplatesInAjaxOrWebService);
                }

                if (Columns.Any(c => c.Locked))
                {
                    if (DetailTemplate != null && DetailTemplate.HasValue() || ClientDetailTemplateId.HasValue())
                    {
                        throw new NotSupportedException(Exceptions.CannotUseDetailTemplateAndLockedColumns);
                    }

                    if (ClientRowTemplate.HasValue() || RowTemplate != null && RowTemplate.HasValue())
                    {
                        throw new NotSupportedException(Exceptions.CannotUseRowTemplateAndLockedColumns);
                    }
                }

                if (Columns.OfType <IGridActionColumn>().Any(c => c.Commands.OfType <GridCustomActionCommand <T> >().Any(command => command.HasValue())))
                {
                    throw new NotSupportedException(Exceptions.CustomCommandRoutesWithAjaxBinding);
                }
            }

            if (!DataKeys.Any() && (Editable.Enabled || (Selectable.Enabled && !IsClientBinding)))
            {
                throw new NotSupportedException(Exceptions.DataKeysEmpty);
            }

            if (Editable.Enabled)
            {
                if (DataSource.Type != DataSourceType.Custom)
                {
                    if (HasCommandOfType <GridEditActionCommand>())
                    {
                        if (!DataSource.Transport.Update.HasValue())
                        {
                            throw new NotSupportedException(Exceptions.EditCommandRequiresUpdate);
                        }
                    }

                    if (HasCommandOfType <GridDestroyActionCommand>())
                    {
                        if (!DataSource.Transport.Destroy.HasValue() && Editable.Mode != GridEditMode.InCell)
                        {
                            throw new NotSupportedException(Exceptions.DeleteCommandRequiresDelete);
                        }
                    }

                    if (HasCommandOfType <GridToolBarCreateCommand <T> >())
                    {
                        if (!DataSource.Transport.Create.HasValue() && Editable.Mode != GridEditMode.InCell)
                        {
                            throw new NotSupportedException(Exceptions.InsertCommandRequiresInsert);
                        }
                    }
                }

                if (HasCommandOfType <GridToolBarSaveCommand <T> >())
                {
                    if (Editable.Mode != GridEditMode.InCell)
                    {
                        throw new NotSupportedException(Exceptions.BatchUpdatesRequireInCellMode);
                    }

                    if (DataSource.Type != DataSourceType.Custom)
                    {
                        if (!DataSource.Transport.Update.HasValue())
                        {
                            throw new NotSupportedException(Exceptions.BatchUpdatesRequireUpdate);
                        }
                    }
                }

                if (Editable.Mode == GridEditMode.InCell)
                {
                    if (!IsClientBinding)
                    {
                        throw new NotSupportedException(Exceptions.InCellModeNotSupportedInServerBinding);
                    }

                    if (ClientRowTemplate.HasValue() || ClientAltRowTemplate.HasValue() || RowTemplate.HasValue())
                    {
                        throw new NotSupportedException(Exceptions.InCellModeNotSupportedWithRowTemplate);
                    }
                }

                if (typeof(T) == typeof(System.Data.DataRowView) && Editable.Mode == GridEditMode.InLine &&
                    Columns.OfType <IGridBoundColumn>().Where(c => c.EditorTemplateName.HasValue()).Any())
                {
                    throw new NotSupportedException(Exceptions.DataTableInLineEditingWithCustomEditorTemplates);
                }

                if (typeof(T) == typeof(System.Data.DataRowView) && Editable.Mode == GridEditMode.PopUp &&
                    !Editable.TemplateName.HasValue())
                {
                    throw new NotSupportedException(Exceptions.DataTablePopUpTemplate);
                }
            }
        }
예제 #13
0
        public static Boolean TryParse(List <string> crozzleFileFragment, out FileFragment <CrozzleFileItem> aCrozzleFileFragment)
        {
            Errors = new List <String>();
            crozzleFileFragment.RemoveAll(s => String.IsNullOrEmpty(s));
            aCrozzleFileFragment = new FileFragment <CrozzleFileItem>();

            String   formattedLine = String.Empty;
            DataKeys flag          = DataKeys.UNDEFINED;

            foreach (String line in crozzleFileFragment)
            {
                /// Discard comment and trim possible whitespace.
                if (line.Contains("//"))
                {
                    int index = line.IndexOf("//");
                    formattedLine = line.Remove(index);
                }
                else
                {
                    formattedLine = line;
                }
                formattedLine = formattedLine.Trim();

                CrozzleFileItem aCrozzleFileItem = new CrozzleFileItem(formattedLine);

                if (Regex.IsMatch(formattedLine, @"^\s*$"))
                {
                    continue;
                }
                else if (Regex.IsMatch(formattedLine, ForeignCharacters))
                {
                    Errors.Add(String.Format(ConfigurationFileItemErrors.SymbolError, aCrozzleFileItem));
                }
                else
                {
                    /// TODO: switch case with flag
                    switch (flag)
                    {
                    case DataKeys.UNDEFINED:
                        /// fragment specification
                        if (Regex.IsMatch(formattedLine, @"^" + FileDependenciesKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.DEPENDENCIES;
                            aCrozzleFileFragment.Name = FileDependenciesKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.SIZE;
                            aCrozzleFileFragment.Name = CrozzleSizeKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + HorizontalSequenceKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.HORZSEQUENCE;
                            aCrozzleFileFragment.Name = HorizontalSequenceKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + VerticalSequenceKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.VERTSEQUENCE;
                            aCrozzleFileFragment.Name = VerticalSequenceKeys.OpenBracket;
                        }
                        break;

                    case DataKeys.DEPENDENCIES:
                        if (Regex.IsMatch(formattedLine, @"^" + FileDependenciesKeys.ConfigFileName + @".*"))
                        {
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, FileDependenciesKeys.ConfigFileName, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aCrozzleFileItem.Name     = FileDependenciesKeys.ConfigFileName;
                            aCrozzleFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + FileDependenciesKeys.SequenceFileName + @".*"))
                        {
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, FileDependenciesKeys.SequenceFileName, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aCrozzleFileItem.Name     = FileDependenciesKeys.SequenceFileName;
                            aCrozzleFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + FileDependenciesKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.SIZE:
                        if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.Size + @".*"))
                        {
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleSizeKeys.Size, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aCrozzleFileItem.Name     = CrozzleSizeKeys.Size;
                            aCrozzleFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.HORZSEQUENCE:
                        if (Regex.IsMatch(formattedLine, @"^" + HorizontalSequenceKeys.Sequence + @".*"))
                        {
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, HorizontalSequenceKeys.Sequence, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aCrozzleFileItem.Name     = HorizontalSequenceKeys.Sequence;
                            aCrozzleFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + HorizontalSequenceKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.VERTSEQUENCE:
                        if (Regex.IsMatch(formattedLine, @"^" + VerticalSequenceKeys.Sequence + @".*"))
                        {
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, VerticalSequenceKeys.Sequence, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aCrozzleFileItem.Name     = VerticalSequenceKeys.Sequence;
                            aCrozzleFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + VerticalSequenceKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;
                    }

                    aCrozzleFileItem.Valid = Errors.Count == 0;
                    /// If the current line is the opening bracket to a fragment, do not add as a new item. Else, do so.
                    if (aCrozzleFileItem.Name != null)
                    {
                        aCrozzleFileFragment.AddNewItem(aCrozzleFileItem);
                    }
                }
            }
            /// FALSE TRUE FALSE
            /// FALSE FALSE TRUE
            return(!aCrozzleFileFragment.Items.Exists(item => item.Valid == false));
        }
 private string getUserDataKey()
 {
     return(DataKeys.getUserKey(this.user.id));
 }
예제 #15
0
        public void InstallServices(IServiceCollection services, IConfiguration configuration)
        {
            services.AddMvc();
            services.AddCors();


            var clientEndPoint = new ClientEndPoint();

            configuration.Bind(nameof(clientEndPoint), clientEndPoint);
            services.AddSingleton <ClientEndPoint>(clientEndPoint);

            var authSkeleton = new AuthSkeleton();

            configuration.Bind(nameof(authSkeleton), authSkeleton);
            services.AddSingleton <AuthSkeleton>(authSkeleton);

            var customerSkeleton = new CustomerSkeleton();

            configuration.Bind(nameof(customerSkeleton), customerSkeleton);
            services.AddSingleton <CustomerSkeleton>(customerSkeleton);

            var dataKeys = new DataKeys();

            configuration.Bind(nameof(dataKeys), dataKeys);
            services.AddSingleton <DataKeys>(dataKeys);

            var yamlSettings = new YamlSettings();

            configuration.Bind(nameof(yamlSettings), yamlSettings);
            services.AddSingleton <YamlSettings>(yamlSettings);

            var jwtSettings = new JwtSettings();

            configuration.Bind(nameof(jwtSettings), jwtSettings);
            services.AddSingleton <JwtSettings>(jwtSettings);

            var tokenValidationParameters = new TokenValidationParameters
            {
                ValidateIssuerSigningKey = true,
                IssuerSigningKey         = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(jwtSettings.Secret)),
                ValidateIssuer           = false,
                ValidateAudience         = false,
                RequireExpirationTime    = false,
                ValidateLifetime         = true
            };

            services.AddSingleton(tokenValidationParameters);
            services.AddAuthentication(x =>
            {
                x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                x.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                x.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(x =>
            {
                x.SaveToken = true;
                x.TokenValidationParameters = tokenValidationParameters;
            });

            services.AddSwaggerGen(x =>
            {
                x.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Customer API", Version = "v1"
                });
                var security = new Dictionary <string, IEnumerable <string> >
                {
                    { "Bearer", new string[0] }
                };
                x.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Description = "JWT Authorization header using the Bearer scheme",
                    Name        = "Authorization",
                    In          = ParameterLocation.Header,
                    Type        = SecuritySchemeType.ApiKey,
                    Scheme      = "Bearer"
                });
                x.AddSecurityRequirement(new OpenApiSecurityRequirement()
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "Bearer"
                            },
                            Scheme = "oauth2",
                            Name   = "Bearer",
                            In     = ParameterLocation.Header
                        },
                        new List <string>()
                    }
                });
            });
        }
예제 #16
0
 public string GetDataInfo(DataKeys key)
 {
     return(PlayerPrefs.GetString(key.ToString(), "keyDidNotFind"));
 }
예제 #17
0
        public DataKeys GenKey(inputData model)
        {
            DataKeys _dataKeys = new DataKeys();
            String _productID = String.Empty;
            // String _productID = "D5F0-1B5F-767D-A3FB-A473-E53C-10CE-AC1D";// ComputerInfo.GetComputerId();

            if (String.IsNullOrEmpty(model.ProductID))
            {
                _productID = ComputerInfo.GetComputerId();
            }else
            {
                _productID = model.ProductID;
            }

            

            KeyManager _km = new KeyManager(_productID);

            KeyValuesClass _kv;

            String _productKey = String.Empty;

            if (model.LicenseType == LicenseType.TRIAL)
            {
                _kv = new KeyValuesClass()
                {
                    Type = LicenseType.TRIAL,
                    Header = Convert.ToByte(9),
                    Footer = Convert.ToByte(6),
                    ProductCode = (byte)m_ProductCode,
                    Edition =model.Edition,
                    Version = 1,
                    Expiration = DateTime.Now.Date.AddDays(model.ExperienceDays)
                };
                if (!_km.GenerateKey(_kv, ref _productKey))
                    return null;
            }
            else
            {
                _kv = new KeyValuesClass()
                {
                    Type = LicenseType.FULL,
                    Header = Convert.ToByte(9),
                    Footer = Convert.ToByte(6),
                    ProductCode = (byte)m_ProductCode,
                    Edition = model.Edition,
                    Version = 1
                };
                if (!_km.GenerateKey(_kv, ref _productKey))
                    return null;
            }

            _dataKeys.ProductID = _productID;
            _dataKeys.Name = model.Name;
            _dataKeys.ProducKey = _productKey;
            _dataKeys.LicenseType = _kv.Type;
            _dataKeys.ExpereienceDays = _kv.Expiration;
            _dataKeys.Edition = _kv.Edition;


            return _dataKeys;
        }
예제 #18
0
 public Task <bool> DeleteKey(DataKeys key)
 {
     throw new System.NotImplementedException();
 }
예제 #19
0
        public override void VerifySettings()
        {
            base.VerifySettings();

            this.ThrowIfClassIsPresent("t-grid-rtl", TextResource.Rtl);

            if (Ajax.Enabled && WebService.Enabled)
            {
                throw new NotSupportedException(TextResource.CannotUseAjaxAndWebServiceAtTheSameTime);
            }

            if (IsClientBinding)
            {
                if (Columns.OfType <IGridTemplateColumn <T> >().Where(c => c.Template != null && string.IsNullOrEmpty(c.ClientTemplate)).Any())
                {
                    throw new NotSupportedException(TextResource.CannotUseTemplatesInAjaxOrWebService);
                }

                if (DetailView != null && DetailView.Template.HasValue() && !DetailView.ClientTemplate.HasValue())
                {
                    throw new NotSupportedException(TextResource.CannotUseTemplatesInAjaxOrWebService);
                }
            }

            if (Paging.PageOnScroll)
            {
                if (!Paging.Enabled)
                {
                    throw new NotSupportedException(TextResource.PagingMustBeEnabledToUsePageOnScroll);
                }

                if (!Scrolling.Enabled)
                {
                    throw new NotSupportedException(TextResource.ScrollingMustBeEnabledToUsePageOnScroll);
                }

                if (!IsClientBinding)
                {
                    throw new NotSupportedException(TextResource.CannotUsePageOnScrollWithServerBinding);
                }
            }

            if (WebService.Enabled && string.IsNullOrEmpty(WebService.Select.Url))
            {
                throw new ArgumentException(TextResource.WebServiceUrlRequired);
            }

            if (!DataKeys.Any() && (Editing.Enabled || (Selection.Enabled && !IsClientBinding)))
            {
                throw new NotSupportedException(TextResource.DataKeysEmpty);
            }

            if (Editing.Enabled)
            {
                if (HasCommandOfType <GridEditActionCommand>())
                {
                    if (!CurrrentBinding.Update.HasValue())
                    {
                        throw new NotSupportedException(TextResource.EditCommandRequiresUpdate);
                    }
                }

                if (HasCommandOfType <GridDeleteActionCommand>())
                {
                    if (!CurrrentBinding.Delete.HasValue() && Editing.Mode != GridEditMode.InCell)
                    {
                        throw new NotSupportedException(TextResource.DeleteCommandRequiresDelete);
                    }
                }

                if (HasCommandOfType <GridToolBarInsertCommand <T> >())
                {
                    if (!CurrrentBinding.Insert.HasValue() && Editing.Mode != GridEditMode.InCell)
                    {
                        throw new NotSupportedException(TextResource.InsertCommandRequiresInsert);
                    }
                }

                if (HasCommandOfType <GridToolBarSubmitChangesCommand <T> >())
                {
                    if (Editing.Mode != GridEditMode.InCell)
                    {
                        throw new NotSupportedException(TextResource.BatchUpdatesRequireInCellMode);
                    }

                    if (!CurrrentBinding.Update.HasValue())
                    {
                        throw new NotSupportedException(TextResource.BatchUpdatesRequireUpdate);
                    }
                }

#if MVC2 || MVC3
                if (Editing.Mode == GridEditMode.InCell)
                {
                    if (!Ajax.Enabled && !WebService.Enabled)
                    {
                        throw new NotSupportedException(TextResource.InCellModeNotSupportedInServerBinding);
                    }

                    if (ClientRowTemplate.HasValue() || RowTemplate.HasValue())
                    {
                        throw new NotSupportedException(TextResource.InCellModeNotSupportedWithRowTemplate);
                    }
                }

                if (typeof(T) == typeof(System.Data.DataRowView) && Editing.Mode == GridEditMode.InLine &&
                    Columns.OfType <IGridBoundColumn>().Where(c => c.EditorTemplateName.HasValue()).Any())
                {
                    throw new NotSupportedException(TextResource.DataTableInLineEditingWithCustomEditorTemplates);
                }
#endif
            }
        }
        public static Boolean TryParse(List <String> configurationFileFragment, out FileFragment <ConfigurationFileItem> aConfigurationFileFragment)
        {
            Errors = new List <String>();
            configurationFileFragment.RemoveAll(s => String.IsNullOrEmpty(s));
            aConfigurationFileFragment = new FileFragment <ConfigurationFileItem>();

            String   formattedLine = String.Empty;
            DataKeys flag          = DataKeys.UNDEFINED;

            foreach (String line in configurationFileFragment)
            {
                /// Discard comment and trim possible whitespace.
                if (line.Contains("//"))
                {
                    int index = line.IndexOf("//");
                    formattedLine = line.Remove(index);
                }
                else
                {
                    formattedLine = line;
                }
                formattedLine = formattedLine.Trim();

                ConfigurationFileItem aConfigurationFileItem = new ConfigurationFileItem(formattedLine);

                if (Regex.IsMatch(formattedLine, @"^\s*$"))
                {
                    continue;
                }
                else if (Regex.IsMatch(formattedLine, ForeignCharacters))
                {
                    Errors.Add(String.Format(ConfigurationFileItemErrors.SymbolError, aConfigurationFileItem)); /// Checks if the line contains foreign characters
                }
                else
                {
                    switch (flag)
                    {
                    case DataKeys.UNDEFINED:
                        /// fragment specification.
                        if (Regex.IsMatch(formattedLine, @"^" + LogFileKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.LOGFILE;
                            aConfigurationFileFragment.Name = LogFileKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + UniqueSequenceKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.SEQUENCES;
                            aConfigurationFileFragment.Name = UniqueSequenceKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.OUTPUT;
                            aConfigurationFileFragment.Name = CrozzleOutputKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.SIZE;
                            aConfigurationFileFragment.Name = CrozzleSizeKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalSequenceKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.LIMITSEQUENCE;
                            aConfigurationFileFragment.Name = DirectionalSequenceKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalIntersectionKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.LIMITINTERSECT;
                            aConfigurationFileFragment.Name = DirectionalIntersectionKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DuplicateSequenceKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.DUPLICATE;
                            aConfigurationFileFragment.Name = DuplicateSequenceKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + ValidGroupKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.VALIDGROUP;
                            aConfigurationFileFragment.Name = ValidGroupKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + IntersectionKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.INTERSECT;
                            aConfigurationFileFragment.Name = IntersectionKeys.OpenBracket;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + NonIntersectionKeys.OpenBracket + @".*"))
                        {
                            flag = DataKeys.NONINTERSECT;
                            aConfigurationFileFragment.Name = NonIntersectionKeys.OpenBracket;
                        }
                        break;

                    case DataKeys.LOGFILE:
                        if (Regex.IsMatch(formattedLine, @"^" + LogFileKeys.FileName + @".*"))
                        {
                            /// get the LogFile key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, LogFileKeys.FileName, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = LogFileKeys.FileName;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + LogFileKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.SEQUENCES:
                        if (Regex.IsMatch(formattedLine, @"^" + UniqueSequenceKeys.MinUnique + @".*"))
                        {
                            /// get the MinimumUniqueLetterSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, UniqueSequenceKeys.MinUnique, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = UniqueSequenceKeys.MinUnique;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + UniqueSequenceKeys.MaxUnique + @".*"))
                        {
                            /// get the MaximumUniqueLetterSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, UniqueSequenceKeys.MaxUnique, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = UniqueSequenceKeys.MaxUnique;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + UniqueSequenceKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.OUTPUT:
                        if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.InvalidScore + @".*"))
                        {
                            /// get the InvalidCrozzleScore key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleOutputKeys.InvalidScore, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleOutputKeys.InvalidScore;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.Uppercase + @".*"))
                        {
                            /// get the Uppercase key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleOutputKeys.Uppercase, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleOutputKeys.Uppercase;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.Style + @".*"))
                        {
                            /// get the Style key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleOutputKeys.Style, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleOutputKeys.Style;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.BGColourEmptyTD + @".*"))
                        {
                            /// get the BGColourEmptyTD key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleOutputKeys.BGColourEmptyTD, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleOutputKeys.BGColourEmptyTD;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.BGColourNonEmptyTD + @".*"))
                        {
                            /// get the BGColourNonEmptyTD key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleOutputKeys.BGColourNonEmptyTD, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleOutputKeys.BGColourNonEmptyTD;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleOutputKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.SIZE:
                        if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.MinRows + @".*"))
                        {
                            /// get the MinimumCrozzleSizeRows key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleSizeKeys.MinRows, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleSizeKeys.MinRows;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.MaxRows + @".*"))
                        {
                            /// get the MaximumCrozzleSizeRows key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleSizeKeys.MaxRows, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleSizeKeys.MaxRows;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.MinCols + @".*"))
                        {
                            /// get the MinimumCrozzleSizeColumns key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleSizeKeys.MinCols, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleSizeKeys.MinCols;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.MaxCols + @".*"))
                        {
                            /// get the MaximumCrozzleSizeColumns key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, CrozzleSizeKeys.MaxCols, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = CrozzleSizeKeys.MaxCols;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + CrozzleSizeKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.LIMITSEQUENCE:
                        if (Regex.IsMatch(formattedLine, @"^" + DirectionalSequenceKeys.MinHorz + @".*"))
                        {
                            /// get the MinimumHorizontalSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalSequenceKeys.MinHorz, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalSequenceKeys.MinHorz;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalSequenceKeys.MaxHorz + @".*"))
                        {
                            /// get the MaximumHorizontalSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalSequenceKeys.MaxHorz, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalSequenceKeys.MaxHorz;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalSequenceKeys.MinVert + @".*"))
                        {
                            /// get the MinimumVerticalSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalSequenceKeys.MinVert, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalSequenceKeys.MinVert;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalSequenceKeys.MaxVert + @".*"))
                        {
                            /// get the MaximumVerticalSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalSequenceKeys.MaxVert, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalSequenceKeys.MaxVert;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalSequenceKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.LIMITINTERSECT:
                        if (Regex.IsMatch(formattedLine, @"^" + DirectionalIntersectionKeys.MinHorz + @".*"))
                        {
                            /// get the MinimumHorizontalIntersections key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalIntersectionKeys.MinHorz, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalIntersectionKeys.MinHorz;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalIntersectionKeys.MaxHorz + @".*"))
                        {
                            /// get the MaximumHorizontalIntersections key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalIntersectionKeys.MaxHorz, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalIntersectionKeys.MaxHorz;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalIntersectionKeys.MinVert + @".*"))
                        {
                            /// get the MinimumVerticalIntersections key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalIntersectionKeys.MinVert, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalIntersectionKeys.MinVert;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalIntersectionKeys.MaxVert + @".*"))
                        {
                            /// get the MaximumVerticalIntersections key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DirectionalIntersectionKeys.MaxVert, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DirectionalIntersectionKeys.MaxVert;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DirectionalIntersectionKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.DUPLICATE:
                        if (Regex.IsMatch(formattedLine, @"^" + DuplicateSequenceKeys.MinDupe + @".*"))
                        {
                            /// get the MinimumDuplicateSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DuplicateSequenceKeys.MinDupe, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DuplicateSequenceKeys.MinDupe;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DuplicateSequenceKeys.MaxDupe + @".*"))
                        {
                            /// get the MaximumDuplicateSequences key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, DuplicateSequenceKeys.MaxDupe, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = DuplicateSequenceKeys.MaxDupe;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + DuplicateSequenceKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.VALIDGROUP:
                        if (Regex.IsMatch(formattedLine, @"^" + ValidGroupKeys.MinValidGroup + @".*"))
                        {
                            /// get the MinimumValidGroups key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, ValidGroupKeys.MinValidGroup, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = ValidGroupKeys.MinValidGroup;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + ValidGroupKeys.MaxValidGroup + @".*"))
                        {
                            /// get the MaximumValidGroups key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, ValidGroupKeys.MaxValidGroup, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = ValidGroupKeys.MaxValidGroup;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + ValidGroupKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.INTERSECT:
                        if (Regex.IsMatch(formattedLine, AtoZ))
                        {
                            /// get the AtoZ key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, AtoZ, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = aKeyValue.Key;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + IntersectionKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;

                    case DataKeys.NONINTERSECT:
                        if (Regex.IsMatch(formattedLine, AtoZ))
                        {
                            /// get the AtoZ key-value pair.
                            KeyValue aKeyValue;
                            if (!KeyValue.TryParse(formattedLine, AtoZ, out aKeyValue))
                            {
                                Errors.AddRange(KeyValue.Errors);
                            }
                            aConfigurationFileItem.Name     = aKeyValue.Key;
                            aConfigurationFileItem.KeyValue = aKeyValue;
                        }
                        else if (Regex.IsMatch(formattedLine, @"^" + NonIntersectionKeys.EndBracket + @".*"))
                        {
                            flag = DataKeys.UNDEFINED;
                        }
                        break;
                    }
                }

                aConfigurationFileItem.Valid = Errors.Count == 0;
                /// If the current line is the opening bracket to a fragment, do not add as a new item. Else, do so.
                if (aConfigurationFileItem.Name != null)
                {
                    aConfigurationFileFragment.AddNewItem(aConfigurationFileItem);
                }
            }
            /// FALSE TRUE FALSE
            /// FALSE FALSE TRUE
            return(!aConfigurationFileFragment.Items.Exists(item => item.Valid == false));
        }
예제 #21
0
 private string getUserDataKey()
 {
     return(DataKeys.getUserKey(userId));
 }
예제 #22
0
 public void Set(DataKeys key, string value)
 {
     if (Data.ContainsKey(key)) Data[key] = value;
     else Data.Add(key, value);
 }
예제 #23
0
 private string getTeacherDataKey()
 {
     return(DataKeys.getUserKey(this.teacherId));
 }
예제 #24
0
 public void SetDataInfo(DataKeys key, string value)
 {
     PlayerPrefs.SetString(key.ToString(), value);
 }