コード例 #1
0
 public Schema()
     : base()
 {
     InstanceType = typeof(__FiFileUplo__);
     ClassName    = "FileUploadFilePage";
     Properties.ClearExposed();
     FileName = Add <__TString__>("FileName");
     FileName.DefaultValue = "";
     FileName.SetCustomAccessors((_p_) => { return(((__FiFileUplo__)_p_).__bf__FileName__); }, (_p_, _v_) => { ((__FiFileUplo__)_p_).__bf__FileName__ = (System.String)_v_; }, false);
     FilePath = Add <__TString__>("FilePath");
     FilePath.DefaultValue = "";
     FilePath.SetCustomAccessors((_p_) => { return(((__FiFileUplo__)_p_).__bf__FilePath__); }, (_p_, _v_) => { ((__FiFileUplo__)_p_).__bf__FilePath__ = (System.String)_v_; }, false);
     FileSize = Add <__TLong__>("FileSize");
     FileSize.DefaultValue = 0L;
     FileSize.SetCustomAccessors((_p_) => { return(((__FiFileUplo__)_p_).__bf__FileSize__); }, (_p_, _v_) => { ((__FiFileUplo__)_p_).__bf__FileSize__ = (System.Int64)_v_; }, false);
     FileSizeString = Add <__TString__>("FileSizeString");
     FileSizeString.DefaultValue = "";
     FileSizeString.SetCustomAccessors((_p_) => { return(((__FiFileUplo__)_p_).__bf__FileSizeString__); }, (_p_, _v_) => { ((__FiFileUplo__)_p_).__bf__FileSizeString__ = (System.String)_v_; }, false);
     DeleteClick = Add <__TLong__>("DeleteClick$");
     DeleteClick.DefaultValue = 0L;
     DeleteClick.Editable     = true;
     DeleteClick.SetCustomAccessors((_p_) => { return(((__FiFileUplo__)_p_).__bf__DeleteClick__); }, (_p_, _v_) => { ((__FiFileUplo__)_p_).__bf__DeleteClick__ = (System.Int64)_v_; }, false);
     DeleteClick.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.DeleteClick()
         {
             App = (FileUploadFilePage)pup, Template = (TLong)prop, Value = value
         }); }, (Json pup, Starcounter.Input <Int64> input) => { ((FileUploadFilePage)pup).Handle((Input.DeleteClick)input); });
 }
コード例 #2
0
        public static void DeleteErrorFile(string log)
        {
            double deleteSize = 0;
            int    count      = 0;

            if (File.Exists(log))
            {
                StreamReader sr = new StreamReader(log);

                while (!sr.EndOfStream)
                {
                    var text = sr.ReadLine();

                    var deleteFile = text.Substring(text.IndexOf("文件 ") + "文件 ".Length);

                    if (File.Exists(deleteFile))
                    {
                        deleteSize += new FileInfo(deleteFile).Length;
                        count++;

                        File.Delete(deleteFile);
                    }
                }
            }

            Console.WriteLine("删除 " + count + " 个文件, 总大小 " + FileSize.GetAutoSizeString(deleteSize, 1));
        }
コード例 #3
0
ファイル: MuxedStreamInfo.cs プロジェクト: MarioGK/YourList
 /// <summary>
 ///     Initializes an instance of <see cref="MuxedStreamInfo" />.
 /// </summary>
 public MuxedStreamInfo(
     int tag,
     string url,
     Container container,
     FileSize size,
     Bitrate bitrate,
     string audioCodec,
     string videoCodec,
     string videoQualityLabel,
     VideoQuality videoQuality,
     VideoResolution resolution,
     Framerate framerate)
 {
     Tag               = tag;
     Url               = url;
     Container         = container;
     Size              = size;
     Bitrate           = bitrate;
     AudioCodec        = audioCodec;
     VideoCodec        = videoCodec;
     VideoQualityLabel = videoQualityLabel;
     VideoQuality      = videoQuality;
     Resolution        = resolution;
     Framerate         = framerate;
 }
