コード例 #1
0
ファイル: Profile.cs プロジェクト: Tristyn/if_source
    public static void Save(ProfileOptions profileOptions = null)
    {
        try
        {
            if (profileOptions == null)
            {
                profileOptions = new ProfileOptions();
            }
            string path = profileOptions.path;
            Directory.CreateDirectory(profileOptions.directory);
            string saveJson     = BuildProfileJson(profileOptions);
            string tempFilePath = path + ".tmp";
            File.WriteAllText(tempFilePath, saveJson);
            if (File.Exists(path))
            {
                File.Replace(tempFilePath, path, null);
            }
            else
            {
                File.Move(tempFilePath, path);
            }
#if UNITY_WEBGL && !UNITY_EDITOR
#pragma warning disable CS0618 // Type or member is obsolete
            // Required to flush the WebGL file cache to IndexedDB. This will annoyingly log the command
            Application.ExternalEval("_JS_FileSystem_Sync();");
#pragma warning restore CS0618 // Type or member is obsolete
#endif
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
        }
    }
コード例 #2
0
 private void ResolveTemplates(ProfileOptions options, string relativeRoot = null)
 {
     ProjectTemplates     = GetTemplates(options, PerProject, relativeRoot);
     ProfileTemplates     = GetTemplates(options, PerProfile, relativeRoot);
     EntityTemplates      = GetTemplates(options, PerEntity, relativeRoot);
     EntityModelTemplates = GetTemplates(options, PerEntityModel, relativeRoot);
 }
コード例 #3
0
        private void GetProfile()
        {
            Console.WriteLine("Calling GetProfile()...");

            var result =
                _personalityInsight.GetProfile(ProfileOptions.CreateOptions()
                                               .WithTextPlain()
                                               .AsEnglish()
                                               .AcceptJson()
                                               .AcceptEnglishLanguage()
                                               .WithBody("some text"));

            if (result != null)
            {
                if (result.Personality != null && result.Personality.Count > 0)
                {
                    foreach (TraitTreeNode node in result.Personality)
                    {
                        Console.WriteLine("Name: {0} | RawScore: {1}", node.Name, node.RawScore);
                    }
                }
                else
                {
                    Console.WriteLine("Could not find personality.");
                }
            }
            else
            {
                Console.WriteLine("Results are null.");
            }
        }
コード例 #4
0
        public void certificateProfile()
        {   //using Chrome
            using (GlobalDefinitions.driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            //Using Firefox
            //using (GlobalDefinitions.driver = new FirefoxDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                string ProfileMenuOption = "Profile";
                string addNewOption      = "Certifications";

                //sign in
                SignIn newSignIn = new SignIn();
                newSignIn.LoginSteps();

                //MenuOption to Click
                ClickMenu clickMenu = new ClickMenu();
                clickMenu.clickMenuOptions(ProfileMenuOption);

                //click on options Language, Skills, Education, Certifications
                clickMenu.clickSubMenuOptions(addNewOption);

                //click on Add New button
                ProfileOptions addNewButton = new ProfileOptions();
                addNewButton.clickAddNew(addNewOption);

                //add and verify Skill
                ProfileCertification addCertification = new ProfileCertification();
                addCertification.addNewCertification();
                addCertification.rowCertificatePresent();
            }
        }
コード例 #5
0
        public void languageProfile()
        {   //using Chrome
            using (GlobalDefinitions.driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            //Using Firefox
            //using (GlobalDefinitions.driver = new FirefoxDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                string ProfileMenuOption = "Profile";
                string addNewOption      = "Languages";

                //sign in
                SignIn newSignIn = new SignIn();
                newSignIn.LoginSteps();

                //MenuOption to Click
                ClickMenu clickMenu = new ClickMenu();
                clickMenu.clickMenuOptions(ProfileMenuOption);

                //click on options Language, Skills, Education, Certifications
                clickMenu.clickSubMenuOptions(addNewOption);

                //click on Add New button
                ProfileOptions addNewButton = new ProfileOptions();
                addNewButton.clickAddNew(addNewOption);


                //add langauge
                ProfileLanguage addLangauge = new ProfileLanguage();
                addLangauge.addNewLanguage();
                //taking screenshot
                SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "LangaugeAddedSuccessfully");
            }
        }
