Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }