Exemple #1
0
        public static bool HasOpenPassword(string file)
        {
            try
            {
                if (String.IsNullOrEmpty(file) ||
                    !File.Exists(file))
                {
                    throw new ArgumentException("Invalid parameter");
                }

                using (Aspose.Security security = new Aspose.Security())
                {
                    return security.HasOpenPassword(file);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }
Exemple #2
0
        public static bool HasOpenPassword(Stream file)
        {
            try
            {
                if (file == null ||
                    file.Length == 0)
                {
                    throw new ArgumentException("Invalid parameter");
                }

                using (Aspose.Security security = new Aspose.Security())
                {
                    return security.HasOpenPassword(file);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }
Exemple #3
0
        public static void Remove(string file, string password)
        {
            try
            {
                if (String.IsNullOrEmpty(file) ||
                    !File.Exists(file) ||
                    String.IsNullOrEmpty(password))
                {
                    throw new ArgumentException("Invalid parameter");
                }

                using (Aspose.Security security = new Aspose.Security())
                {
                    security.Remove(file, password);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }