Exemple #1
0
 internal PushNotificationSubscriptionItem(ICoreItem coreItem) : base(coreItem, false)
 {
     if (base.IsNew)
     {
         this.Initialize();
     }
 }
Exemple #2
0
 internal ShortcutMessage(ICoreItem coreItem) : base(coreItem, false)
 {
     if (base.IsNew)
     {
         this.InitializeNewShortcutMessage();
     }
 }
Exemple #3
0
 internal Body(ICoreItem coreItem)
 {
     Util.ThrowOnNullArgument(coreItem, "coreItem");
     this.coreItem        = coreItem;
     this.bodyReadStreams = new List <Body.IBodyStream>(1);
     this.ForceRedetectHtmlBodyCharset = false;
 }
Exemple #4
0
 public void TestMDSBloomberg()
 {
     // test basic start, request snapshot, and stop functions
     // - create a MDS client with direct connection to provider
     using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
     {
         IModuleInfo clientInfo = new V131ModuleInfo(new V131ClientInfo());
         using (ICoreClient client = new CoreClientFactory(loggerRef).SetEnv(BuildConst.BuildEnv).Create())
         {
             const string curveName  = "Orion.V5r3.Configuration.PricingStructures.QR_LIVE.RateCurve.AUD-BBR-BBSW-3M";
             ICoreItem    marketItem = client.LoadItem <Market>(curveName);
             if (marketItem == null)
             {
                 throw new ApplicationException("Market '" + curveName + "' not found!");
             }
             var market = (Market)marketItem.Data;
             //PricingStructure ps = market.Items[0];
             PricingStructureValuation psv            = market.Items1[0];
             QuotedAssetSet            quotedAssetSet = ((YieldCurveValuation)psv).inputs;
             using (IMarketDataClient mdc = new MarketDataRealtimeClient(
                        loggerRef, null, client,
                        MDSProviderId.Bloomberg))//MDSProviderId.GlobalIB
             {
                 QuotedAssetSet data = mdc.GetMarketQuotes(
                     MDSProviderId.Bloomberg, clientInfo, Guid.NewGuid(), true,
                     null,
                     quotedAssetSet).Result;
                 Assert.IsNotNull(data);
             }
         }
     }
 }
Exemple #5
0
        public Guid SaveTypedObject(Type dataType, object data, string name, NamedValueSet props, bool transient, DateTimeOffset expires)
        {
            ICoreItem item = Client.MakeTypedItem(dataType, data, name, props, transient);

            item.Expires = expires;
            return(SaveItem(item));
        }
 internal void CopyAttachmentContentFrom(CoreAttachment sourceAttachment)
 {
     this.CheckDisposed(null);
     sourceAttachment.PropertyBag.Load(InternalSchema.ContentConversionProperties);
     foreach (NativeStorePropertyDefinition property in sourceAttachment.PropertyBag.AllNativeProperties)
     {
         if (CoreAttachment.ShouldPropertyBeCopied(property, sourceAttachment.AttachmentType, this.AttachmentType))
         {
             PersistablePropertyBag.CopyProperty(sourceAttachment.PropertyBag, property, this.PropertyBag);
         }
     }
     if (sourceAttachment.AttachmentType == AttachmentType.EmbeddedMessage && this.AttachmentType == AttachmentType.EmbeddedMessage)
     {
         bool noMessageDecoding  = sourceAttachment.ParentCollection.ContainerItem.CharsetDetector.NoMessageDecoding;
         bool noMessageDecoding2 = this.parentCollection.ContainerItem.CharsetDetector.NoMessageDecoding;
         using (ICoreItem coreItem = sourceAttachment.PropertyBag.OpenAttachedItem(PropertyOpenMode.ReadOnly, InternalSchema.ContentConversionProperties, noMessageDecoding))
         {
             using (ICoreItem coreItem2 = this.PropertyBag.OpenAttachedItem(PropertyOpenMode.Create, InternalSchema.ContentConversionProperties, noMessageDecoding2))
             {
                 CoreItem.CopyItemContent(coreItem, coreItem2);
                 using (Item item = Item.InternalBindCoreItem(coreItem2))
                 {
                     item.CharsetDetector.DetectionOptions.PreferredInternetCodePageForShiftJis = coreItem.PropertyBag.GetValueOrDefault <int>(ItemSchema.InternetCpid, 50222);
                     item.LocationIdentifierHelperInstance.SetLocationIdentifier(64373U);
                     item.SaveFlags = (((PersistablePropertyBag)coreItem.PropertyBag).SaveFlags | PropertyBagSaveFlags.IgnoreMapiComputedErrors | PropertyBagSaveFlags.IgnoreAccessDeniedErrors);
                     item.Save(SaveMode.NoConflictResolution);
                 }
             }
         }
     }
     this.PropertyBag.SaveFlags |= (PropertyBagSaveFlags.IgnoreMapiComputedErrors | PropertyBagSaveFlags.IgnoreUnresolvedHeaders);
 }
