Имеется 2 проекта в одном солюшене VB.NET, где первый - как DLL, прилинкованый ко второму
Возможно ли задать #Const область видимости для всего солюшена? Т.е. хочу чтобы основной проект задавал константу второму
Хакер писал(а):Имеется в виду VB.NET что-ли?
Хакер писал(а):Почему тогда в этом разделе?
Imports System
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Windows.Media.Imaging
Namespace Model.Object.Engine
<Serializable()>
Public Class Assembly : Implements ISerializable, IItem
Public Property Id As Integer Implements IItem.Id
Public Property Id_Folder As Integer Implements IItem.Id_Folder
Public Property Number As String Implements IItem.Number
Public Property Name As String Implements IItem.Name
Public Property Info As String Implements IItem.Info
#If IsServer = True Then
Public Property Thumbnail As Byte() Implements IItem.Thumbnail
Public Property Image As Byte()
#Else
Public Property Thumbnail As BitmapImage Implements IItem.Thumbnail
Public Property Image As BitmapImage
#End If
Public Sub New()
End Sub
Private Sub New(ByVal Info As SerializationInfo, ByVal Context As StreamingContext)
Me.Id = Info.GetInt32("Id")
Me.Id_Folder = Info.GetInt32("Id_Folder")
Me.Name = Info.GetString("Name")
Me.Number = Info.GetString("Number")
Me.Info = Info.GetString("Info")
Dim Thumbnail_Data As Byte() = TryCast(Info.GetValue("Thumbnail", GetType(Byte())), Byte())
Dim Image_Data As Byte() = TryCast(Info.GetValue("Image", GetType(Byte())), Byte())
#If IsServer = True Then
Me.Thumbnail = Thumbnail_Data
Me.Image = Image_Data
#Else
If Not Thumbnail_Data Is Nothing AndAlso Thumbnail_Data.Length > 0 Then
Dim Thumbnail_Stream As New MemoryStream(Thumbnail_Data)
Me.Thumbnail = New BitmapImage With {.CacheOption = BitmapCacheOption.OnLoad}
Me.Thumbnail.BeginInit()
Me.Thumbnail.StreamSource = Thumbnail_Stream
Me.Thumbnail.EndInit()
End If
If Not Image_Data Is Nothing AndAlso Image_Data.Length > 0 Then
Dim Image_Stream As New MemoryStream(Image_Data)
Me.Image = New BitmapImage With {.CacheOption = BitmapCacheOption.OnLoad}
Me.Image.CacheOption = BitmapCacheOption.OnLoad
Me.Image.BeginInit()
Me.Image.StreamSource = Image_Stream
Me.Image.EndInit()
End If
#End If
End Sub
Public Sub GetObjectData(ByVal Info As SerializationInfo, ByVal Context As StreamingContext) Implements ISerializable.GetObjectData
Info.AddValue("Id", Me.Id)
Info.AddValue("Id_Folder", Me.Id_Folder)
Info.AddValue("Name", Me.Name)
Info.AddValue("Number", Me.Number)
Info.AddValue("Info", Me.Info)
#If IsServer = True Then
Info.AddValue("Thumbnail", Me.Thumbnail)
Info.AddValue("Image", Me.Image)
#Else
If Not Me.Thumbnail Is Nothing Then
Dim Thumbnail_Stream As Stream = Me.Thumbnail.StreamSource
Dim Thumbnail_Data As Byte() = Nothing
If Not Thumbnail_Stream Is Nothing AndAlso Thumbnail_Stream.Length > 0 Then
ReDim Thumbnail_Data(Convert.ToInt32(Thumbnail_Stream.Length))
Thumbnail_Stream.Read(Thumbnail_Data, 0, Convert.ToInt32(Thumbnail_Stream.Length))
Info.AddValue("Thumbnail", Thumbnail_Data)
Else
Info.AddValue("Thumbnail", Nothing, GetType(Byte()))
End If
Else
Info.AddValue("Thumbnail", Nothing, GetType(Byte()))
End If
If Not Me.Image Is Nothing Then
Dim Image_Stream As Stream = Me.Image.StreamSource
Dim Image_Data As Byte() = Nothing
If Not Image_Stream Is Nothing AndAlso Image_Stream.Length > 0 Then
ReDim Image_Data(Convert.ToInt32(Image_Stream.Length))
Image_Stream.Read(Image_Data, 0, Convert.ToInt32(Image_Stream.Length))
Info.AddValue("Image", Image_Data)
Else
Info.AddValue("Image", Nothing, GetType(Byte()))
End If
Else
Info.AddValue("Image", Nothing, GetType(Byte()))
End If
#End If
End Sub
End Class
End Namespace
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 42