internal static ConversationPIIItemResult DeserializeConversationPIIItemResult(JsonElement element)
        {
            string id = default;
            RedactedTranscriptContent redactedContent = default;
            IList <GeneratedEntity>   entities        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("redactedContent"))
                {
                    redactedContent = RedactedTranscriptContent.DeserializeRedactedTranscriptContent(property.Value);
                    continue;
                }
                if (property.NameEquals("entities"))
                {
                    List <GeneratedEntity> array = new List <GeneratedEntity>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(GeneratedEntity.DeserializeGeneratedEntity(item));
                    }
                    entities = array;
                    continue;
                }
            }
            return(new ConversationPIIItemResult(id, redactedContent, entities));
        }
Example #2
0
        private static string GenerateOnce(int length, RandomGenerator randGenerator, GeneratedEntity type = GeneratedEntity.String)
        {
            string result = "";

            if (type == GeneratedEntity.String)
            {
                result = randGenerator.GenerateRandomString(length);
            }
            else if (type == GeneratedEntity.Email)
            {
                result = randGenerator.GenerateRandomEmail(length);
            }
            else if (type == GeneratedEntity.Name)
            {
                result = randGenerator.GenerateRandomName(NameType.All);
            }


            Console.WriteLine(result);
            #if !__MonoCS__
            Clipboard.SetText(result);
            #endif

            string input = Console.ReadLine();

            return(input);
        }
Example #3
0
        private static void GenerateInLoop(int length, RandomGenerator randGenerator, GeneratedEntity type = GeneratedEntity.String)
        {
            string input = "";

            while (input.ToLowerInvariant() != "q")
            {
                input = GenerateOnce(length, randGenerator, type);
            }
        }