Exemple #7
0
        private void ReceivePortfolioValuationRequest(ICoreItem pvReqItem)
        {
            DateTimeOffset            created = pvReqItem.Created;
            PortfolioValuationRequest pvReq   = (PortfolioValuationRequest)pvReqItem.Data;
            Guid            requestId         = new Guid(pvReq.RequestId);
            InternalRequest newRequest        = new InternalRequest(requestId, created, pvReq);
            InternalRequest oldRequest        = null;

            _OutstandingRequests.Locked((requests) =>
            {
                if (requests.TryGetValue(requestId, out oldRequest))
                {
                    // exists
                    newRequest.LatestResult = oldRequest.LatestResult;
                }
                requests[requestId] = newRequest;
            });
            if (oldRequest == null)
            {
                (new ServerRequestStatus()
                {
                    RequestId = pvReq.RequestId,
                    RequesterId = pvReq.RequesterId ?? new UserIdentity()
                    {
                        Name = this.Client.ClientInfo.Name, DisplayName = "Unknown"
                    },
                    RequesterData = pvReq.PortfolioId,
                    Status = RequestStatusEnum.Received
                }).Publish(_WorkContext.Logger, _WorkContext.Cache, TimeSpan.FromDays(1));
            }

            // dispatch worker request
            EnqueueWorkerRequest();
        }
 internal BodyTextReader(ICoreItem coreItem, BodyReadConfiguration configuration, Stream inputStream)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         Stream     stream     = null;
         TextReader textReader = null;
         bool       flag       = false;
         this.disposeTracker = this.GetDisposeTracker();
         try
         {
             if (inputStream == null)
             {
                 stream      = BodyReadStream.OpenBodyStream(coreItem);
                 inputStream = stream;
             }
             if (inputStream == null)
             {
                 inputStream = Body.GetEmptyStream();
             }
             textReader = BodyReadDelegates.CreateReader(coreItem, configuration, inputStream, out this.conversionCallbacks);
             flag       = true;
         }
         finally
         {
             if (!flag && stream != null)
             {
                 stream.Dispose();
             }
         }
         this.reader     = textReader;
         this.bodyStream = stream;
         this.isDisposed = false;
         disposeGuard.Success();
     }
 }
Exemple #9
0
        private static CultureInfo GetMdnCulture(ICoreItem item)
        {
            int         num         = 0;
            CultureInfo cultureInfo = CultureInfo.CurrentCulture;

            if (item.Session != null)
            {
                cultureInfo = item.Session.InternalPreferedCulture;
            }
            CultureInfo result = cultureInfo;
            object      obj    = item.PropertyBag.TryGetProperty(ReportMessageSchema.MessageLocaleId);

            if (obj is int)
            {
                num = (int)obj;
            }
            try
            {
                if (num != 0)
                {
                    CultureInfo cultureInfo2 = LocaleMap.GetCultureFromLcid(num);
                    if (cultureInfo2.IsNeutralCulture)
                    {
                        cultureInfo2 = new CultureInfo(cultureInfo2.Name);
                    }
                    result = cultureInfo2;
                }
            }
            catch (ArgumentException)
            {
                result = cultureInfo;
            }
            return(result);
        }
 internal FavoriteFolderEntry(ICoreItem coreItem) : base(coreItem)
 {
     if (base.IsNew)
     {
         this[StoreObjectSchema.ItemClass] = "IPM.Microsoft.WunderBar.Link";
     }
 }