コード例 #6
0
        public static int ProfileHandler(ProfileOptions opts)
        {
            var profile = Me.Get();

            Console.WriteLine(profile);
            return(0);
        }
コード例 #7
0
 public ProfileOptionsActionsPage(ProfileOptions profile)
 {
     _profile = profile;
     Pages    = profile.Actions;
     SyncPagesWithActionCollection(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, profile.Actions));
     CollectionChangedEventManager.AddHandler(profile.Actions, SyncPagesWithActionCollection);
 }
コード例 #8
0
ファイル: ModelGenerator.cs プロジェクト: ebekker/conjure
        public EntityContext Generate(ProfileOptions options, DatabaseModel databaseModel, IRelationalTypeMappingSource typeMappingSource)
        {
            if (databaseModel == null)
            {
                throw new ArgumentNullException(nameof(databaseModel));
            }

            _logger.LogInformation("Building code generation model from database: {databaseName}", databaseModel.DatabaseName);

            _options    = options ?? throw new ArgumentNullException(nameof(options));
            _typeMapper = typeMappingSource;

            var entityContext = new EntityContext();

            entityContext.DatabaseName = databaseModel.DatabaseName;

            // update database variables
            _options.Database.ModelDatabaseName = ToLegalName(databaseModel.DatabaseName);

            string projectNamespace = _options.Project.Namespace;

            _options.Project.Namespace = projectNamespace;

            string contextClass = _options.Data.Context.Name;

            contextClass = _namer.UniqueClassName(contextClass);

            string contextNamespace = _options.Data.Context.Namespace;
            string contextBaseClass = _options.Data.Context.BaseClass;

            entityContext.ContextClass     = contextClass;
            entityContext.ContextNamespace = contextNamespace;
            entityContext.ContextBaseClass = contextBaseClass;

            var tables = databaseModel.Tables;

            foreach (var table in tables)
            {
                if (IsIgnored(table, _options.Database.Exclude))
                {
                    _logger.LogDebug("  Skipping Table : {schema}.{name}", table.Schema, table.Name);
                    continue;
                }

                _logger.LogDebug("  Processing Table : {schema}.{name}", table.Schema, table.Name);

                _options.Variables.Set(VariableConstants.TableSchema, ToLegalName(table.Schema));
                _options.Variables.Set(VariableConstants.TableName, ToLegalName(table.Name));

                var entity = GetEntity(entityContext, table);
                GetModels(entity);
            }

            _options.Variables.Remove(VariableConstants.TableName);
            _options.Variables.Remove(VariableConstants.TableSchema);

            return(entityContext);
        }
 public void GetProfile_Success()
 {
     ProfileOptions.CreateOptions()
     .WithTextPlain()
     .AsEnglish()
     .AcceptJson()
     .AcceptEnglishLanguage()
     .WithBody("");
 }
コード例 #10
0
 public DirtyProfileMacroEditor(
     IProject project,
     ICommunicationChannel channel,
     ProfileOptions dirtyProfile)
 {
     _project      = project;
     _channel      = channel;
     _dirtyProfile = dirtyProfile;
 }
コード例 #11
0
ファイル: ModelCacheBuilder.cs プロジェクト: ebekker/conjure
        public bool RefreshCache(ProfileOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(RefreshFromScratch(options));
        }
コード例 #12
0
        private void btnAddScreenshotProfile_Click(object sender, EventArgs e)
        {
            ProfileOptions profile = new ProfileOptions()
            {
                Name = "New Profile"
            };

            listBoxProfiles.Items.Add(profile);
            App.Settings.Profiles.Add(profile);
            listBoxProfiles.SelectedIndex = (listBoxProfiles.Items.Count - 1);
        }