コード例 #4
0
        public void More_Than_1GB_ToString_Defaults_To_GB()
        {
            // 1 GB
            var sut = new FileSize(1024 * 1024 * 1024);

            sut.ToString().Should().Be("1GB");
        }
コード例 #5
0
        public void Bytes_Are_Converted_To_TeraBytes()
        {
            // 1 TB
            var sut = new FileSize(1024L * 1024 * 1024 * 1024);

            sut.TotalTeraBytes.Should().Be(1.0);
        }
コード例 #6
0
        public void ToString_Uses_NumberFormat()
        {
            var sut    = new FileSize(1234);
            var result = sut.ToString("N2", CultureInfo.InvariantCulture);

            result.Should().Be("1.21KB");
        }
コード例 #7
0
        public void Bytes_Are_Converted_To_GigaBytes()
        {
            // 1 GB
            var sut = new FileSize(1024 * 1024 * 1024);

            sut.TotalGigaBytes.Should().Be(1.0);
        }
コード例 #8
0
        public void Operator_NotEquals_Should_Work()
        {
            var sut = new FileSize(42);

            (sut != new FileSize(42)).Should().BeFalse();
            (sut != new FileSize(43)).Should().BeTrue();
        }
コード例 #9
0
        public void CompareTo_Can_Compare_With_Long()
        {
            var sut = new FileSize(5);

            sut.CompareTo(6).Should().Be(-1);
            sut.CompareTo(4).Should().Be(1);
        }
コード例 #10
0
        public static string DeleteAndRename(Dictionary <string, List <FileItemModel> > input)
        {
            double          deleteSize = 0;
            CookieContainer cc         = Get115Cookie();
            var             pattern    = @"\(\d+\)";

            foreach (var data in input)
            {
                if (data.Value.Count >= 2)
                {
                    Console.WriteLine("正在处理 " + data.Key);

                    var biggest = data.Value.LastOrDefault();

                    Console.WriteLine("\t最大文件为 " + biggest.n + " 大小为 " + FileSize.GetAutoSizeString(biggest.s, 2));

                    data.Value.Remove(biggest);

                    foreach (var de in data.Value)
                    {
                        Console.WriteLine("\t删除 " + de.n + " 大小为 " + FileSize.GetAutoSizeString(de.s, 2));
                        Delete(de.fid, cc);
                        deleteSize += de.s;
                    }

                    Console.WriteLine("\t重命名 " + biggest.n + " 到 " + Regex.Replace(biggest.n, pattern, ""));
                    Rename(biggest.fid, Regex.Replace(biggest.n, pattern, ""), cc);
                    Console.WriteLine();
                }
            }

            return(FileSize.GetAutoSizeString(deleteSize, 2));
        }
コード例 #11
0
ファイル: VideoLocal.cs プロジェクト: gocheap/ShokoServer
        public string ToStringDetailed()
        {
            StringBuilder sb = new StringBuilder("");

            sb.Append(Environment.NewLine);
            sb.Append("VideoLocalID: " + VideoLocalID.ToString());

            sb.Append(Environment.NewLine);
            sb.Append("FileName: " + FileName);

/*            sb.Append(Environment.NewLine);
 *          sb.Append("ImportFolderID: " + ImportFolderID.ToString());*/
            sb.Append(Environment.NewLine);
            sb.Append("Hash: " + Hash);
            sb.Append(Environment.NewLine);
            sb.Append("FileSize: " + FileSize.ToString());
            sb.Append(Environment.NewLine);

            /*
             * try
             * {
             *  if (ImportFolder != null)
             *      sb.Append("ImportFolderLocation: " + ImportFolder.ImportFolderLocation);
             * }
             * catch (Exception ex)
             * {
             *  sb.Append("ImportFolderLocation: " + ex.ToString());
             * }
             *
             * sb.Append(Environment.NewLine);
             */
            return(sb.ToString());
        }
