private void SetSelectionInHexDump(BinaryPart part)
 {
     if (part is BinaryValue value)
     {
         BinaryFile.SetSelectionInHexDump(value);
     }
 }
        private void ShowDetailsCommand_Executed(object parameter)
        {
            BinaryPart part = parameter as BinaryPart;

            TemplatePartDetailsWindowEventArgs detailsWindowEventArgs = new TemplatePartDetailsWindowEventArgs()
            {
                Part = part
            };

            TemplatePartDetailsWindowRequested?.Invoke(this, detailsWindowEventArgs);

            if (detailsWindowEventArgs.DialogResult)
            {
                part.Name = detailsWindowEventArgs.PartName;

                if (part is BinarySection section)
                {
                    section.LoopSettings.Type               = detailsWindowEventArgs.LoopSettings.Type;
                    section.LoopSettings.LoopCountFixed     = detailsWindowEventArgs.LoopSettings.LoopCountFixed;
                    section.LoopSettings.LoopCountReference = detailsWindowEventArgs.LoopSettings.LoopCountReference;
                }
                else if (part is BinaryValue value)
                {
                    value.ValueType = detailsWindowEventArgs.ValueType;
                }
            }
        }
Пример #3
0
            public static FileStream CreateUploadData(Stream imageStream, string filename, IDictionary<string, string> parameters, string boundary)
            {
                var body = new MimeBody
                {
                    Boundary = boundary,
                    MimeParts = parameters
                    .Where(p => !p.Key.StartsWith("oauth_"))
                    .Select(p => (MimePart)new FormDataPart { Name = p.Key, Value = p.Value }).ToList()
                };

                var binaryPart = new BinaryPart
                {
                    Name = "photo",
                    ContentType = "image/jpeg",
                    Filename = filename
                };
                binaryPart.LoadContent(imageStream);
                body.MimeParts.Add(binaryPart);

                var stream = new FileStream(Path.GetTempFileName(), FileMode.Create);
                body.WriteTo(stream);
                stream.Position = 0;
                return stream;
            }
Пример #4
0
 private void OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     SelectedTreeItem = e.NewValue as BinaryPart;
 }