Exemple #11
0
 internal GroupMailboxJoinRequestMessageItem(ICoreItem coreItem) : base(coreItem, false)
 {
     if (base.IsNew)
     {
         this[InternalSchema.ItemClass] = "IPM.GroupMailbox.JoinRequest";
     }
 }
        private static BodyReadDelegates.ConversionCreator GetConversionMethod(ICoreItem coreItem, BodyReadConfiguration configuration)
        {
            int formatIndex  = BodyReadDelegates.GetFormatIndex(coreItem.Body.RawFormat);
            int formatIndex2 = BodyReadDelegates.GetFormatIndex(configuration.Format);

            return(BodyReadDelegates.conversionCreatorsTable[formatIndex][formatIndex2]);
        }
        private static object FromRtfToRtf(ICoreItem coreItem, BodyReadConfiguration configuration, Stream bodyStream, bool createReader)
        {
            object obj    = null;
            Stream stream = null;

            try
            {
                stream = new ConverterStream(bodyStream, new RtfCompressedToRtf(), ConverterStreamAccess.Read);
                obj    = BodyReadDelegates.GetRtfStreamOrReader(stream, new RtfToRtf
                {
                    Header             = configuration.InjectPrefix,
                    Footer             = configuration.InjectSuffix,
                    HeaderFooterFormat = configuration.InjectionHeaderFooterFormat
                }, createReader);
            }
            finally
            {
                if (obj == null && stream != null)
                {
                    stream.Dispose();
                    stream = null;
                }
            }
            return(obj);
        }
        private static object FromRtfToHtml(ICoreItem coreItem, BodyReadConfiguration configuration, Stream bodyStream, bool createReader)
        {
            object obj    = null;
            Stream stream = null;

            try
            {
                stream = new ConverterStream(bodyStream, new RtfCompressedToRtf(), ConverterStreamAccess.Read);
                RtfToHtml rtfToHtml = new RtfToHtml();
                rtfToHtml.OutputEncoding     = configuration.Encoding;
                rtfToHtml.Header             = configuration.InjectPrefix;
                rtfToHtml.Footer             = configuration.InjectSuffix;
                rtfToHtml.HeaderFooterFormat = configuration.InjectionHeaderFooterFormat;
                rtfToHtml.FilterHtml         = configuration.FilterHtml;
                rtfToHtml.HtmlTagCallback    = configuration.InternalHtmlTagCallback;
                rtfToHtml.OutputHtmlFragment = configuration.IsHtmlFragment;
                if (configuration.StyleSheetLimit != null)
                {
                    TextConvertersInternalHelpers.SetSmallCssBlockThreshold(rtfToHtml, configuration.StyleSheetLimit.Value);
                }
                obj = BodyReadDelegates.GetTextStreamOrReader(stream, rtfToHtml, createReader);
            }
            finally
            {
                if (obj == null && stream != null)
                {
                    stream.Dispose();
                    stream = null;
                }
            }
            return(obj);
        }
        private static object FromRtfToText(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, bool createWriter)
        {
            Stream stream = null;
            object obj    = null;

            try
            {
                stream = new BodyCharsetDetectionStream(bodyStream, null, coreItem, BodyStreamFormat.Text, ConvertUtils.UnicodeCharset, configuration.TargetCharset, configuration.TargetCharsetFlags, null, false);
                stream = new ConverterStream(stream, new RtfToText
                {
                    OutputEncoding     = ConvertUtils.UnicodeEncoding,
                    Header             = configuration.InjectPrefix,
                    Footer             = configuration.InjectSuffix,
                    HeaderFooterFormat = configuration.InjectionHeaderFooterFormat
                }, ConverterStreamAccess.Write);
                obj = BodyWriteDelegates.GetRtfDecompressorOrUnicodeWriter(stream, createWriter);
            }
            finally
            {
                if (obj == null && stream != null)
                {
                    BodyWriteDelegates.SafeDisposeStream(stream);
                }
            }
            return(obj);
        }
Exemple #16
0
 public XmlTreeDisplay(ICoreClient client, ICoreItem coreItem)
 {
     Client   = client;
     CoreItem = coreItem;
     InitializeComponent();
     LoadData();
 }
        private static object FromTextToHtml(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, bool createWriter)
        {
            Stream stream = null;
            object obj    = null;

            try
            {
                HtmlWriteConverterStream htmlWriteConverterStream = new HtmlWriteConverterStream(bodyStream, new TextToHtml
                {
                    InputEncoding      = configuration.SourceEncoding,
                    Header             = configuration.InjectPrefix,
                    Footer             = configuration.InjectSuffix,
                    HeaderFooterFormat = configuration.InjectionHeaderFooterFormat,
                    HtmlTagCallback    = configuration.InternalHtmlTagCallback,
                    FilterHtml         = configuration.FilterHtml
                });
                stream = htmlWriteConverterStream;
                stream = new BodyCharsetDetectionStream(stream, new BodyCharsetDetectionStream.DetectCharsetCallback(htmlWriteConverterStream.SetCharset), coreItem, BodyStreamFormat.Text, configuration.SourceCharset, configuration.TargetCharset, configuration.TargetCharsetFlags, BodyWriteDelegates.GetExtraData(configuration), false);
                obj    = BodyWriteDelegates.GetStreamOrUnicodeWriter(stream, createWriter);
            }
            finally
            {
                if (obj == null && stream != null)
                {
                    BodyWriteDelegates.SafeDisposeStream(stream);
                }
            }
            return(obj);
        }
