Ejemplo n.º 1
0
		public void Parallel()
		{
			using (var options = new StreamOptions())
			using (var eventStream = new EventStream(options))
			{
				var tasks = new List<Task>();
				for (int i = 0; i < 10; i++)
				{
					tasks.Add(Task.Factory.StartNew(() =>
						{
							for (int j = 0; j < 5; j++)
							{
								eventStream.AppendAsync(new RavenJObject { { "counter", i +"-" + j } }).Wait();
							}
						}));
				}

				foreach (var task in tasks)
				{
					while (task.IsCompleted == false && task.IsFaulted == false)
					{
						Thread.Sleep(100);
					}
				}

				Assert.Equal(50, eventStream.EventCount);
			}
		}
		public void AndGetRightCount_Parallel()
		{
			using (var options = new StreamOptions())
			using (var eventStream = new EventStream(options))
			{
				var tasks = new List<Task>();
				for (int x = 0; x < 3; x++)
				{
					for (int i = 0; i < 10; i++)
					{
						tasks.Add(Task.Factory.StartNew(() =>
						{
							for (int j = 0; j < 5; j++)
							{
								eventStream.AppendAsync(new RavenJObject { { "counter", i + "-" + j } }).Wait();
							}
						}));
					}

					foreach (var task in tasks)
					{
						while (task.IsCompleted == false && task.IsFaulted == false)
						{
							Thread.Sleep(100);
						}
					}

					eventStream.FlushMemTableToFiskAsync(Etag.Empty).Wait();

					eventStream.FlushingMemTable.Wait();
				}

				Assert.Equal(150, eventStream.EventCount);
			}
		}
		public void CanRestart()
		{
			using (var options = new StreamOptions
			{
				Storage = new FileSystemLowLevelStorage("data")
			})
			{
				using (var eventStream = new EventStream(options))
				{
					for (int i = 0; i < 15; i++)
					{
						eventStream.AppendAsync(new RavenJObject { { "counter", i } }).Wait();
					}

					eventStream.FlushMemTableToFiskAsync(Etag.Empty).Wait();
					eventStream.FlushingMemTable.Wait();
				}

				using (var eventStream = new EventStream(options))
				{
					Assert.Equal(15, eventStream.EventCount);

					int x = 0;
					foreach (var it in eventStream.ReadFrom(Etag.Empty))
					{
						Assert.Equal(x++, it.Value<int>("counter"));
					}
				}
			}
		}
Ejemplo n.º 4
0
 public TempFile(string text = null, string extension = ".tmp", StreamOptions streamOptions = StreamOptions.None)
 {
     FileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
     FileName = Path.ChangeExtension(FileName, extension);
     if (null != text)
     {
         FileUtility.Save(FileName, text, streamOptions);
     }
 }
Ejemplo n.º 5
0
		public void Sequence()
		{
			using (var options = new StreamOptions())
			using (var eventStream = new EventStream(options))
			{
				for (int i = 0; i < 5; i++)
				{
					eventStream.AppendAsync(new RavenJObject {{"counter", i}}).Wait();
				}

				Assert.Equal(5, eventStream.EventCount);
			}
		}
		public void AndGetRightCount_Sequence()
		{
			using (var options = new StreamOptions())
			using (var eventStream = new EventStream(options))
			{
				for (int i = 0; i < 15; i++)
				{
					eventStream.AppendAsync(new RavenJObject { { "counter", i } }).Wait();
				}

				var list = eventStream.ReadFrom(Etag.Empty).ToList();
				Assert.Equal(15, list.Count);
			}
		} 
		public void AndGetRightCount_Sequence()
		{
			using (var options = new StreamOptions())
			using (var eventStream = new EventStream(options))
			{
				for (int i = 0; i < 15; i++)
				{
					eventStream.AppendAsync(new RavenJObject {{"counter", i}}).Wait();
				}

				eventStream.FlushMemTableToFiskAsync(Etag.Empty).Wait();
				eventStream.FlushingMemTable.Wait();
				Assert.Equal(15, eventStream.EventCount);
			}
		}