コード例 #13
0
ファイル: Thumbnailer.cs プロジェクト: viwhi1/TDMaker
        public Thumbnailer(MediaFile mf, string ssDir, ProfileOptions options)
        {
            MediaFile = mf;
            ScreenshotDir = ssDir;
            Options = options;

            TimeSlice = GetTimeSlice(Options.ScreenshotCount);
            for (int i = 1; i < Options.ScreenshotCount + 2; i++)
            {
                MediaSeekTimes.Add(GetTimeSlice(Options.ScreenshotCount, 2) * i);
            }
        }
コード例 #14
0
ファイル: GenerateCommand.cs プロジェクト: ebekker/conjure
        public static ITemplatesConfig ResolveTemplates(ProfileOptions options)
        {
            var templatesPath = options.Project.Templates;

            if (string.IsNullOrEmpty(templatesPath))
            {
                templatesPath = "asm://Conjure.EFX.DotNetTool/res.templates.yaml";
            }

            return(TemplatesConfig.Load(options, templatesPath,
                                        options.Options.ProfilePath));
        }
コード例 #15
0
        private void btnRemoveScreenshotProfile_Click(object sender, EventArgs e)
        {
            int sel = listBoxProfiles.SelectedIndex;

            if (listBoxProfiles.SelectedIndex > 0 && App.Settings.Profiles.Count > listBoxProfiles.SelectedIndex)
            {
                ProfileOptions profile = App.Settings.Profiles[listBoxProfiles.SelectedIndex];
                App.Settings.Profiles.Remove(profile);
                listBoxProfiles.Items.Remove(profile);
                listBoxProfiles.SelectedIndex = Math.Min(sel, listBoxProfiles.Items.Count - 1);
            }
        }
コード例 #16
0
 public static IEnumerable <TemplateInfo> GetTemplates(ProfileOptions options,
                                                       List <TemplateConfigInfo> tcis, string relativeRoot = null)
 {
     return(tcis == null
         ? EmptyTemplateInfos
         : tcis.Select(tci => new TemplateInfo
     {
         Name = tci.Name,
         Path = tci.Path,
         Body = GetResource(options.Variables.Evaluate(tci.Source ?? tci.Name), relativeRoot),
     }));
 }
コード例 #17
0
ファイル: ModelCacheBuilder.cs プロジェクト: ebekker/conjure
        private bool RefreshFromScratch(ProfileOptions options)
        {
            var services = new ServiceCollection();

            _logger.LogInformation("Adding EF Design-time Services");
            services.AddEntityFrameworkDesignTimeServices();

            // This part is DB-specific
            var provider     = options.Database.Provider;
            var dtsClassName = options.Database.ProviderDesignTimeServicesClass;

            var dts = GetDesignTimeServices(provider, dtsClassName);

            dts.ConfigureDesignTimeServices(services);

            var serviceProviders = services.BuildServiceProvider();
            var dbmFactory       = serviceProviders.GetRequiredService <IDatabaseModelFactory>();
            var tmSource         = serviceProviders.GetRequiredService <IRelationalTypeMappingSource>();

            var connectionString  = ResolveConnectionString(options.Database);
            var dbmFactoryOptions = new DatabaseModelFactoryOptions(
                tables: options.Database.Tables,  // null to include all
                schemas: options.Database.Schemas // null to include all
                );

            // Extract the Database Model
            _logger.LogInformation("Building DB Model");
            var dbModel = dbmFactory.Create(connectionString, dbmFactoryOptions);

            // Add a few of our own annotations for additional context
            dbModel.AddAnnotation("EFX:CreatedTime",
                                  DateTime.Now);
            dbModel.AddAnnotation("EFX:CLRVersion",
                                  System.Environment.Version);
            dbModel.AddAnnotation("EFX:OS",
                                  System.Environment.OSVersion);
            dbModel.AddAnnotation("EFX:CLI",
                                  System.Environment.CommandLine);
            dbModel.AddAnnotation("EFX:Args",
                                  System.Environment.GetCommandLineArgs().ToList());

            var dir = Path.GetFullPath(options.Options.ProfileOutputDirectory);
            var ser = Path.Combine(dir, DefaultModelCacheFileName);

            _logger.LogInformation("Computed DB model cache file: {modelCacheFile}", ser);

            Directory.CreateDirectory(dir);
            File.WriteAllText(ser, Serialize(dbModel));
            _logger.LogInformation("Serialized DB Model to cache file");

            return(true);
        }