コード例 #12
0
        private void TreeViewForm_Load(object sender, EventArgs e)
        {
            if (_data == null)
            {
                Text = $@"颜色含义:{KnownColor.PowderBlue}为甲有乙无/大小不一致,{KnownColor.PaleVioletRed}为甲无乙有";
                return;
            }
            Text = _data.TorrentName;
            var  treenode = new TreeNode(_data.TorrentName);
            long length   = 0;
            var  task     = new Task(() =>
            {
                _node  = new Node(_data.GetRawFileListWithAttribute());
                length = _node.InsertTo(treenode.Nodes);
            });

            task.ContinueWith(t =>
            {
                Invoke(new Func <TreeNode, int>(treeView1.Nodes.Add), treenode);
                Invoke(new Action(treenode.Expand), null);
                if (length == 0)
                {
                    return;
                }
                Invoke(new Action(() =>
                {
                    Text          += $@" [{FileSize.FileSizeToString(length)}]";
                    treenode.Text += $@" [{FileSize.FileSizeToString(length)}]";
                }), null);
            });
            task.Start();
        }
コード例 #13
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (data_ != null)
            {
                hash ^= Data.GetHashCode();
            }
            if (fileSize_ != null)
            {
                hash ^= FileSize.GetHashCode();
            }
            if (MimeType != global::Google.Ads.GoogleAds.V2.Enums.MimeTypeEnum.Types.MimeType.Unspecified)
            {
                hash ^= MimeType.GetHashCode();
            }
            if (fullSize_ != null)
            {
                hash ^= FullSize.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #14
0
ファイル: XmlFileOfVS.cs プロジェクト: Renlens/VSXMLDT
 /// <summary>
 /// 初始化一个新实例。
 /// </summary>
 public XmlFileOfVS()
 {
     fileSize  = FileSize.Uninit;
     IsFile    = false;
     FullPath  = "";
     TempNodes = null;
 }
コード例 #15
0
        public SalesAttachment(Entity salesLiteratureItem, EntityReference website)
        {
            if (salesLiteratureItem == null)
            {
                throw new ArgumentNullException("salesLiteratureItem");
            }
            if (salesLiteratureItem.LogicalName != "salesliteratureitem")
            {
                throw new ArgumentException(string.Format(ResourceManager.GetString("Value_Missing_For_LogicalName"), salesLiteratureItem.LogicalName), "salesLiteratureItem");
            }

            AbstractText        = FormatAbstract(salesLiteratureItem.GetAttributeValue <string>("abstract"));
            AttachedDocumentURL = FormatAbstract(salesLiteratureItem.GetAttributeValue <string>("attacheddocumenturl"));
            AuthorName          = salesLiteratureItem.GetAttributeValue <string>("authorname");
            ContentType         = salesLiteratureItem.GetAttributeValue <string>("mimetype");
            FileName            = salesLiteratureItem.GetAttributeValue <string>("filename");
            var filesize = salesLiteratureItem.GetAttributeValue <int?>("filesize").GetValueOrDefault();

            FileSize = new FileSize(Convert.ToUInt64(filesize < 0 ? 0 : filesize));
            HasFile  = !string.IsNullOrEmpty(FileName);
            ID       = salesLiteratureItem.Id;
            Keywords = salesLiteratureItem.GetAttributeValue <string>("keywords");
            Title    = salesLiteratureItem.GetAttributeValue <string>("title");
            URL      = salesLiteratureItem.GetFileAttachmentUrl(website);
        }
コード例 #16
0
        public string GetStateTitle(bool bDetailed)
        {
            string strSt = "";

            if (!bFile && !bFolder)
            {
                return("message");
            }
            if (!bFolder)
            {
                strSt = "file";
                if (FileSize > -1)
                {
                    strSt += " (local: ";
                    strSt += FileSize.ToString();
                    strSt += " bytes, " + RscUtils.toMBstr(FileSize, false) + ")";
                }
                if (RemoteFileSize > -1)
                {
                    strSt += " (remote: ";
                    strSt += RemoteFileSize.ToString();
                    strSt += " bytes, " + RscUtils.toMBstr(RemoteFileSize, false) + ")";
                }
                if (bDetailed)
                {
                    if (Done)
                    {
                        strSt += " (DONE)";
                    }
                    if (Acked)
                    {
                        strSt += " (ACKED)";
                    }
                }
                return(strSt);
            }

            strSt = "folder";
            if (bDetailed)
            {
                strSt += " (RefCount=" + RefCount.ToString() + ")";
                if (!bWalked)
                {
                    strSt += " (NOT WALKED!!!)";
                }
                if (Created)
                {
                    strSt += " (Created)";
                }
                if (Done)
                {
                    strSt += " (DONE)";
                }
                if (Acked)
                {
                    strSt += " (ACKED)";
                }
            }
            return(strSt);
        }
コード例 #17
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (FileSize != 0L)
            {
                hash ^= FileSize.GetHashCode();
            }
            if (Buffer.Length != 0)
            {
                hash ^= Buffer.GetHashCode();
            }
            if (ReadedByte != 0)
            {
                hash ^= ReadedByte.GetHashCode();
            }
            if (info_ != null)
            {
                hash ^= Info.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #18
0
ファイル: SplashForm.cs プロジェクト: Rychard/MD5Helper
        public void Calculate(String filepath)
        {
            this.Show();

            try
            {
                if (File.Exists(filepath))
                {
                    FileInfo fi = new FileInfo(filepath);
                    FileSize fs = new FileSize(fi.Length);

                    lblStatus.Text = "Calculating MD5... (For large files this may take a while)";
                    lblFilename.Text = filepath;
                    lblFileSize.Text = fs.ToString();

                    ParameterizedThreadStart pt = new ParameterizedThreadStart(GetMD5);
                    Thread t = new Thread(pt);
                    t.Start(filepath);
                }
                else
                {
                    this.Close();
                    MessageBox.Show("File does not exist.");
                    Application.Exit();
                }
            }
            catch (Exception)
            {
                // If an exception is thrown, it's likely that the file is in use.
                MessageBox.Show("File is currently in use by another application.");
                Application.Exit();
            }
        }
コード例 #19
0
ファイル: Joiner.cs プロジェクト: huannguyenfit/MeGUI
        protected override void checkJobIO()
        {
            base.checkJobIO();
            FileSize totalSize = FileSize.Empty;

            try
            {
                // now create the temporary list
                tmpfile = Path.Combine(Path.GetDirectoryName(job.Output), Path.GetRandomFileName());
                using (StreamWriter w = new StreamWriter(File.OpenWrite(tmpfile), Encoding.Default))
                {
                    foreach (string file in job.InputFiles)
                    {
                        Util.ensureExists(file);
                        totalSize += FileSize.Of(file);
                        w.WriteLine(file);
                    }
                }
            }
            catch (Exception e)
            {
                throw new JobRunException("Error generating temporary *.lst file: " + e.Message, e);
            }
            su.ProjectedFileSize = totalSize;
            su.ClipLength        = job.ClipLength;
        }
コード例 #20
0
        public string ToStringDetailed()
        {
            StringBuilder sb = new StringBuilder("");

            sb.Append(Environment.NewLine);
            sb.Append("VideoLocalID: " + VideoLocalID.ToString());
            sb.Append(Environment.NewLine);
            sb.Append("FilePath: " + FilePath);
            sb.Append(Environment.NewLine);
            sb.Append("ImportFolderID: " + ImportFolderID.ToString());
            sb.Append(Environment.NewLine);
            sb.Append("Hash: " + Hash);
            sb.Append(Environment.NewLine);
            sb.Append("FileSize: " + FileSize.ToString());
            sb.Append(Environment.NewLine);

            try
            {
                if (ImportFolder != null)
                {
                    sb.Append("ImportFolderLocation: " + ImportFolder.ImportFolderLocation);
                }
            }
            catch (Exception ex)
            {
                sb.Append("ImportFolderLocation: " + ex.ToString());
            }

            sb.Append(Environment.NewLine);

            return(sb.ToString());
        }
コード例 #21
0
        private void audio1Bitrate_ValueChanged(object sender, EventArgs e)
        {
            if (length <= 0)
            {
                return;
            }

            if (updating)
            {
                return;
            }

            updating = true;

            int bitrate = (int)audio1Bitrate.Value;

            if (bitrate > 0 && audio1Type.SelectedIndex == -1)
            {
                audio1Type.SelectedItem = AudioType.VBRMP3;
            }
            double   bytesPerSecond = (double)bitrate * 1000.0 / 8.0;
            FileSize f = new FileSize((ulong)(length * bytesPerSecond));

            size.CertainValue = f;
            raiseEvent();
            updating = false;
        }
コード例 #22
0
        private void size_SelectionChanged(object sender, string val)
        {
            if (length <= 0)
            {
                return;
            }

            if (updating)
            {
                return;
            }

            updating = true;

            FileSize s = FileSize.Parse(size.Text); //size.CertainValue;

            if (s > FileSize.Empty && audio1Type.SelectedIndex == -1)
            {
                audio1Type.SelectedItem = AudioType.VBRMP3;
            }

            double bytesPerSecond = (double)s.Bytes / (double)length;
            int    bitrate        = (int)(bytesPerSecond * 8.0 / 1000.0);

            if (bitrate > audio1Bitrate.Maximum)
            {
                audio1Bitrate.Maximum = bitrate;
            }

            audio1Bitrate.Value = bitrate;
            raiseEvent();

            updating = false;
        }
コード例 #23
0
ファイル: Main.cs プロジェクト: fanxy121/AllInOneAV
        private void StartBtnClick()
        {
            srcFi = new List <FileInfo>();
            lvMoveSrc.Items.Clear();
            var oriExcludes = excludes;

            excludes.Add(txtMoveDes.Text);

            if (!string.IsNullOrEmpty(txtMoveSrc.Text))
            {
                FileUtility.GetFilesRecursive(txtMoveSrc.Text, formats, excludes, srcFi, 200);

                lvMoveSrc.BeginUpdate();
                foreach (var f in srcFi)
                {
                    ListViewItem lvi = new ListViewItem(f.Name);
                    lvi.SubItems.Add(FileSize.GetAutoSizeString(f.Length, 1));

                    if (desFi.Exists(x => x.Name.ToLower() == f.Name.ToLower()))
                    {
                        lvi.BackColor = Color.Red;
                    }

                    lvMoveSrc.Items.Add(lvi);
                }
                lvMoveSrc.EndUpdate();
            }

            excludes = oriExcludes;
        }
コード例 #24
0
        private void selectAudioFile(string file)
        {
            FileSize f = FileSize.Of2(file) ?? FileSize.Empty;

            size.CertainValue = f;

            AudioType aud2Type = VideoUtil.guessAudioType(file);

            if (audio1Type.Items.Contains(aud2Type))
            {
                audio1Type.SelectedItem = aud2Type;
            }

            MediaInfo info;

            try
            {
                info = new MediaInfo(file);
                MediaInfoWrapper.AudioTrack atrack = info.Audio[0];
                if (atrack.CodecString == "DTS")
                {
                    audio1Bitrate.Value = (Convert.ToInt32(atrack.BitRate) / 1000);
                }
            }
            catch (Exception i)
            {
                MessageBox.Show("The following error ocurred when trying to get Media info for file " + file + "\r\n" + i.Message, "Error parsing mediainfo data", MessageBoxButtons.OK);
            }
        }
コード例 #25
0
ファイル: RpcAddMsg.cs プロジェクト: NBSChain/gonbs-rpc-test
        public override int GetHashCode()
        {
            int hash = 1;

            if (FileName.Length != 0)
            {
                hash ^= FileName.GetHashCode();
            }
            if (FullPath.Length != 0)
            {
                hash ^= FullPath.GetHashCode();
            }
            if (FileSize != 0L)
            {
                hash ^= FileSize.GetHashCode();
            }
            if (FileType != 0)
            {
                hash ^= FileType.GetHashCode();
            }
            if (SplitterSize != 0)
            {
                hash ^= SplitterSize.GetHashCode();
            }
            if (FileData.Length != 0)
            {
                hash ^= FileData.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #26
0
        public void AddMissingInformation(ApplicationUninstallerEntry target)
        {
            if (!Directory.Exists(target.InstallLocation) || UninstallToolsGlobalConfig.IsSystemDirectory(target.InstallLocation))
            {
                return;
            }

            if (_everythingAvailable)
            {
                try
                {
                    target.EstimatedSize = EvGetSize(target.InstallLocation);
                    return;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    _everythingAvailable = false;
                }
            }

            if (_fileSystemObject != null)
            {
                try
                {
                    var folder = _fileSystemObject.GetFolder(target.InstallLocation);
                    var size   = new FileSize(Convert.ToInt64(folder.Size) / 1024);
                    target.EstimatedSize = size;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
コード例 #27
0
        private void Refresh()
        {
            TrackedMemoryObjects.Where(x => !x.IsAlive()).ToList().ForEach(x => x.RemainingLifetimeAfterGC--);
            TrackedMemoryObjects.RemoveAll(x => !x.IsAlive() && x.RemainingLifetimeAfterGC < 0);
            InstancedTrackedMemoryObjects.ReplaceAll(TrackedMemoryObjects);
            LastRefreshText = "Last refreshed: " + DateTime.Now;

            var sizeUsed = System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;

            CurrentMemoryUsageText = "Current memory usage: " + FileSize.FormatSize(sizeUsed);

            TotalLargeInUseStr   = FileSize.FormatSize(MemoryManager.LargePoolTotalSize);
            LargeInUseStr        = FileSize.FormatSize(MemoryManager.LargePoolInUseSize);
            LargeFreeStr         = FileSize.FormatSize(MemoryManager.LargePoolFreeSize);
            TotalSmallInUseStr   = FileSize.FormatSize(MemoryManager.SmallPoolTotalSize);
            SmallInUseStr        = FileSize.FormatSize(MemoryManager.SmallPoolInUseSize);
            SmallFreeStr         = FileSize.FormatSize(MemoryManager.SmallPoolFreeSize);
            MaxBufferSize        = FileSize.FormatSize(MemoryManager.MaximumBufferSize);
            MemoryBlockSize      = FileSize.FormatSize(MemoryManager.BlockSize);
            SmallBlocksAvailable = MemoryManager.SmallBlocksAvailable;
            LargeBlocksAvailable = MemoryManager.LargeBlocksAvailable;

            MaxMemoryObserved     = Math.Max(MaxMemoryObserved, sizeUsed);
            MaxMemoryObservedText = $"Max memory used: {FileSize.FormatSize(MaxMemoryObserved)}";
            //foreach (var item in InstancedTrackedMemoryObjects)
            //{
            //    item.RefreshStatus();
            //}
        }
コード例 #28
0
        public override void Save(OutputWriter output)
        {
            Assert.ArgumentNotNull(output, nameof(output));

            output.WriteStartElement("File");

            output.WriteAttributeString("Include", File);
            output.WriteAttributeString(@"FileTimestamp", FileTimestamp.ToString(CultureInfo.InvariantCulture));
            output.WriteAttributeString(@"FileSize", FileSize.ToString(CultureInfo.InvariantCulture));
            output.WriteAttributeString(@"ServerTimestamp", ServerTimestamp.ToString(CultureInfo.InvariantCulture));
            output.WriteAttributeString(@"ServerFileSize", ServerFileSize.ToString(CultureInfo.InvariantCulture));

            if (IsConflict)
            {
                output.WriteAttributeString(@"IsConflict", @"True");
                output.WriteAttributeString(@"ConflictResolution", ConflictResolution.ToString());
            }

            if (HideFromToolbox)
            {
                output.WriteAttributeString(@"HideFromToolbox", @"True");
            }

            foreach (var itemUri in Items)
            {
                output.WriteStartElement("Item");
                output.WriteAttributeString(@"DatabaseName", itemUri.DatabaseName.ToString());
                output.WriteValue(itemUri.ItemId.ToString());
                output.WriteEndElement();
            }

            output.WriteEndElement();
        }
コード例 #29
0
 private void selectExtraFile(string file)
 {
     FileSize  = FileSize.Of2(file) ?? FileSize.Empty;
     size.Text = FileSize.ToString();
     name.Text = System.IO.Path.GetFileName(file);
     raiseEvent();
 }
コード例 #30
0
 public virtual IDictionary <string, string> ToDictionary()
 {
     return(new Dictionary <string, string>
     {
         { "method", Method.ToString() },
         { "raw", Raw.ToLowerString() },
         { "fileName", FileName ?? "" },
         { "fileSize", FileSize.ToString(CultureInfo.InvariantCulture) },
         { "batchId", BatchId ?? "" },
         { "batchLast", BatchLast.ToLowerString() },
         { "canResume", CanResume.ToLowerString() },
         { "startOver", StartOver.ToLowerString() },
         { "unzip", Unzip.ToLowerString() },
         { "tool", Tool },
         { "title", Title ?? "" },
         { "details", Details ?? "" },
         { "sendGuid", SendGuid ?? "" },
         { "threadCount", Convert.ToString(ThreadCount) },
         { "overwrite", Overwrite.ToLowerString() },
         { "isSend", IsSend.ToLowerString() },
         { "responseFormat", ResponseFormat },
         { "notify", Notify.ToLowerString() },
         { "clientCreatedDateUTC", ClientCreatedDateUtc.HasValue ? ClientCreatedDateUtc.Value.ToString("u"): "" },
         { "clientModifiedDateUTC", ClientModifiedDateUtc.HasValue ? ClientModifiedDateUtc.Value.ToString("u"): "" },
         { "baseFileId", BaseFileId }
     });
 }
コード例 #31
0
        private void selectAudioFile(string file)
        {
            FileSize f = FileSize.Of2(file) ?? FileSize.Empty;

            //size.CertainValue = f;
            size.Text           = f.ToString();
            audio1Bitrate.Value = (length > 0) ? (long)(f.Bytes * 8) / 1000L / length : 0;
            name.Text           = System.IO.Path.GetFileName(file);

            AudioType aud2Type = VideoUtil.guessAudioType(file);

            if (audio1Type.Items.Contains(aud2Type))
            {
                audio1Type.SelectedItem = aud2Type;
            }

            //MediaInfo info;
            //try
            //{
            //    info = new MediaInfo(file);
            //    MediaInfoWrapper.AudioTrack atrack = info.Audio[0];
            //    //this.length = atrack.Duration
            //    if (atrack.Format == "DTS" && (atrack.BitRate == "768000" || atrack.BitRate == "1536000"))
            //    {
            //        audio1Bitrate.Value = (Convert.ToInt32(atrack.BitRate) / 1000);
            //    }
            //}
            //catch (Exception i)
            //{
            //    MessageBox.Show("The following error ocurred when trying to get Media info for file " + file + "\r\n" + i.Message, "Error parsing mediainfo data", MessageBoxButtons.OK);
            //}
        }
コード例 #32
0
ファイル: TestUtils.cs プロジェクト: cryptonome/mnemonicfs
        /// <summary>
        /// This method returns a byte array of the file size as specified.
        /// If fileSize == ZERO_FILE_SIZE, byte array of zero-length is returned.
        /// If fileSize == SMALL_FILE_SIZE, byte array of one hundred bytes is returned.
        /// If fileSize == MEDIUM_FILE_SIZE, byte array of five hundred bytes is returned.
        /// If fileSize == LARGE_FILE_SIZE, byte array of one thousand bytes is returned.
        /// </summary>
        /// <param name="fileSize">File size as requested by the caller.</param>
        /// <returns>A byte array of the requested size.</returns>
        public static byte[] GetAnyFileData(FileSize fileSize)
        {
            byte[] fileData = null;
            switch (fileSize) {
                case FileSize.ZERO_FILE_SIZE:
                    fileData = new byte[0];
                    break;
                case FileSize.SMALL_FILE_SIZE:
                    fileData = new byte[100];
                    break;
                default:
                case FileSize.MEDIUM_FILE_SIZE:
                    fileData = new byte[500];
                    break;
                case FileSize.LARGE_FILE_SIZE:
                    fileData = new byte[1000];
                    break;
            }

            return fileData;
        }
コード例 #33
0
ファイル: WindowsFile.cs プロジェクト: kkalinowski/nex
 /// <summary>
 /// Computes folder size
 /// </summary>
 public void CountFolderSize()
 {
     if (IsDirectory)
         Size = FileSize.CreateForDirectory(FullName);
 }
コード例 #34
0
 public void OutputWithGB ()
 {
   var fileSize = new FileSize (13421772800);
   Assert.That (fileSize.ToString (), Is.EqualTo ("12.50 GB"));
 }
コード例 #35
0
 public void OutputWithTB ()
 {
   var fileSize = new FileSize (13743895347200);
   Assert.That (fileSize.ToString (), Is.EqualTo ("12.50 TB"));
 }
コード例 #36
0
ファイル: SplashForm.cs プロジェクト: Rychard/MD5Helper
 public void UpdateProgress(HashingStatusUpdateEventArgs e)
 {
     if (DisplayedStatus == null)
     {
         DisplayedStatus = e;
         DateOfStatus = DateTime.Now;
         pbCalculation.Value = (int)Math.Floor(e.Complete);
         lblPosition.Text = e.Complete + "% - " + e.Position.ToString() + "/" + e.Size.ToString();
         lblSpeed.Text = String.Empty;
     }
     else
     {
         if (DisplayedStatus.Complete + 2 < e.Complete)
         {
             DateTime CurrentTime = DateTime.Now;
             pbCalculation.Value = (int)Math.Floor(e.Complete);
             lblPosition.Text = e.Complete + "% - " + e.Position.ToString() + "/" + e.Size.ToString();
             long BytesSinceLast = e.Position - DisplayedStatus.Position;
             FileSize fs = new FileSize(BytesSinceLast);
             String DataSinceLast = fs.ToString();
             lblSpeed.Text = DataSinceLast + "/second";
             DisplayedStatus = e;
             DateOfStatus = CurrentTime;
         }
     }
 }
コード例 #37
0
 public void OutputWithMB1 ()
 {
   var fileSize = new FileSize (1312000);
   Assert.That (fileSize.ToString (), Is.EqualTo ("1.25 MB"));
 }
コード例 #38
0
 public void OutputWithMB2 ()
 {
   var fileSize = new FileSize (13107200);
   Assert.That (fileSize.ToString(), Is.EqualTo ("12.50 MB"));
 }
コード例 #39
0
 public void Given_local_computer()
 {
     var local = Server.Connect("localhost");
     diskSize = local.Disks["C"].FreeSpace;
 }
コード例 #40
0
 public void OutputWithKiloByte ()
 {
   var fileSize = new FileSize (128000);
   Assert.That (fileSize.ToString (), Is.EqualTo ("125.00 kB"));
 }