Ejemplo n.º 8
0
 public XDocument Load(string fileName, StreamOptions streamOptions = StreamOptions.None)
 {
     return FileUtility.Load(fileName, fileStream =>
     {
         using (var xmlReader = (null == _xmlReaderSettings) ? XmlReader.Create(fileStream) : XmlReader.Create(fileStream, _xmlReaderSettings))
         {
             try
             {
                 return XDocument.Load(xmlReader);
             }
             catch (XmlSchemaValidationException e)
             {
                 var message = string.Format("{0}({1},{2}): {3}", fileName, e.LineNumber, e.LinePosition, e.Message);
                 throw new XmlLoaderException(message, e);
             }
         }
     }, streamOptions);
 }
		public void AndReadContentsProperly()
		{
			using (var options = new StreamOptions())
			using (var eventStream = new EventStream(options))
			{
				for (int i = 0; i < 15; i++)
				{
					eventStream.AppendAsync(new RavenJObject { { "counter", i } }).Wait();
				}

				int x = 0;
				foreach (var item in eventStream.ReadFrom(Etag.Empty))
				{
					var value = item.Value<int>("counter");
					Assert.Equal(x++, value);
				}
			}
		}
Ejemplo n.º 10
0
        public void StartCaptureStreaming(SearchParameters parameters)
        {
            StreamOptions options = new StreamOptions();

            options.Track.Add(parameters.SearchKey);
            this._stopSearch = false;

            TwitterStream stream = new TwitterStream(tokens, "RTSearch (Dev)", options);

            IAsyncResult result = stream.StartPublicStream(
                StreamStopped,
                NewTweet,
                DeletedTweet,
                OtherEvent
                );

            while (!this._stopSearch)
            {
            }

            stream.EndStream(StopReasons.StoppedByRequest, "Stop by user");
        }
        public static Stream GetWritableStream(Stream stream, string fileNameForIv, string password, StreamOptions streamOptions)
        {
            if (!IsEncryption(streamOptions)) throw new ArgumentException();
            if (string.IsNullOrEmpty(password)) throw new ArgumentException("No password is specified.");

            if (StreamOptions.Encryption == (streamOptions & StreamOptions.Encryption))
            {
                stream = Encrypt(stream, password);
            }
            else if (StreamOptions.Encryption2 == (streamOptions & StreamOptions.Encryption2))
            {
                stream = Encrypt2(stream, password);
            }
            else if (StreamOptions.Encryption3 == (streamOptions & StreamOptions.Encryption3))
            {
                stream = Encrypt3(stream, fileNameForIv, password);
            }
            else
            {
                throw new ApplicationException("never reach here");
            }
            return stream;
        }
        /// <summary>
        /// Starts collecting the twitter data
        /// </summary>
        /// <param name="track">Tilde delimeted list of items to track</param>
        /// <returns></returns>
        public void StartCollecting(string userAgent, string track, bool includeRawJsonCallback)
        {
            #region Prepare Auth Tokens for Twitter

            OAuthTokens tokens = new OAuthTokens()
            {
                ConsumerKey       = ConsumerKey,
                ConsumerSecret    = ConsumerSharedSecret,
                AccessToken       = OAuthToken,
                AccessTokenSecret = OAuthTokenSecret
            };

            #endregion

            #region Set up items we want to track

            StreamOptions options = new StreamOptions();

            string[] trackItems = track.Split('~');
            foreach (string trackItem in trackItems)
            {
                options.Track.Add(trackItem);
            }

            #endregion

            stream = new TwitterStream(tokens, userAgent, options);

            if (includeRawJsonCallback)
            {
                stream.StartUserStream(StreamInit, StreamStopped, NewTweet, DeletedTweet, NewDirectMessage, DeletedDirectMessage, OtherEvent, RawJson);
            }
            else
            {
                stream.StartUserStream(StreamInit, StreamStopped, NewTweet, DeletedTweet, NewDirectMessage, DeletedDirectMessage, OtherEvent, null);
            }
        }