コード例 #18
0
        public async Task RecursiveMacroInEvaluationChainTestAsync()
        {
            var props   = new Mock <IProjectProperties>();
            var options = new ProfileOptions();

            options.Macros.Add(new MacroItem("A", "$(A)", userDefined: true));
            options.Macros.Add(new MacroItem("B", "$(A)", userDefined: true));

            var evaluator = new MacroEvaluator(props.Object, _emptyTransients, EmptyRemoteEnv, new DebuggerOptions(), options);

            Assert.False((await evaluator.EvaluateAsync("$(B)")).TryGetResult(out _, out var error));
            Assert.Equal("$(B) contains a cycle: $(B) -> $(A) -> $(A)", error.Message);
        }
コード例 #19
0
    public static TemplatesConfig Load(ProfileOptions options, string source,
                                       string relativeRoot = null)
    {
        var yaml      = GetResource(source, relativeRoot);
        var yamlDeser = new DeserializerBuilder()
                        .WithNamingConvention(CamelCaseNamingConvention.Instance)
                        .Build();
        var tc = yamlDeser.Deserialize <TemplatesConfig>(yaml);

        tc.ResolveTemplates(options, relativeRoot);

        return(tc);
    }
コード例 #20
0
        public async Task ProjectPropertiesTestAsync()
        {
            var options = new ProfileOptions();

            options.Macros.Add(new MacroItem("RadDeployDir", "/home/sayaka/projects", userDefined: true));
            options.Macros.Add(new MacroItem("RadDebugScript", "$(RadDeployDir)/debug_bin.py", userDefined: true));
            options.Macros.Add(new MacroItem("RadDebugArgs", "$(RadDebugScript) --solution $(SolutionDir)", userDefined: true));

            var props = new Mock <IProjectProperties>();

            props.Setup((p) => p.GetEvaluatedPropertyValueAsync("SolutionDir")).ReturnsAsync("/opt/rocm/examples/h");

            var evaluator = new MacroEvaluator(props.Object, _emptyTransients, EmptyRemoteEnv, new DebuggerOptions(), options);
            var result    = await evaluator.EvaluateAsync("$(RadDebugArgs)");

            Assert.True(result.TryGetResult(out var evaluated, out _));
            Assert.Equal("/home/sayaka/projects/debug_bin.py --solution /opt/rocm/examples/h", evaluated);
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: digirati-labs/Digirati.JWT
        private static int LoadProfile(ProfileOptions options)
        {
            var fInfo = new FileInfo(Path.Combine(GetProfileDirectory().FullName, GetProfileFileName(options.Name)));

            if (!fInfo.Exists)
            {
                throw new UserErrorException($"Profile '{options.Name}' not found.");
            }

            var commandLine = File.ReadAllText(fInfo.FullName);

            if (string.IsNullOrWhiteSpace(commandLine))
            {
                fInfo.Delete();
                throw new UserErrorException($"Profile '{options.Name}' not found.");
            }

            return(Parse(commandLine.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries)));
        }
コード例 #22
0
ファイル: ModelCacheBuilder.cs プロジェクト: ebekker/conjure
        public DatabaseModel LoadFromCache(ProfileOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var dir = Path.GetFullPath(options.Options.ProfileOutputDirectory);
            var ser = Path.Combine(dir, DefaultModelCacheFileName);

            _logger.LogInformation("Computed DB model cache file: {modelCacheFile}", ser);

            if (!File.Exists(ser))
            {
                throw new Exception("No cached database model found; did you generate it?");
            }

            var dbModel = Deserialize(File.ReadAllText(ser));

            return(dbModel);
        }