Exemple #18
0
 internal MailboxAssociationBaseItem(ICoreItem coreItem) : base(coreItem, false)
 {
     if (base.IsNew)
     {
         this.Initialize();
     }
 }
Exemple #19
0
        internal CoreRecipientCollection(ICoreItem coreItem)
        {
            bool flag = false;

            try
            {
                this.recipientTable = new RecipientTable(coreItem);
                this.coreItem       = coreItem;
                if (this.CoreItem.Session != null)
                {
                    this.recipientTable.BuildRecipientCollection(new Action <IList <NativeStorePropertyDefinition>, object[]>(this.AddRecipientFromTable));
                    this.nextRecipientRowId = this.recipientList.Count;
                    for (int i = this.recipientList.Count - 1; i >= 0; i--)
                    {
                        CoreRecipient coreRecipient = this.recipientList[i];
                        if (coreRecipient.Participant == null)
                        {
                            this.RemoveAt(i, !this.CoreItem.IsReadOnly);
                        }
                    }
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Dispose();
                }
            }
        }
Exemple #20
0
 public void TestMutationDetection()
 {
     // tests the object mutation detector
     using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
     {
         using (CoreServer server = new CoreServer(loggerRef, "UTT", NodeType.Router))
         {
             // start server
             server.Start();
             using (ICoreClient client = new CoreClientFactory(loggerRef).SetEnv("UTT").Create())
             {
                 // create reference object
                 TestData data0 = new TestData("Zero", 0);
                 client.SaveObject(data0, "Item0", null);
                 ICoreItem item = client.LoadItem <TestData>("Item0");
                 string    text = item.Text;
                 TestData  data = item.GetData <TestData>(false);
                 // - assert not mutated
                 Assert.AreEqual(text, XmlSerializerHelper.SerializeToString(item.GetData <TestData>(false)));
                 // - mutate the object
                 data.field1 = "One";
                 data.field2 = 1;
                 // - assert mutated
                 Assert.AreNotEqual(text, XmlSerializerHelper.SerializeToString(item.GetData <TestData>(false)));
             }
             // shutdown
             server.Stop();
         }
     }
 }
        private void StartUp(ICoreItem coreItem)
        {
            //Set the trade identifier
            //
            textBox1.Text = coreItem.Name;
            //Instantiate the datagrid
            //
            dataGridView1.Columns.Add("PropertyName", "Name");
            dataGridView1.Columns.Add("PropertyValue", "Value");
            var properties = coreItem.AppProps.ToDictionary();

            foreach (var property in properties)
            {
                String value = null;
                var    temp  = property.Value as Array;
                if (temp != null)
                {
                    foreach (var element in temp)
                    {
                        value = element + ";" + value;
                    }
                }
                else
                {
                    value = property.Value.ToString();
                }
                object[] row = { property.Key, value };
                dataGridView1.Rows.Add(row);
            }
        }
Exemple #22
0
 internal Place(ICoreItem coreItem) : base(coreItem)
 {
     if (base.IsNew)
     {
         this.Initialize();
     }
 }
Exemple #23
0
 public CacheChangeData(Guid cacheId, CacheChange change, ICoreItem oldItem, ICoreItem newItem)
 {
     CacheId = cacheId;
     Change  = change;
     OldItem = oldItem;
     NewItem = newItem;
 }
Exemple #24
0
        private static BodyReadStream InternalTryCreateBodyStream(ICoreItem coreItem, BodyReadConfiguration configuration, bool createEmtpyStreamIfNotFound, long?length)
        {
            BodyReadStream result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                Stream stream = BodyReadStream.OpenBodyStream(coreItem);
                disposeGuard.Add <Stream>(stream);
                Stream stream2 = stream;
                if (stream2 == null)
                {
                    if (!createEmtpyStreamIfNotFound)
                    {
                        return(null);
                    }
                    stream2 = Body.GetEmptyStream();
                }
                ConversionCallbackBase conversionCallbackBase;
                Stream disposable = BodyReadDelegates.CreateStream(coreItem, configuration, stream2, out conversionCallbackBase);
                disposeGuard.Add <Stream>(disposable);
                BodyReadStream bodyReadStream = new BodyReadStream(stream, disposable, conversionCallbackBase, length);
                disposeGuard.Add <BodyReadStream>(bodyReadStream);
                disposeGuard.Success();
                result = bodyReadStream;
            }
            return(result);
        }
