public ReplacementSchemaType GetSchema(int SchemaId) { bool found = false; ReplacementSchemaType return_schema = new ReplacementSchemaType(); foreach (ReplacementSchemaType schema in schemas) { if (schema.SchemaId == SchemaId) { found = true; return_schema = schema; break; } } if (found) { return(return_schema); } else { int generate_new_schema = RequestNewSchema(); return(GetSchema(generate_new_schema)); } }
private bool DeleteSchema(int SchemaId) { ReplacementSchemaType schema = GetSchema(SchemaId); orders.RemoveAt(schema.OrderId); return(schemas.Remove(schema)); }
private int CreateSchema(int order_id) { int new_schema_id = GetNextSchemaId(); HashSet <Tuple <uint8_t, uint8_t> > new_schema_set = new HashSet <Tuple <uint8_t, uint8_t> >(); for (int i = 0; i < number_of_replaceable_chars; i++) { new_schema_set.Add(Tuple.Create(replaceable_chars[i], replaceable_chars[orders[order_id].ElementAt(i)])); } ReplacementSchemaType new_schema = new ReplacementSchemaType(); new_schema.SchemaId = new_schema_id; new_schema.SchemaSet = new_schema_set; new_schema.OrderId = order_id; schemas.Add(new_schema); return(new_schema_id); }
private int CreateSchema() { int current_order = GenerateRandomNumbersOnEnglishDictionary(); int new_schema_id = GetNextSchemaId(); HashSet <Tuple <uint8_t, uint8_t> > new_schema_set = new HashSet <Tuple <uint8_t, uint8_t> >(); for (int i = 0; i < number_of_replaceable_chars; i++) { new_schema_set.Add(Tuple.Create(replaceable_chars[i], replaceable_chars[orders[current_order].ElementAt(i) - 1])); } ReplacementSchemaType new_schema = new ReplacementSchemaType(); new_schema.SchemaId = new_schema_id; new_schema.SchemaSet = new_schema_set; new_schema.OrderId = current_order; schemas.Add(new_schema); return(new_schema_id); }