コード例 #23
0
ファイル: Profile.cs プロジェクト: Tristyn/if_source
    public static bool Load(ProfileOptions profileOptions = null)
    {
        if (profileOptions == null)
        {
            profileOptions = new ProfileOptions();
        }

        string path = profileOptions.path;

        if (File.Exists(path))
        {
            string profileJson = File.ReadAllText(path);
            if (!LoadFromJson(profileJson))
            {
                BackupCorruptProfile(path);
                return(false);
            }
            return(true);
        }
        return(false);
    }
コード例 #24
0
        public void RecursiveMacroPreviewTest()
        {
            TestHelper.InitializePackageTaskFactory();

            var profile = new ProfileOptions();

            profile.Macros.Add(new MacroItem("A", "$(B)", userDefined: true));
            profile.Macros.Add(new MacroItem("B", "$(A)", userDefined: true));
            profile.Macros.Add(new MacroItem("C", "some independent value", userDefined: true));

            var props     = new Mock <IProjectProperties>();
            var evaluator = new MacroEvaluator(props.Object,
                                               new MacroEvaluatorTransientValues(0, @"I:\C\ftg", Array.Empty <uint>(), new ReadOnlyCollection <string>(Array.Empty <string>())),
                                               MacroEvaluatorTests.EmptyRemoteEnv,
                                               new DebuggerOptions(), profile);
            var context = new MacroEditContext("A", "$(B)", evaluator);

            var preview = context.EvaluatedValue;

            Assert.Equal("$(B) contains a cycle: $(B) -> $(A) -> $(B)", preview);
        }
コード例 #25
0
ファイル: CodeGenerator.cs プロジェクト: ebekker/conjure
    public void Generate(ProfileOptions options, DatabaseModel databaseModel, ITemplatesConfig templates,
                         CodeGeneratorWriter writer)
    {
        Options   = options ?? throw new ArgumentNullException(nameof(options));
        Templates = templates ?? throw new ArgumentNullException(nameof(templates));

        var databaseProviders = GetDatabaseProviders();

        _logger.LogInformation("Loaded database model for: {databaseName}", databaseModel.DatabaseName);

        var context = _modelGenerator.Generate(Options, databaseModel, databaseProviders.mapping);

        //var topTemplatesPath = Path.GetFullPath(Path.Combine(Options.Options.ProfilePath, "templates"));
        //_topTemplates = Directory.GetFiles(topTemplatesPath, "*.scriban-cs", SearchOption.TopDirectoryOnly);

        //var childTemplatesPath = Path.GetFullPath(Path.Combine(topTemplatesPath, "entities"));
        //_entityTemplates = Directory.GetFiles(childTemplatesPath, "*.scriban-cs", SearchOption.TopDirectoryOnly);

        //childTemplatesPath = Path.GetFullPath(Path.Combine(topTemplatesPath, "entities/models"));
        //_entityModelTemplates = Directory.GetFiles(childTemplatesPath, "*.scriban-cs", SearchOption.TopDirectoryOnly);

        GenerateFiles(context, writer);
    }
