Esempio n. 1
0
        public string ToggleEncryption(IWin32Window window)
        {
            string output    = "";
            string directory = ConfigFilePath.Substring(0, ConfigFilePath.Length - 11);

            if (IsEncrypted)
            {
                // decrypt
                output = Program.RunTask("-pdf \"{0}\" \"{1}\"", SectionName, directory);
                if (Program.IsSuccess(output))
                {
                    IsEncrypted = false;
                }
            }
            else
            {
                // encrypt
                string keyProvider = GetKeyProvider(window);
                if (!String.IsNullOrEmpty(keyProvider))
                {
                    output = Program.RunTask("-pef \"{0}\" \"{1}\" -prov \"{2}\"", SectionName, directory, keyProvider);
                    if (Program.IsSuccess(output))
                    {
                        IsEncrypted = true;
                    }
                }
            }
            Program.ShowMessageBox(window, output);
            return(output);
        }
Esempio n. 2
0
        private string CadConexion()
        {
            string         cadena         = "";
            Settings       _settings      = new Settings();
            ConfigFilePath configfilepath = new ConfigFilePath();

            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

            path = path.Substring(6);
            path.Replace("\\", "/");
            configfilepath.PathFileConfig = path + "/ConnectionDB.xml";

            appConfigurationDatabaseConnection _appConfigurationDB = _settings.GetConfigurationDatabaseConnection(configfilepath);

            user   = Utilities.DecryptRijndael(_appConfigurationDB.User, "");
            pwd    = Utilities.DecryptRijndael(_appConfigurationDB.Password, "");
            bd     = Utilities.DecryptRijndael(_appConfigurationDB.DatabaseName, "");
            server = Utilities.DecryptRijndael(_appConfigurationDB.ServerName, "");
            tipobd = Utilities.DecryptRijndael(_appConfigurationDB.DatabaseType, "");

            tipobd = tipobd.ToLower();
            if (tipobd.Equals("oraclesource"))
            {
                cadena = "User ID=" + user + ";Password="******";Data Source=" + server;
                //cadena = "Data Source=" + server + ";Persist Security Info=True;User ID=" + user + ";Password="******";Unicode=True";
            }
            else if (tipobd.Equals("sqlsource"))
            {
                cadena = "data source = " + server + "; initial catalog = " + bd + "; user id = " + user + "; password = " + pwd;
            }
            return(cadena);
        }
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Name?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Path?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ConfigFilePath?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (FileSystemAssemblyName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (GACAssemblyName?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Esempio n. 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = IsSpecFlowProject.GetHashCode();
         hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (GeneratorFolder != null ? GeneratorFolder.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ConfigFilePath != null ? ConfigFilePath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Traits != null ? Traits.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 5
0
#pragma warning disable S1541 // Methods and properties should not be too complex
        public override int GetHashCode()
#pragma warning restore S1541 // Methods and properties should not be too complex
        {
            unchecked
            {
                var hashCode = Name?.GetHashCode() ?? 0;
                hashCode = (hashCode * 397) ^ (Path?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (ConfigFilePath?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (FileSystemAssemblyName?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (GACAssemblyName?.GetHashCode() ?? 0);
                return(hashCode);
            }
        }
Esempio n. 6
0
        public override async Task LoadConfigurations()
        {
            string json;

            if (ConfigFilePath.IsHttpUrl())
            {
                json = await new HttpClient().GetStringAsync(ConfigFilePath);
            }
            else
            {
                json = File.ReadAllText(ConfigFilePath);
            }

            Configurations = JsonConvert.DeserializeObject <Dictionary <string, object> >(json);
        }
Esempio n. 7
0
        public WebsiteUIViewModel()
        {
            OpenWebsitesCommand = AsyncCommand.Create(token => OpenWebsitesAsync(_siteDelay, MyWebsiteList, token));

            SiteDelay = Properties.Settings.Default.WebsiteDelay;

            if (Properties.Settings.Default.WebsiteConfigPath == "")
            {
                Properties.Settings.Default.WebsiteConfigPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            ConfigFilePath     = Properties.Settings.Default.WebsiteConfigPath;
            ConfigFilePathText = ConfigFilePath;

            if (ConfigFilePath.Contains("xml"))
            {
                DeserializeSettings();
            }
        }
Esempio n. 8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (ConfigFilePath.Length != 0)
            {
                hash ^= ConfigFilePath.GetHashCode();
            }
            if (FlagFilePath.Length != 0)
            {
                hash ^= FlagFilePath.GetHashCode();
            }
            hash ^= readers_.GetHashCode();
            return(hash);
        }
        protected override string GenerateCommandLineCommands()
        {
            StringBuilder qualifierString = new StringBuilder();

            qualifierString.Append(string.Join("_", LanguageQualifiers.Where(x => !string.IsNullOrWhiteSpace(x))));

            List <string> argv = new List <string>();

            argv.Add("createconfig");
            argv.Add("/cf");
            argv.Add(ConfigFilePath.GetMetadata("FullPath"));
            argv.Add("/dq");
            argv.Add(qualifierString.ToString());
            argv.Add("/pv");
            argv.Add("10.0");
            argv.Add("/o");

            return(string.Join(" ", argv.Select(arg => $"\"{arg}\"")));
        }
Esempio n. 10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (ConfigFilePath.Length != 0)
            {
                hash ^= ConfigFilePath.GetHashCode();
            }
            if (FlagFilePath.Length != 0)
            {
                hash ^= FlagFilePath.GetHashCode();
            }
            if (Interval != 0)
            {
                hash ^= Interval.GetHashCode();
            }
            return(hash);
        }
Esempio n. 11
0
        public override bool Execute()
        {
            var msg = new BuildMessageEventArgs("Templator Syntax checking", "", "TemplatorSyntaxChecker", MessageImportance.Normal);

            BuildEngine.LogMessageEvent(msg);
            if (ConfigFilePath.IsNullOrWhiteSpace())
            {
                var proj       = ProjectCollection.GlobalProjectCollection.GetLoadedProjects(ProjectPath).FirstOrDefault() ?? new Project(ProjectPath);
                var configFile = proj.GetItemsByEvaluatedInclude(TemplatorConfig.DefaultConfigFileName).FirstOrDefault();

                if (configFile != null)
                {
                    ConfigFilePath = configFile.EvaluatedInclude;
                }
            }

            TemplatorConfig config;

            if (ConfigFilePath.IsNullOrWhiteSpace())
            {
                config = TemplatorConfig.DefaultInstance;
                const string url = "https://github.com/djsxp/Templator/blob/master/project/Templator/TemplatorConfig.xml";
                msg = new BuildMessageEventArgs("Unable to find '{0}', using defaults, for a config file, please find; '{1}'".FormatInvariantCulture(TemplatorConfig.DefaultConfigFileName, url), "", "TemplatorSyntaxChecker", MessageImportance.Normal);
                BuildEngine.LogMessageEvent(msg);
            }
            else
            {
                try
                {
                    config = TemplatorConfig.FromXml(ConfigFilePath);
                    var path = config.CustomOptions.EmptyIfNull().PropertyOfFirstOrDefault(c => c.Category == ConfigCategory && c.Key == "Path", pr => pr.Value);
                    Path = path ?? Path;
                    var filter = config.CustomOptions.EmptyIfNull().PropertyOfFirstOrDefault(c => c.Category == ConfigCategory && c.Key == "Filters", pr => pr.Value);
                    Filters = filter ?? Filters;
                    var depth = config.CustomOptions.EmptyIfNull().PropertyOfFirstOrDefault(c => c.Category == ConfigCategory && c.Key == "Depth", pr => pr.Value);
                    int d;
                    Depth = int.TryParse(depth, out d) ? d : Depth;
                }
                catch (Exception e)
                {
                    var message = new BuildErrorEventArgs("TemplatorSyntaxConfig", "TemplatorConfigLoadError", ConfigFilePath, 0, 0, 0, 0, e.Message, "TemplatorBuildTask", "TemplatorBuildTask");
                    BuildEngine.LogErrorEvent(message);
                    return(false);
                }
            }
            if (Path.IsHtmlNullOrWhiteSpace() || !Directory.Exists(Path))
            {
                var message = new BuildErrorEventArgs("TemplatorSyntaxConfig", "Unable to find the template path: '{0}'".FormatInvariantCulture(Path), "project", 0, 0, 0, 0, "", "TemplatorBuildTask", "TemplatorBuildTask");
                BuildEngine.LogErrorEvent(message);
                return(false);
            }
            string[] filters = null;
            if (!Filters.IsNullOrWhiteSpace())
            {
                filters = Filters.Split(',');
            }
            var logger = new TemplatorLogger();

            config.Logger = logger;
            var p = new TemplatorParser(config);

            p.GrammarCheckDirectory(Path, filters, Depth);
            if (p.ErrorCount > 0)
            {
                foreach (var m in logger.Errors)
                {
                    var message = new BuildErrorEventArgs("TemplatorSyntaxChecker", "TemplatorSyntaxError", m.FileName, m.Line + 1, m.Column + 1, m.EndLineNumber + 1, m.EndColumnNumber + 1, m.Message, "TemplatorBuildTask", "TemplatorBuildTask");
                    BuildEngine.LogErrorEvent(message);
                }
            }
            return(p.ErrorCount == 0);
        }