Пример #1
0
        void Create_NoModObservation(ProfileGenerator p)
        {
            StructureDefinition profile = CreateObservation("NoModObservation");

            SnapshotCreator.Create(profile);
            p.AddProfile(profile);
        }
        public async Task Pic(ProfilePictureModel model)
        {
            if (!ModelState.IsValid)
            {
                Response.StatusCode = 500;
                return;
            }

            var imageProcessing = new ProfileGenerator();

            var nameParse = model.Name.Split(' ');
            var firstName = nameParse[0];
            var lastName  = string.Empty;

            if (nameParse.Length > 1)
            {
                lastName = nameParse[nameParse.Length - 1];
            }

            var pic = imageProcessing.GenerateProfile(
                firstName: firstName,
                lastName: lastName,
                width: model.Width,
                height: model.Height,
                color: model.Color
                );

            // Temporary
            var buffer = pic.GetBuffer();

            Response.ContentType = "image/jpeg";
            await Response.Body.WriteAsync(buffer, 0, buffer.Length);

            pic.Close();
        }
Пример #3
0
        void Create_Fixed(ProfileGenerator p)
        {
            StructureDefinition profile = CreateObservation("Fixed");

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.identifier");
                e.Min   = 0;
                e.Max   = "1";
                e.Fixed = new Identifier("fixedIdentifierSystem", "fixedIdentifierValue");
            }
            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.status");
                e.Fixed = new Code("cancelled");
                e.Min   = 1;
                e.Max   = "1";
            }
            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.code");
                e.Min   = 0;
                e.Max   = "1";
                e.Fixed = new CodeableConcept("codeSystem", "codeCode", "codeDisplay", "codeText");
            }

            SnapshotCreator.Create(profile);
            p.AddProfile(profile);
            profile.SaveJson($@"c:\Temp\{profile.Name}.json");
        }
Пример #4
0
 public General(DiscordSocketClient client, ILogger <General> logger, Users users, ProfileGenerator generator)
 {
     this.client    = client;
     this.logger    = logger;
     this.users     = users;
     this.generator = generator;
 }
Пример #5
0
 public void CreateSamples(int count, int extra = 0)
 {
     IGenerator<Profile> generator = new ProfileGenerator(_profileService, _userService, _photosService, _resourceService);
     for (var i = 0; i < count; i++) {
         generator.Generate(extra);
     }
 }
Пример #6
0
        public void ConstructorTest()
        {
            ProfileGenerator p = new ProfileGenerator(ProfileGenerator.OutputLanguageType.CSharp,
                                                      OutputNameSpace,
                                                      GenDir);

            Assert.True(p.OutputLanguage == ProfileGenerator.OutputLanguageType.CSharp);
            Assert.True(p.NameSpace == OutputNameSpace);
            Assert.True(p.OutputDir == GenDir);
        }
Пример #7
0
        void Create_CardinalityModObservation(ProfileGenerator p)
        {
            StructureDefinition profile = CreateObservation("CardinalityModObservation");

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.identifier");
                e.Min = 0;
                e.Max = "1";
            };

            SnapshotCreator.Create(profile);
            p.AddProfile(profile);
        }
Пример #8
0
    public static string GenerateProfileFile(string gpxPath)
    {
        //calcolo la cartella che contiene le tracce
        string folder = Path.GetFileName(Path.GetDirectoryName(gpxPath));

        string profileFileRelPath  = PathFunctions.GetProfileUrl(folder);
        string profileFileFullPath = HttpContext.Current.Server.MapPath(profileFileRelPath);

        if (!File.Exists(profileFileFullPath))
        {
            ProfileGenerator gen = new ProfileGenerator();
            gen.GenerateProfile(Helper.GetGpxParser(gpxPath), profileFileFullPath);
        }
        return(profileFileRelPath);
    }
Пример #9
0
        void Create_Fixed2(ProfileGenerator p)
        {
            StructureDefinition profile = CreateObservation("Fixed2");

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.effective[x]");
                e.Fixed = new Period(new FhirDateTime(1002, 1, 2), new FhirDateTime(1003, 4, 5));
            }

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.value[x]");
                e.Fixed = new FhirBoolean(true);
            }

            SnapshotCreator.Create(profile);
            p.AddProfile(profile);
        }