コード例 #26
0
        public Profile GetProfile(ProfileOptions options)
        {
            Profile result = null;

            try
            {
                Encoding enc = null;

                switch (options.ContentType)
                {
                case HttpMediaType.TEXT_HTML:
                case HttpMediaType.TEXT_PLAIN:
                    enc = Encoding.ASCII;
                    break;

                case HttpMediaType.APPLICATION_JSON:
                    enc = Encoding.UTF8;
                    break;
                }

                int bodySize = enc.GetByteCount(options.Text) / 1024 / 1024;



                result =
                    this.Client.WithAuthentication(UserName, Password)
                    .PostAsync($"{this.Endpoint}{PATH_GET_PROFILES}")
                    .As <Profile>()
                    .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
コード例 #27
0
        public async Task RecursiveMacroInListTestAsync()
        {
            TestHelper.InitializePackageTaskFactory();

            var profile = new ProfileOptions();

            profile.Macros.Add(new MacroItem("A", "$(B)", userDefined: true));
            profile.Macros.Add(new MacroItem("B", "$(A)", userDefined: true));
            profile.Macros.Add(new MacroItem("C", "some independent value", userDefined: true));

            var props     = new Mock <IProjectProperties>();
            var evaluator = new MacroEvaluator(props.Object,
                                               new MacroEvaluatorTransientValues(0, @"I:\C\ftg", Array.Empty <uint>(), new ReadOnlyCollection <string>(Array.Empty <string>())),
                                               MacroEvaluatorTests.EmptyRemoteEnv,
                                               new DebuggerOptions(), profile);
            var context = new MacroEditContext("A", "$(B)", evaluator);

            await context.LoadPreviewListAsync(profile.Macros, props.Object, MacroEvaluatorTests.EmptyRemoteEnv);

            var displayedMacros = context.MacroListView.SourceCollection.Cast <KeyValuePair <string, string> >();

            Assert.Contains(new KeyValuePair <string, string>("$(B)", "<$(B) contains a cycle: $(B) -> $(A) -> $(B)>"), displayedMacros);
            Assert.Contains(new KeyValuePair <string, string>("$(C)", "some independent value"), displayedMacros);
        }
コード例 #28
0
        public void skillProfile()
        {   //using Chrome
            using (GlobalDefinitions.driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            //Using Firefox
            //using (GlobalDefinitions.driver = new FirefoxDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                string ProfileMenuOption = "Profile";
                string addNewOption      = "Skills";

                //sign in
                SignIn newSignIn = new SignIn();
                newSignIn.LoginSteps();

                //MenuOption to Click
                ClickMenu clickMenu = new ClickMenu();
                clickMenu.clickMenuOptions(ProfileMenuOption);

                //click on options Language, Skills, Education, Certifications
                clickMenu.clickSubMenuOptions(addNewOption);

                //click on Add New button
                ProfileOptions addNewButton = new ProfileOptions();
                addNewButton.clickAddNew(addNewOption);

                //add and verify Skill
                ProfileSkill addSkill = new ProfileSkill();
                addSkill.addNewSkill();
                addSkill.rowSkillPresent();
            }

            //[AssemblyCleanup]
            //public static void TearDown()
            //{
            //    GlobalDefinitions.driver.Quit();
            //}
        }
コード例 #29
0
ファイル: Main.cs プロジェクト: tsinghua-io/learn
 public static int ProfileHandler(ProfileOptions opts)
 {
     var profile = Me.Get();
     Console.WriteLine(profile);
     return 0;
 }
コード例 #30
0
ファイル: FFmpegThumbnailer.cs プロジェクト: viwhi1/TDMaker
 public FFmpegThumbnailer(MediaFile mf, string ssDir, ProfileOptions options)
     : base(mf, ssDir, options)
 {
     ThumbnailerPath = App.Settings.FFmpegPath;
 }
コード例 #31
0
 public ProfileOptionsFactory(ProfileInfo profile)
 {
     _profileOptions = new ProfileOptions(profile);
     _profileOptions.Variables.ShouldEvaluate = false;
     _scriptCount = 0;
 }
コード例 #32
0
 public MyHelper(IOptions<ProfileOptions> options)
 {
     _options = options.Value;
 {
コード例 #33
0
ファイル: Profile.cs プロジェクト: Tristyn/if_source
    public static string BuildProfileJson(ProfileOptions profileOptions)
    {
        Profile profile = BuildProfile();

        return(JsonConvert.SerializeObject(profile, profileOptions.formatting));
    }
コード例 #34
0
ファイル: TorrentCreator.cs プロジェクト: viwhi1/TDMaker
 public TorrentCreateInfo(ProfileOptions profile, string mediaLoc)
 {
     this.Profile = profile;
     this.MediaLocation = mediaLoc;
     this.TorrentFolder = DefaultTorrentFolder;
 }
コード例 #35
0
ファイル: MainWindow.cs プロジェクト: viwhi1/TDMaker
 private void btnAddScreenshotProfile_Click(object sender, EventArgs e)
 {
     ProfileOptions profile = new ProfileOptions() { Name = "New Profile" };
     listBoxProfiles.Items.Add(profile);
     App.Settings.Profiles.Add(profile);
     listBoxProfiles.SelectedIndex = (listBoxProfiles.Items.Count - 1);
 }