Exemple #25
0
        public Guid SaveTypedObject(Type dataType, object data, string name, NamedValueSet props, bool transient, TimeSpan lifetime)
        {
            ICoreItem item = Client.MakeTypedItem(dataType, data, name, props, transient);

            item.Lifetime = lifetime;
            return(SaveItem(item));
        }
Exemple #26
0
 internal OutlookServiceSubscriptionItem(ICoreItem coreItem) : base(coreItem, false)
 {
     if (base.IsNew)
     {
         this.Initialize();
     }
 }
Exemple #27
0
        public static bool IsMessageOpaqueSigned(Item item)
        {
            Util.ThrowOnNullArgument(item, "item");
            ICoreItem coreItem       = item.CoreItem;
            string    valueOrDefault = coreItem.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);

            if (!ObjectClass.IsSmime(valueOrDefault))
            {
                return(false);
            }
            if (coreItem.AttachmentCollection.Count != 1)
            {
                return(false);
            }
            IList <AttachmentHandle> allHandles = coreItem.AttachmentCollection.GetAllHandles();
            bool result;

            using (CoreAttachment coreAttachment = coreItem.AttachmentCollection.Open(allHandles[0]))
            {
                using (StreamAttachment streamAttachment = (StreamAttachment)AttachmentCollection.CreateTypedAttachment(coreAttachment, new AttachmentType?(AttachmentType.Stream)))
                {
                    if (streamAttachment == null)
                    {
                        result = false;
                    }
                    else
                    {
                        result = ConvertUtils.IsMessageOpaqueSigned(coreItem, streamAttachment);
                    }
                }
            }
            return(result);
        }
        private static object FromTextToRtf(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, bool createWriter)
        {
            Stream stream = null;
            object obj    = null;

            try
            {
                stream = new ConverterStream(bodyStream, new RtfToRtfCompressed(), ConverterStreamAccess.Write);
                stream = new ConverterStream(stream, new TextToRtf
                {
                    InputEncoding      = configuration.SourceEncoding,
                    Header             = configuration.InjectPrefix,
                    Footer             = configuration.InjectSuffix,
                    HeaderFooterFormat = configuration.InjectionHeaderFooterFormat
                }, ConverterStreamAccess.Write);
                stream = new BodyCharsetDetectionStream(stream, null, coreItem, BodyStreamFormat.Text, configuration.SourceCharset, configuration.TargetCharset, configuration.TargetCharsetFlags, BodyWriteDelegates.GetExtraData(configuration), false);
                obj    = BodyWriteDelegates.GetStreamOrUnicodeWriter(stream, createWriter);
            }
            finally
            {
                if (obj == null && stream != null)
                {
                    BodyWriteDelegates.SafeDisposeStream(stream);
                }
            }
            return(obj);
        }
        internal bool IsContentTransformationNeeded(ICoreItem coreItem)
        {
            if (this.sourceFormat != this.targetFormat)
            {
                return(true);
            }
            if (!string.IsNullOrEmpty(this.injectPrefix) || !string.IsNullOrEmpty(this.injectSuffix))
            {
                return(true);
            }
            switch (this.targetFormat)
            {
            case BodyFormat.TextPlain:
                return(this.sourceCharset.CodePage != 1200);

            case BodyFormat.TextHtml:
            {
                Charset charset;
                return(this.htmlFlags != HtmlStreamingFlags.None || this.HtmlCallback != null || !this.trustHtmlMetaTag || !coreItem.CharsetDetector.IsItemCharsetKnownWithoutDetection(this.targetCharsetFlags, this.targetCharset, out charset) || charset.CodePage != this.sourceCharset.CodePage);
            }

            case BodyFormat.ApplicationRtf:
                return(false);

            default:
                return(true);
            }
        }
Exemple #30
0
 internal DistributionList(ICoreItem coreItem) : base(coreItem)
 {
     if (base.IsNew)
     {
         this.Initialize();
     }
 }