Пример #10
0
        void Create_Fixed1(ProfileGenerator p)
        {
            StructureDefinition profile = CreateObservation("Fixed1");

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.effective[x]");
                e.Fixed = new FhirDateTime(1002, 1, 2, 3, 4, 5, new TimeSpan(0));
            }

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.value[x]");
                e.Fixed = new Quantity(10, "things", "www.things.com");
            }

            SnapshotCreator.Create(profile);
            p.AddProfile(profile);
        }
Пример #11
0
        public void CreateGenTest()
        {
            ProfileGenerator p = new ProfileGenerator(ProfileGenerator.OutputLanguageType.CSharp,
                                                      OutputNameSpace,
                                                      GenDir);

            //$this.Create_NoModObservation(p);
            //$this.Create_CardinalityModObservation(p);
            //$this.Create_Fixed(p);
            //$this.Create_Fixed1(p);
            //$this.Create_Fixed2(p);
            //$this.Create_Components(p);
            this.Create_SlicedMultiple(p);
            bool success = p.Process();

            StringBuilder sb = new StringBuilder();

            p.FormatMessages(sb);
            Trace.WriteLine(sb.ToString());
            Assert.True(success == true);
        }
Пример #12
0
    private void Awake()
    {
        if (GameProcess.InstanceStatic != null)
        {
            if (GameProcess.InstanceStatic == this)
            {
                return;
            }

            Debug.LogError("Multiple instance of GameProcess;");
            Destroy(this);
            return;
        }

        GameProcess.InstanceStatic = this;

        this.ContentLoader.Load();
        this.profileGenerator = new ProfileGenerator(this.ContentLoader.Database);

        this.cardHandler.OnContentLoaded(this.FirstProfile);
        this.CloseChatRoom();;
    }
        public async Task <int> AddProfiles(int count)
        {
            var profileGenerator = new ProfileGenerator();

            var batchSize         = 1000;
            var generatedProfiles = 0;

            while (generatedProfiles < count)
            {
                var numberOfProfilesToInsert = count - generatedProfiles < batchSize
                    ? count - generatedProfiles
                    : batchSize;

                var profiles = profileGenerator.GenerateProfiles(numberOfProfilesToInsert);

                localDbContext.Profiles.AddRange(profiles);
                await localDbContext.SaveChangesAsync();

                generatedProfiles += numberOfProfilesToInsert;
            }

            return(generatedProfiles);
        }
Пример #14
0
        void Create_SlicedMultiple(ProfileGenerator p)
        {
            StructureDefinition profile = CreateObservation("SlicedMultiple");

            {
                ElementDefinition e = profile.Differential.Element.GetOrCreateElement("Observation.component");
                e.Slicing = new ElementDefinition.SlicingComponent
                {
                    ElementId = "ObservationComponentSlice",
                    Ordered   = false,
                    Rules     = ElementDefinition.SlicingRules.Open
                };
                e.Slicing.Discriminator.Add(new ElementDefinition.DiscriminatorComponent
                {
                    Type = ElementDefinition.DiscriminatorType.Value,
                    Path = "code"
                });
            }

            {
                ElementDefinition e = new ElementDefinition
                {
                    ElementId = "Observation.component:Slice1",
                    Path      = "Observation.component",
                    SliceName = "Slice1"
                };
                profile.Differential.Element.Add(e);
            }

            {
                ElementDefinition e = new ElementDefinition
                {
                    Path      = "Observation.component.code",
                    ElementId = "Observation.component:Slice1.code",
                    Fixed     = new CodeableConcept("http://www.test.com/SliceSystem", "Slice1Code")
                };
                profile.Differential.Element.Add(e);
            }

            {
                ElementDefinition e = new ElementDefinition
                {
                    ElementId = "Observation.component:Slice2",
                    Path      = "Observation.component",
                    SliceName = "Slice2"
                };
                profile.Differential.Element.Add(e);
            }

            {
                ElementDefinition e = new ElementDefinition
                {
                    Path      = "Observation.component.code",
                    ElementId = "Observation.component:Slice2.code",
                    Fixed     = new CodeableConcept("http://www.test.com/SliceSystem", "Slice2Code")
                };
                profile.Differential.Element.Add(e);
            }

            SnapshotCreator.Create(profile);
            p.AddProfile(profile);
            profile.SaveJson($@"c:\Temp\SlicedMultiple.json");
        }
Пример #15
0
 public CSCodeFormatter(ProfileGenerator gen)
 {
     this.gen  = gen;
     this.code = new CodeEditor();
 }