A general method of solution of two-dimensional problems in the theory of cracks