private bool CheckLoginData()
        {
            var config = new Configuration();

            _settings = config.GetSettings().Git;

            return(!(string.IsNullOrEmpty(_settings.User) || string.IsNullOrEmpty(_settings.Password)) || !string.IsNullOrEmpty(_settings.Token));
        }
Beispiel #2
0
        private static void DevHelpersGUI()
        {
            Skin.StartSection("Helpers (Dev Only)", false);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Reset Twitter Access"))
            {
                if (EditorUtility.DisplayDialog("Reset Twitter OAuth Tokens?",
                                                "Do you also want to clear the Twitter access tokens?",
                                                "Yes", "Do Not Clear Them"))
                {
                    TwitterSettings.ClearAccessTokens();
                }
            }

            if (GUILayout.Button("Reset Meta Data"))
            {
                EntryPanelSettings.ResetMetaData();
            }

            if (GUILayout.Button("Reset All EditorPrefs"))
            {
                if (EditorUtility.DisplayDialog("Reset Everything",
                                                "Are you sure you want to reset everything? " +
                                                "No data will be deleted, but all settings will be reset. " +
                                                "This should only be used if you know what you are doing.\n\n " +
                                                "Note, the DevLogger window will be closed, you should reopen it from the `Tools/Wizards Code` menu.",
                                                "Yes, Reset",
                                                "No, do not reset"))
                {
                    Settings.Reset();
                    EntryPanelSettings.Reset();
                    GitSettings.Reset();
                    TwitterSettings.Reset();
                    DiscordSettings.Reset();
                    window.Close();
                }
            }

            if (GUILayout.Button("Dump Window Names"))
            {
                EditorWindow[] allWindows = Resources.FindObjectsOfTypeAll <EditorWindow>();
                foreach (EditorWindow window in allWindows)
                {
                    Debug.Log("Window name: " + window);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #3
0
        static int Main(string[] args)
        {
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
                                .AddEnvironmentVariables("ChangeLog:")
                                .AddCommandLine(args)
                                .Build();

            var githubSettings = new GithubSettings();

            configuration.Bind(githubSettings);

            var gitSettings = new GitSettings();

            configuration.Bind(gitSettings);

            var cosmosDbSettings = new CosmosDbSettings();

            configuration.Bind(cosmosDbSettings);

            var gitHubService          = new GithubService(githubSettings);
            var gitService             = new GitService(gitSettings);
            var cosmoDbRepository      = new CosmosDbRepository(cosmosDbSettings);
            var directAccessRepository = new DirectAccessChangeLogRepository(gitHubService, gitService);

            var app = new CommandLineApplication();

            app.HelpOption(inherited: true);

            var showCommand = new ShowCommand(cosmoDbRepository, directAccessRepository);
            var loadCommand = new LoadCommand(cosmoDbRepository, directAccessRepository);

            app.Command("show", showCommand.Configure);
            app.Command("load", loadCommand.Configure);

            app.OnExecute(() =>
            {
                Console.WriteLine("Specify a subcommand");
                app.ShowHelp();
                return(1);
            });

            return(app.Execute(args));
        }
        public AppSettings()
        {
            _settings = new NameValueCollection(ConfigurationManager.AppSettings);

            var missing = Values.FirstOrDefault(kvp => kvp.Value.ToUpper().Trim() == "#TBD");
            if(missing.Key != null)
            {
                throw new ConfigurationErrorsException(
                    "Missing required configuration value {0}".FormatFrom(missing.Key));
            }

            _settings = _settings.ExpandTokens();

            Server = new ServerSettings(_settings);
            Git = new GitSettings(_settings);
            Env = new EnvSettings(_settings);
            Smtp = new SmtpSettings(_settings);
        }
Beispiel #5
0
 public GitService(GitSettings settings)
 {
     _settings = settings;
 }
Beispiel #6
0
 public async Task SaveSettings([FromBody] GitSettings settings)
 {
     await _settingsService.Set(Const.PluginName, settings);
 }