Ejemplo n.º 13
0
        public static int CreateTypedStream(ExecutionContext context, object[] values, out object[] inlineParameters)
        {
            inlineParameters = EmptyParameters;

            if (values.Length > 3 || values.Length < 2)
            {
                context.Error.WriteLine("Invalid syntax: CreateTypedStream NodePath TypedStream [Flags]");
                return(-1);
            }

            string        path    = values[0].ToString();
            Type          type    = type = Type.GetType(values[1].ToString());
            StreamOptions options = StreamOptions.None;

            if (type == null)
            {
                context.Error.WriteLine("Type '{0}' not resolved.", values[1].ToString());
                return(-1);
            }

            if (values.Length > 2)
            {
                options = (StreamOptions)Enum.Parse(typeof(StreamOptions), values[2].ToString());
            }


            Node <object> node = context.ShellApp.WorkingDirectory.Find(path);

            if (node == null)
            {
                context.Error.WriteLine("Path '{0}' does not exist", path);
                return(-1);
            }

            node.AddTypedStream(type, options);
            return(1);
        }
        static void Main(string[] args)
        {
            Console.BufferWidth = 100;
            Console.WindowWidth = 100;

            StreamOptions options = new StreamOptions();

            options.Track.Add("#tallycc");
            options.Track.Add("tallycc");
            options.Track.Add("#tallycodecamp");
            options.Track.Add("tallycodecamp");

            TwitterStream stream = new TwitterStream(
                tokens,
                "Tallahassee CodeCamp2001 Example Application",
                options);

            Console.WriteLine("The stream is starting ...");
            stream.StartUserStream(
                StreamInit,
                StreamStopped,
                NewTweet,
                DeletedTweet,
                NewDirectMessage,
                DeletedDirectMessage,
                OtherEvent,
                RawJson);                         //optional

            Console.WriteLine("The stream has started. Press any key to stop.");
            Console.ReadKey();

            Console.WriteLine("Stopping the stream ...");
            stream.EndStream(StopReasons.StoppedByRequest, "I'm stopping the stream.");

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Ejemplo n.º 15
0
        public void Test_GettersSetters()
        {
            const LogLevel level          = LogLevel.Critical;
            var            exception      = new Exception("test-message");
            var            streamMessage1 = new StreamMessage();
            var            streamMessage2 = new StreamMessage();
            var            messages       = new List <StreamMessage> {
                streamMessage1, streamMessage2
            };
            var options = new StreamOptions
            {
                Exception = exception,
                Level     = level,
                Messages  = messages
            };

            Assert.Same(exception, options.Exception);
            Assert.Equal(level, options.Level);
            Assert.NotNull(options.Messages);
            Assert.Equal(2, options.Messages.Count());
            Assert.Same(messages, options.Messages);
            Assert.Contains(streamMessage1, options.Messages);
            Assert.Contains(streamMessage2, options.Messages);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryTypedStream"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="op">The options.</param>
 public MemoryTypedStream(string type, StreamOptions op)
 {
     this.type    = type;
     this.options = op;
 }
        private static void DoStream(StreamOptions x)
        {
            Console.WriteLine($"Streaming called with {x.NumberOfEvents} events, emitting to {x.EventHubConnectionString}.");

            var client = EventHubClient.CreateFromConnectionString(x.EventHubConnectionString);

            var info = client.GetRuntimeInformationAsync();

            info.Wait();

            // we will create as many threads as there are paritions, and just send all partitions data
            var threads           = new Dictionary <string, SenderInfo>();
            var countPerPartition = Math.Round((x.NumberOfEvents / info.Result.PartitionCount), 0);

            foreach (var partitionId in info.Result.PartitionIds)
            {
                threads.Add(partitionId,
                            CreatePartitionSender(countPerPartition, x, partitionId, client.CreatePartitionSender(partitionId)));
            }

            ManualResetEvent monitoringEvent = new ManualResetEvent(false);

            // start monitoring thread
            new Thread(() =>
            {
                var s = new StringBuilder();
                foreach (var tx in threads.Values)
                {
                    s.Append(tx.PartitionId.PadRight(PADDING_WIDTH));
                }

                s.Append("total".PadRight(PADDING_WIDTH));

                Console.WriteLine(s.ToString());

                s.Clear();

                Console.WriteLine("".PadRight(PADDING_WIDTH * threads.Count, '_'));


                while (!monitoringEvent.WaitOne(500))
                {
                    double total = 0;
                    foreach (var tx in threads.Values)
                    {
                        total = total + tx.SendCount;

                        s.Append(tx.SendCount.ToString().PadRight(PADDING_WIDTH));
                    }

                    s.Append(total.ToString().PadRight(PADDING_WIDTH));
                    Console.WriteLine(s.ToString());
                    s.Clear();
                }
            }).Start();

            ManualResetEvent.WaitAll(threads.Select(y => y.Value.Event).ToArray());
            monitoringEvent.Set();

            Console.WriteLine("Finished on all threads.");
        }
 private static void 複数の暗号化オプションは指定できない(StreamOptions streamOptions)
 {
     var comb = new []
     {
         StreamOptions.Encryption | StreamOptions.Encryption2,
         StreamOptions.Encryption3 | StreamOptions.Encryption2,
         StreamOptions.Encryption3 | StreamOptions.Encryption,
         StreamOptions.Encryption | StreamOptions.Encryption2 | StreamOptions.Encryption3,
     };
     if (comb.Any(x => x == (streamOptions & x)))
     {
         throw new ArgumentException("StreamOptions.Encryption and StreamOptions.Encryption2 and StreamOptions.Encryption3 must not be specified at the same time.");
     }
 }
Ejemplo n.º 19
0
 public Node <Object> Create(string path, Type t, StreamOptions flags)
 {
     return(Root.Create(path, t, flags));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Creates the new database.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type of default stream.</param>
 /// <param name="ops">The options of default stream.</param>
 /// <returns></returns>
 public static MemoryDatabase CreateNewDatabase(string name, Type type, StreamOptions ops)
 {
     return(new MemoryDatabase(name, type.FullName, ops));
 }
Ejemplo n.º 21
0
 public IDriverNode CreateNewVersion(string defaultType, StreamOptions flags)
 {
     Operations.CreateNewVersion op = new Operations.CreateNewVersion(commonAddress, defaultType, flags);
     journal.Execute(op);
     return(new PhysicalNode(name, commonAddress, op.Version, journal));
 }
Ejemplo n.º 22
0
 public CreateStreamParameters(int aport, int vport)
 {
     this.options_ = new StreamOptions(aport, vport);
 }
 // Static members
 public static bool IsEncryption(StreamOptions streamOptions)
 {
     複数の暗号化オプションは指定できない(streamOptions);
     var x = StreamOptions.Encryption | StreamOptions.Encryption2 | StreamOptions.Encryption3;
     return 0 != (streamOptions & x);
 }
 public static StreamInitIQ BuildDefaultStreamInitResult(StreamOptions choosenoption)
 {
     StreamInitIQ q = new StreamInitIQ(StreamInitIQType.Result);
     q.sid = null;
     q.mimetype = null;
     q.StreamOptions = choosenoption;
     return q;
 }
        public override void ParseInnerXML(System.Xml.Linq.XElement elem)
        {
            XElement si = elem.FirstNode as XElement;
            if (si == null)
                return;

            if (si.Name != "{http://jabber.org/protocol/si}si")
                return;

            if (si.Attribute("id") != null)
                sid = si.Attribute("id").Value;
            if (si.Attribute("mime-type") != null)
                mimetype = si.Attribute("mime-type").Value;
            if (si.Attribute("profile") != null)
                profile = si.Attribute("profile").Value;

            StreamOptions = StreamOptions.none;
            foreach (XElement nextelem in si.Descendants())
            {
                if (nextelem.Name == "{http://jabber.org/protocol/si/profile/file-transfer}file")
                {
                    if (nextelem.Attribute("name") != null)
                        filename = nextelem.Attribute("name").Value;
                    if (nextelem.Attribute("size") != null)
                        filesize = Convert.ToInt32(nextelem.Attribute("size").Value);
                    if (nextelem.Attribute("hash") != null)
                        filehash = nextelem.Attribute("hash").Value;
                    if (nextelem.Attribute("date") != null)
                        filedate = nextelem.Attribute("date").Value;

                    if (nextelem.Element("{http://jabber.org/protocol/si/profile/file-transfer}desc") != null)
                        filedesc = nextelem.Element("{http://jabber.org/protocol/si/profile/file-transfer}desc").Value;
                }
                else if (nextelem.Name == "{http://jabber.org/protocol/feature-neg}feature")
                {
                    XElement x = nextelem.Element("{jabber:x:data}x");
                    if (x != null)
                    {
                        if (x.Attribute("type") != null)
                        {
                            if (x.Attribute("type").Value == "form")
                                StreamInitIQType = StreamInitIQType.Offer;
                            else if (x.Attribute("type").Value == "submit")
                                StreamInitIQType = StreamInitIQType.Result;
                        }

                        XElement field = x.Element("{jabber:x:data}field");
                        if (field != null)
                        {
                            /// This may work for both form and submits, because the values are there in both cases, just wrapped in an option in form
                            foreach (XElement nextopt in field.Descendants("{jabber:x:data}value"))
                            {
                                if (nextopt.Value == "http://jabber.org/protocol/bytestreams")
                                    StreamOptions |= StreamOptions.bytestreams;
                                else if (nextopt.Value == "http://jabber.org/protocol/ibb")
                                    StreamOptions |= StreamOptions.ibb;
                            }
                        }
                    }

                }
            }
            base.ParseInnerXML(elem);
        }
Ejemplo n.º 26
0
 public IDriverNode CreateNewVersion(string defaultType, StreamOptions flags)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 27
0
 public void AddTypedStream(string type, StreamOptions flags)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 28
0
 public IDriverNode CreateChild(string name, string defaultType, StreamOptions flags)
 {
     throw new InvalidOperationException("Host file does not support children.");
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Performs the actions that this command implements.
        /// </summary>
        internal override void ExecuteInternal()
        {
            var m = Manager.MediaCore;

            if (m.IsDisposed || m.State.IsOpen || m.State.IsOpening)
            {
                return;
            }

            try
            {
                // TODO: Sometimes when the stream can't be read, the sample player stays as if it were trying to open
                // until the interrupt timeout occurs but and the Real-Time Clock continues. Strange behavior. Investigate more.

                // Signal the initial state
                m.State.ResetMediaProperties();
                m.State.Source    = Source;
                m.State.IsOpening = true;

                // Register FFmpeg libraries if not already done
                if (FFInterop.Initialize(MediaEngine.FFmpegDirectory, MediaEngine.FFmpegLoadModeFlags))
                {
                    // Set the folders and lib identifiers
                    MediaEngine.FFmpegDirectory     = FFInterop.LibrariesPath;
                    MediaEngine.FFmpegLoadModeFlags = FFInterop.LibraryIdentifiers;

                    // Log an init message
                    m.Log(MediaLogMessageType.Info,
                          $"{nameof(FFInterop)}.{nameof(FFInterop.Initialize)}: FFmpeg v{ffmpeg.av_version_info()}");
                }

                // Create the stream container
                // the async protocol prefix allows for increased performance for local files.
                var streamOptions = new StreamOptions();

                // Convert the URI object to something the Media Container understands
                var mediaUrl = Source.ToString();
                try
                {
                    if (Source.IsFile || Source.IsUnc)
                    {
                        // Set the default protocol Prefix
                        mediaUrl = Source.LocalPath;
                        streamOptions.ProtocolPrefix = "async";
                    }
                }
                catch { }

                // GDIGRAB: Example URI: device://gdigrab?desktop
                if (string.IsNullOrWhiteSpace(Source.Scheme) == false &&
                    (Source.Scheme.Equals("format") || Source.Scheme.Equals("device")) &&
                    string.IsNullOrWhiteSpace(Source.Host) == false &&
                    string.IsNullOrWhiteSpace(streamOptions.Input.ForcedInputFormat) &&
                    string.IsNullOrWhiteSpace(Source.Query) == false)
                {
                    // Update the Input format and container input URL
                    // It is also possible to set some input options as follows:
                    // streamOptions.Input.Add(StreamInputOptions.Names.FrameRate, "20");
                    streamOptions.Input.ForcedInputFormat = Source.Host;
                    mediaUrl = Uri.UnescapeDataString(Source.Query).TrimStart('?');
                    m.Log(MediaLogMessageType.Info, $"Media URI will be updated. Input Format: {Source.Host}, Input Argument: {mediaUrl}");
                }

                // Allow the stream input options to be changed
                m.SendOnMediaInitializing(streamOptions, mediaUrl);

                // Instantiate the internal container
                m.Container = new MediaContainer(mediaUrl, streamOptions, m);

                // Reset buffering properties
                m.State.InitializeBufferingProperties();

                // Notify the user media is opening and allow for media options to be modified
                // Stuff like audio and video filters and stream selection can be performed here.
                m.SendOnMediaOpening();

                // Notify Media will start opening
                m.Log(MediaLogMessageType.Debug, $"{nameof(OpenCommand)}: Entered");

                // Side-load subtitles if requested
                m.PreloadSubtitles();

                // Get the main container open
                m.Container.Open();

                // Check if we have at least audio or video here
                if (m.Container.Components.HasAudio == false && m.Container.Components.HasVideo == false)
                {
                    throw new MediaContainerException($"Unable to initialize at least one audio or video component fron the input stream.");
                }

                // Charge! We are good to go, fire up the worker threads!
                m.StartWorkers();

                // Set the state to stopped and exit the IsOpening state
                m.State.IsOpening = false;
                m.State.UpdateMediaState(PlaybackStatus.Stop);

                // Raise the opened event
                m.SendOnMediaOpened();
            }
            catch (Exception ex)
            {
                try { m.Container?.Dispose(); } catch { }
                m.DisposePreloadedSubtitles();
                m.Container = null;
                m.State.UpdateMediaState(PlaybackStatus.Close);
                m.SendOnMediaFailed(ex);
            }
            finally
            {
                // Signal we are no longer in the opening state
                // so we can enqueue commands in the command handler
                m.State.IsOpening = false;
                m.Log(MediaLogMessageType.Debug, $"{nameof(OpenCommand)}: Completed");
            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Adds a new typed stream to this node
 /// </summary>
 /// <typeparam name="TData">The type of the new typed stream</typeparam>
 /// <param name="flags">Flags of the new typed stream</param>
 public void AddTypedStream <TData>(StreamOptions flags)
 {
     underNode.AddTypedStream(typeof(TData), flags);
 }
Ejemplo n.º 31
0
 public void PushLine <T>(StreamOptions options) => _loggerFactory.CreateLogger <T>().Log(
     options.Level,
     options.Exception,
     string.Join(string.Empty, options.Messages.Select(m => m.Message)));
Ejemplo n.º 32
0
        ///// <summary>
        ///// Checks if a wrapper is already registered for the given scheme.
        ///// </summary>
        ///// <param name="scheme">The scheme.</param>
        ///// <returns><c>true</c> if exists.</returns>
        //public static bool Exists(string scheme)
        //{
        //    return GetWrapperInternal(scheme) != null;
        //}

        /// <summary>
        /// Retreive the corresponding StreamWrapper respectind the scheme portion 
        /// of the given path. If no scheme is specified, an instance of 
        /// FileStreamWrapper is returned.
        /// </summary>
        /// <param name="ctx">Current runtime context.</param>
        /// <param name="scheme">The scheme portion of an URL.</param>
        /// <param name="options">Additional <see cref="StreamOptions"/> having effect on the wrapper retreival.</param>
        /// <returns>An instance of StreamWrapper to be used to open the specified file.</returns>
        /// <exception cref="PhpException">In case when the required wrapper can not be found.</exception>
        public static StreamWrapper GetWrapper(Context ctx, string scheme, StreamOptions options)
        {
            StreamWrapper wrapper = GetWrapperInternal(ctx, scheme);

            if (wrapper == null)
            {
                PhpException.Throw(PhpError.Notice, ErrResources.stream_bad_wrapper, scheme);
                // Notice:  fopen(): Unable to find the wrapper "*" - did you forget to enable it when you configured PHP? in C:\Inetpub\wwwroot\php\index.php on line 23

                wrapper = GetWrapperInternal(ctx, "file");
                // There should always be the FileStreamWrapper present.
            }

            // EX [GetWrapper]: check for the other StreamOptions here: for example UseUrl, IgnoreUrl

            //if (!ScriptContext.CurrentContext.Config.FileSystem.AllowUrlFopen)
            //{
            //    if (wrapper.IsUrl)
            //    {
            //        PhpException.Throw(PhpError.Warning, ErrResources.url_fopen_disabled);
            //        return null;
            //    }
            //}

            Debug.Assert(wrapper != null);
            return wrapper;
        }
Ejemplo n.º 33
0
 internal MemoryDatabase(string name, string type, StreamOptions ops)
 {
     rootNode = new MemoryNode(name, type, ops);
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Creates a child node in this node
 /// </summary>
 /// <typeparam name="TNew">The default type of the new node</typeparam>
 /// <param name="name">The name of the new node</param>
 /// <param name="flags">Stream flags of the default stream of the new node</param>
 /// <returns>The new created node</returns>
 public Node <TNew> Create <TNew>(string name, StreamOptions flags)
 {
     return(new Node <TNew>(underNode.CreateChild(name, typeof(TNew), flags)));
 }
Ejemplo n.º 35
0
 public void AddTypedStream(string type, StreamOptions flags)
 {
     journal.Execute(new AddTypedStream(versionAddress, type, flags));
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Creates a child node.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="name"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public Node <object> Create(string name, Type type, StreamOptions flags)
 {
     return(new Node <object>(underNode.CreateChild(name, type, flags)));
 }
Ejemplo n.º 37
0
 public SensorOptions(StreamOptions depthOptions,
     StreamOptions rgbOptions, StreamOptions irOptions,
     SensorType sensorType = SensorType.OPENNI2,
     FubiUtils.SkeletonProfile profile = FubiUtils.SkeletonProfile.ALL,
     bool mirrorStreams = true, float smoothing = 0)
 {
     m_depthOptions = depthOptions;
     m_irOptions = irOptions;
     m_rgbOptions = rgbOptions;
     m_profile = profile;
     m_mirrorStreams = mirrorStreams;
     m_smoothing = smoothing;
     m_type = sensorType;
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Creates a new version in this node
 /// </summary>
 /// <typeparam name="TNew">The new version default stream type</typeparam>
 /// <param name="options">Stream flags of the default stream of the new version</param>
 /// <returns>The new node version</returns>
 public Node <TNew> CreateNewVersion <TNew>(StreamOptions options)
 {
     return(new Node <TNew>(underNode.CreateNewVersion(typeof(TNew), options)));
 }
Ejemplo n.º 39
0
 public Node <T> Create <T>(string path, StreamOptions flags)
 {
     return(Root.Create <T>(path, flags));
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Creates a new vesion in this node.
 /// </summary>
 /// <param name="defaultType"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public Node <object> CreateNewVersion(Type defaultType, StreamOptions options)
 {
     return(new Node <object>(underNode.CreateNewVersion(defaultType, options)));
 }
Ejemplo n.º 41
0
            public SensorOptions(StreamOptions depthOptions,
                StreamOptions rgbOptions, StreamOptions irOptions,
                SensorType sensorType = SensorType.OPENNI2,
                SkeletonProfile trackingProfile = SkeletonProfile.ALL,
			    bool mirrorStreams = true, bool registerStreams = true)
            {
                m_depthOptions = depthOptions;
                m_irOptions = irOptions;
                m_rgbOptions = rgbOptions;
                m_trackingProfile = trackingProfile;
                m_mirrorStreams = mirrorStreams;
                m_registerStreams = registerStreams;
                m_type = sensorType;
            }
 private IAsyncResult WithHammockStreamingImpl <T>(RestClient client, RestRequest request, StreamOptions options, Action <T, TwitterResponse> action)
Ejemplo n.º 43
0
 public void OnMediaInitializing(MediaEngine sender, StreamOptions options, string url)
 {
     // placeholder
 }
        private static void WithHammockStreamingImpl <T>(RestClient client, RestRequest request, StreamOptions options, Action <T, TwitterResponse> action)
#endif
        {
            request.StreamOptions = options;
            request.Method        = WebMethod.Get;
#if SILVERLIGHT
            request.AddHeader("X-User-Agent", client.UserAgent);
#endif

#if !WINDOWS_PHONE
            return
                (#endif
            client.BeginRequest(request, new RestCallback <T>((req, resp, state) =>
            {
                Exception exception;
                var entity = TryAsyncResponse(() =>
                {
#if !SILVERLIGHT
                    SetResponse(resp);
#endif
                    var deserializer = new JsonSerializer();

                    return deserializer.DeserializeJson <T>(resp.Content);
                },
                                              out exception);
                action(entity, new TwitterResponse(resp, exception));
            })));
        }
Ejemplo n.º 45
0
 public void Push <T>(StreamOptions options)
 {
 }
 private IAsyncResult WithHammockPublicStreaming <T>(StreamOptions options, Action <T, TwitterResponse> action, string path) where T : class
Ejemplo n.º 47
0
 /// <summary>
 /// Adds a typed stream (non-generic version).
 /// </summary>
 /// <param name="type"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public void AddTypedStream(Type type, StreamOptions flags)
 {
     underNode.AddTypedStream(type, flags);
 }
Ejemplo n.º 48
0
 public TempFile(string text, StreamOptions streamOptions)
     : this(text, ".tmp", streamOptions)
 {
 }