[]
        
(Showing Draft Content)

C1.WPF.Document.Utils

Utils Class

Contains common functions.

Inheritance
Utils
Namespace: C1.WPF.Document
Assembly: C1.WPF.Document.4.6.2.dll
Syntax
public static class Utils

Fields

Name Description
ZeroPoint
ZeroRect
ZeroSize

Methods

Name Description
AreObjectArraysEqual(object[], object[])

Compares two object arrays using AreObjectsEqual(object, object) method, returns true if arrays have same size and contains same objects.

AreObjectsEqual(object, object)

Compares two objects using Equals() methods, returns true if both objects are null. Null and System.DBNull interpretted as same values.

AsNumber(object)

For internal use.

Assign<T>(object, T, ref T)

Assigns all from another object.

Assign<T>(T, ref T)

Assigns all from another object.

BarCodeEnumToCodeType(BarCodeEnum)

Converts BarCodeEnum value to C1.BarCode.CodeType value.

Compare(string, int, string, int, int, bool)

Compares two strings, could be used in Xaml and WinForms.

CopyStream(Stream, Stream)

Copies content of one stream to another.

DeflateHalfLine(Rect, double, double, double, double)

Substracts half of left, top etc from the appropriate edge of the rect.

FastFind(int[], int, out int)

Search the index of specified element in array of numbers.

FindTextInstances(string, string, int, int, int, bool, bool, bool)

Finds instances of text in a string.

GetDcDpi(IntPtr)

Gets the resolution for the specified device context.

GetFlag(int, int)

Determines if the flags match the mask.

GetImageEmbeddedResource(Assembly, string)
GetImageEmbeddedResource(string)

Gets the image from embedded resource.

GetInterface(Type, string, bool)

Searches for the specified interface, specifying whether to do a case-insensitive search for the interface name.

GetMethod(Type, string, BindingFlags, Type[])

Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetMinMax(int, int, out int, out int)

Gets minimal and maximal numbers.

GetNearText(string, int, int, out string, out int)

Gets the text which is "near" to specified position.

GetParameterlessCtor(Type)

Returns default instance parameter-less constructor for the specified type.

GetProperty(Type, string, BindingFlags, Type, Type[])

Searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetRelativePath(string, string)

Returns the relative path, for example: GetRelativePath("c:\temp", "c:\temp\qq\zz.txt") returns "qq\zz.txt".

GetResourceImage(Assembly, string)

Gets the resource image.

GetResourceStream(Assembly, string)

Gets resource stream from specified assembly.

GetStringEmbeddedResource(Assembly, string)

Get string of embedded resource.

GetStringEmbeddedResource(string)

Gets the string from embedded resource.

GetWord(string, int, out int, out int)

Gets the word in the text near to specified position.

InflateHalfLine(Rect, double, double, double, double)

Adds half of left, top etc to the appropriate edge of the rect.

IsCancelled(AggregateException)

Determines if task cancelled by an exception used to communicate task cancellation.

IsCulturesSame(CultureInfo, CultureInfo)

Determines if the culture name is the same.

IsEmpty(object)

Returns a value indicating whether a value is null, System.DBNull or empty array.

IsEnum(Type)

Gets a value indicating whether the current Type represents an enumeration.

IsNull(object)

Returns a value indicating whether a value is null or System.DBNull.

IsNumber(object)

Checks whether object represents numeric value, i.e. it is byte, integer, float etc.

IsValueType(Type)

Gets a value indicating whether the Type is a value type.

IsWholeWord(string, string, int)

Determines if the entire word is contained in the specified string.

ReadMetafileFromMemory(byte[])

Reads a Metafile from a byte array.

SamePaperSizes(Size, Size)

Tests two sizes for equality allowing a small margin for rounding errors.

SetFlag(ref int, int, bool)

Sets the flags by mask.

Swap<T>(ref T, ref T)

Swaps two values.

ToTwips(double, double)

Converts value in pixels to the value in twips.

TryAsNumber(object, out double)

Checks whether object represents numeric value, i.e. it is byte, integer, float etc and converts it to double. Returns false if object is not number.

TryObjectAsDouble(object, CultureInfo, out double)

Tries convert object to double.

ValidateFileName(string)

Check specified string and removed all characters which can not be in file name.

WriteImageToFile(Image, ImageFormat, string)

Writes specified image to file.

WriteImageToStream(C1ImageHelper, Stream)

Writes specified image to stream.

WriteImageToStream(Image, ImageFormat, Stream)

Writes specified image to stream.

WriteMetafileToFile(Metafile, string)

Serializes a Metafile to a disk file.

WriteMetafileToMemory(Metafile)

Writes a Metafile to a byte array.

WriteMetafileToStream(Metafile, Stream)

Serializes a Metafile to a Stream.