コード例 #1
0
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if(source == null || serializer == null) return;
            base.Copy(source, serializer);

            var typedSource = source as OutlookInformation;
            if(typedSource != null)
            {
                DownloadInfoLevel = typedSource.DownloadInfoLevel;
                UploadInfoLevel = typedSource.UploadInfoLevel;
                NotifyOnDownload = typedSource.NotifyOnDownload;
                NotifyOnUpload = typedSource.NotifyOnUpload;
                MaxDownloads = typedSource.MaxDownloads;
                LinkExpiration = typedSource.LinkExpiration;
                RequestText = typedSource.RequestText;
                SendText = typedSource.SendText;
                BannerHTML = typedSource.BannerHTML;
                UseBanner = typedSource.UseBanner;
                AutoConvert = typedSource.AutoConvert;
                ConvertAbove = typedSource.ConvertAbove;
                AttachPaperclip = typedSource.AttachPaperclip;
            }
            else
            {
                JToken token;
                if(source.TryGetProperty("DownloadInfoLevel", out token) && token.Type != JTokenType.Null)
                {
                    DownloadInfoLevel = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if(source.TryGetProperty("UploadInfoLevel", out token) && token.Type != JTokenType.Null)
                {
                    UploadInfoLevel = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if(source.TryGetProperty("NotifyOnDownload", out token) && token.Type != JTokenType.Null)
                {
                    NotifyOnDownload = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if(source.TryGetProperty("NotifyOnUpload", out token) && token.Type != JTokenType.Null)
                {
                    NotifyOnUpload = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if(source.TryGetProperty("MaxDownloads", out token) && token.Type != JTokenType.Null)
                {
                    MaxDownloads = (OutlookInformationOptionInt)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionInt));
                }
                if(source.TryGetProperty("LinkExpiration", out token) && token.Type != JTokenType.Null)
                {
                    LinkExpiration = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if(source.TryGetProperty("RequestText", out token) && token.Type != JTokenType.Null)
                {
                    RequestText = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if(source.TryGetProperty("SendText", out token) && token.Type != JTokenType.Null)
                {
                    SendText = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if(source.TryGetProperty("BannerHTML", out token) && token.Type != JTokenType.Null)
                {
                    BannerHTML = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if(source.TryGetProperty("UseBanner", out token) && token.Type != JTokenType.Null)
                {
                    UseBanner = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if(source.TryGetProperty("AutoConvert", out token) && token.Type != JTokenType.Null)
                {
                    AutoConvert = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if(source.TryGetProperty("ConvertAbove", out token) && token.Type != JTokenType.Null)
                {
                    ConvertAbove = (OutlookInformationOptionInt)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionInt));
                }
                if(source.TryGetProperty("AttachPaperclip", out token) && token.Type != JTokenType.Null)
                {
                    AttachPaperclip = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
            }
        }
コード例 #2
0
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as OutlookInformation;

            if (typedSource != null)
            {
                DownloadInfoLevel = typedSource.DownloadInfoLevel;
                UploadInfoLevel   = typedSource.UploadInfoLevel;
                NotifyOnDownload  = typedSource.NotifyOnDownload;
                NotifyOnUpload    = typedSource.NotifyOnUpload;
                MaxDownloads      = typedSource.MaxDownloads;
                LinkExpiration    = typedSource.LinkExpiration;
                RequestText       = typedSource.RequestText;
                SendText          = typedSource.SendText;
                BannerHTML        = typedSource.BannerHTML;
                UseBanner         = typedSource.UseBanner;
                AutoConvert       = typedSource.AutoConvert;
                ConvertAbove      = typedSource.ConvertAbove;
                AttachPaperclip   = typedSource.AttachPaperclip;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("DownloadInfoLevel", out token) && token.Type != JTokenType.Null)
                {
                    DownloadInfoLevel = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if (source.TryGetProperty("UploadInfoLevel", out token) && token.Type != JTokenType.Null)
                {
                    UploadInfoLevel = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if (source.TryGetProperty("NotifyOnDownload", out token) && token.Type != JTokenType.Null)
                {
                    NotifyOnDownload = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if (source.TryGetProperty("NotifyOnUpload", out token) && token.Type != JTokenType.Null)
                {
                    NotifyOnUpload = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if (source.TryGetProperty("MaxDownloads", out token) && token.Type != JTokenType.Null)
                {
                    MaxDownloads = (OutlookInformationOptionInt)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionInt));
                }
                if (source.TryGetProperty("LinkExpiration", out token) && token.Type != JTokenType.Null)
                {
                    LinkExpiration = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if (source.TryGetProperty("RequestText", out token) && token.Type != JTokenType.Null)
                {
                    RequestText = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if (source.TryGetProperty("SendText", out token) && token.Type != JTokenType.Null)
                {
                    SendText = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if (source.TryGetProperty("BannerHTML", out token) && token.Type != JTokenType.Null)
                {
                    BannerHTML = (OutlookInformationOptionString)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionString));
                }
                if (source.TryGetProperty("UseBanner", out token) && token.Type != JTokenType.Null)
                {
                    UseBanner = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if (source.TryGetProperty("AutoConvert", out token) && token.Type != JTokenType.Null)
                {
                    AutoConvert = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
                if (source.TryGetProperty("ConvertAbove", out token) && token.Type != JTokenType.Null)
                {
                    ConvertAbove = (OutlookInformationOptionInt)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionInt));
                }
                if (source.TryGetProperty("AttachPaperclip", out token) && token.Type != JTokenType.Null)
                {
                    AttachPaperclip = (OutlookInformationOptionBool)serializer.Deserialize(token.CreateReader(), typeof(OutlookInformationOptionBool));
                }
            }
        }