Esempio n. 1
0
        private async void UploadFilesToServer()
        {
            if (_proxy._user == null || string.IsNullOrEmpty(uploadPath))
            {
                return;
            }
            string connectionString = ConfigurationManager.ConnectionStrings[UPDATEFILESINSERVER].ToString();
            var    dir = new DirectoryInfo(uploadPath);

            System.IO.FileInfo[] files     = dir.GetFiles();
            List <FilesInfo>     fileInfos = new List <FilesInfo>();

            foreach (var fileInfo in files)
            {
                FilesInfo the_file = new FilesInfo();
                the_file.FileName = fileInfo.Name;
                the_file.Location = fileInfo.DirectoryName;
                the_file.Size     = fileInfo.Length;
                fileInfos.Add(the_file);
            }
            FilesPerUser filesPerUser = new FilesPerUser();

            filesPerUser._User      = _proxy._user;
            filesPerUser._FilesList = fileInfos;
            await _proxy.UpdateFilesAtServer(connectionString, filesPerUser);
        }
Esempio n. 2
0
 public Header()
 {
     ArchiveProperties     = null;
     AdditionalStreamsInfo = null;
     MainStreamsInfo       = null;
     FilesInfo             = null;
 }
Esempio n. 3
0
        // POST api/data
        public HttpResponseMessage Post([FromBody] string value)
        {
            DirectoryInfo root = new DirectoryInfo(value);

            SearchFile.WalkDirectoryTree(root);
            List <FilesInfo> files = new List <FilesInfo>();

            foreach (var item in SearchFile.myFiles)
            {
                FilesInfo file = new FilesInfo()
                {
                    fileFullName = item.FullName,
                    fileSize     = Convert.ToString(item.Length)
                };
                files.Add(file);
            }

            var serializer       = new JavaScriptSerializer();
            var serializedResult = serializer.Serialize(files);


            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent(serializedResult, Encoding.UTF8, "application/json");
            return(response);
        }
Esempio n. 4
0
            public void Parse(Stream hs)
            {
                while (true)
                {
                    PropertyID propertyID = GetPropertyID(this, hs);
                    switch (propertyID)
                    {
                    case PropertyID.kArchiveProperties:
                        ArchiveProperties = new ArchiveProperties();
                        ArchiveProperties.Parse(hs);
                        break;

                    case PropertyID.kAdditionalStreamsInfo:
                        AdditionalStreamsInfo = new StreamsInfo();
                        AdditionalStreamsInfo.Parse(hs);
                        break;

                    case PropertyID.kMainStreamsInfo:
                        MainStreamsInfo = new StreamsInfo();
                        MainStreamsInfo.Parse(hs);
                        break;

                    case PropertyID.kFilesInfo:
                        FilesInfo = new FilesInfo();
                        FilesInfo.Parse(hs);
                        break;

                    case PropertyID.kEnd:
                        return;

                    default:
                        throw new NotImplementedException(propertyID.ToString());
                    }
                }
            }
Esempio n. 5
0
 private void dgvView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex == -1)
     {
         return;
     }
     if (e.ColumnIndex == 0)
     {
         if (dgvView.Rows[e.RowIndex].Cells[2].Value.ToString() == "")
         {
             return;
         }
         List <string> files = new List <string>();
         foreach (DataGridViewRow row in dgvView.Rows)
         {
             DataGridViewCheckBoxCell cell = row.Cells[0] as DataGridViewCheckBoxCell;
             if (Convert.ToBoolean(cell.EditingCellFormattedValue) == true)
             {
                 files.Add(row.Cells["FileColumn"].Value.ToString());
             }
         }
         string info = FilesInfo.GetFilesInfo(files.ToArray());
         lblInfo.Text = info;
     }
 }
Esempio n. 6
0
        public List <FilesInfo> GetListOfFiles(string search_parameter = "")
        {
            _connection.Open();
            SqlCommand cmd = new SqlCommand("SP_FileInfo", _connection);

            cmd.Parameters.Add(new SqlParameter("@search_parameter", search_parameter));
            cmd.CommandType = CommandType.StoredProcedure;
            List <FilesInfo> result = new List <FilesInfo>();

            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    var _file = new FilesInfo();
                    _file.Files_ID        = Convert.ToInt32(reader["Files_ID"]);
                    _file.FileName        = reader["FileName"].ToString();
                    _file.Location        = " ";
                    _file.Type            = " ";
                    _file.Size            = Convert.ToInt32(reader["Size"]);
                    _file.Amount_Of_Peers = Convert.ToInt32(reader["Amount_Of_Peers"]);
                    result.Add(_file);
                }
            }
            _connection.Close();
            return(result);
        }
        public static List <FilesInfo> GetListFile(string dataPath)
        {
            var           filesInfo     = new List <FilesInfo>();
            string        extension     = string.Empty;
            DirectoryInfo directoryInfo = new DirectoryInfo(dataPath);
            // Get Sub Folder
            var subFolders = directoryInfo.GetDirectories();

            foreach (var folder in subFolders)
            {
                var fileInfo   = new FilesInfo();
                var folderinfo = new DirectoryInfo(folder.FullName);
                {
                    // Get All File
                    var listFile = new List <string>();

                    foreach (FileInfo fi in folderinfo.GetFiles())
                    {
                        //listFile.Add(fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length));
                        listFile.Add(fi.FullName);
                        extension = fi.Extension.Substring(1, fi.Extension.Length - 1);
                    }
                    fileInfo.DirName   = folder.Name;
                    fileInfo.FileName  = listFile;
                    fileInfo.Extension = extension.ToUpper();
                }
                filesInfo.Add(fileInfo);
            }
            return(filesInfo);
        }
Esempio n. 8
0
        /// <summary>
        /// Sets a style for an Error annotation (reduced font + segoe ui) and for markers
        /// </summary>
        /// <param name="errorLevel"></param>
        /// <param name="bgColor"></param>
        /// <param name="fgColor"></param>
        private static void SetErrorStyles(byte errorLevel, Color bgColor, Color fgColor)
        {
            int curFontSize = Sci.GetStyle(0).Size;

            var normalStyle = Sci.GetStyle(FilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Normal));

            normalStyle.Font      = "Segoe ui";
            normalStyle.Size      = (int)(curFontSize * 0.9);
            normalStyle.ForeColor = fgColor;
            normalStyle.BackColor = bgColor;

            var boldStyle = Sci.GetStyle(FilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Bold));

            boldStyle.Font      = "Segoe ui";
            boldStyle.Size      = (int)(curFontSize * 0.9);
            boldStyle.Bold      = true;
            boldStyle.ForeColor = fgColor;
            boldStyle.BackColor = bgColor;

            var italicStyle = Sci.GetStyle(FilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Italic));

            italicStyle.Font      = "Segoe ui";
            italicStyle.Size      = (int)(curFontSize * 0.9);
            italicStyle.Italic    = true;
            italicStyle.ForeColor = fgColor;
            italicStyle.BackColor = bgColor;

            var markerStyle = Sci.GetMarker(errorLevel);

            markerStyle.Symbol = MarkerSymbol.SmallRect;
            markerStyle.SetBackColor(bgColor);
            markerStyle.SetForeColor(fgColor);
        }
Esempio n. 9
0
 private bool Flag(FilesInfo entity)
 {
     if (string.IsNullOrEmpty(entity.FilePath))
     {
         return(false);
     }
     return(true);
 }
        private void OnContagemTamanho(long bytes)
        {
            var info = FilesInfo.InfoSize(bytes);

            Dispatcher.BeginInvoke((Action)(() =>
                                            sizeFilesExibe.Content = string.Format("{0} ({1})", info.Size, info.Format)
                                            ));
        }
Esempio n. 11
0
 private void BtGetHelpOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     Config.Instance.GlobalShowDetailedHelpForErrors = !Config.Instance.GlobalShowDetailedHelpForErrors;
     btGetHelp.UseGreyScale = !Config.Instance.GlobalShowDetailedHelpForErrors;
     FilesInfo.ClearAnnotationsAndMarkers();
     FilesInfo.UpdateErrorsInScintilla();
     Npp.GrabFocus();
 }
        private void ConfigureStartData()
        {
            FilesInfo.Clear();

            _calculatorService.ResetCollection();

            Task.Run(() => Application.Current.Dispatcher.Invoke(() =>
                                                                 ProgressValue = 0));
        }
Esempio n. 13
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            var size = (long)value;

            return(FilesInfo.FormatSize(size));
        }
        protected override bool SaveCore()
        {
            disableAttachedFilesReload = true;
            bool saveCoreResult = base.SaveCore();

            if (!saveCoreResult)
            {
                return(false);
            }
            bool hasFilesOperations = false;

            disableAttachedFilesReload = false;
            if (Entity.AttachedFiles != null)
            {
                List <long> deletedItems = new List <long>();
                foreach (var file in Entity.AttachedFiles)
                {
                    long id = file.Id;
                    if (FilesInfo.FirstOrDefault(x => id == x.Id) == null)
                    {
                        deletedItems.Add(file.Id);
                    }
                }
                foreach (long item in deletedItems)
                {
                    var file = UnitOfWork.AttachedFiles.Find(item);
                    UnitOfWork.AttachedFiles.Remove(file);
                    hasFilesOperations = true;
                }
            }
            foreach (var fileInfo in FilesInfo)
            {
                if (fileInfo.Id == -1)
                {
                    try {
                        using (FileStream stream = new FileStream(fileInfo.FullPath, FileMode.Open, FileAccess.Read)) {
                            TaskAttachedFile attachedFile = UnitOfWork.AttachedFiles.Create();
                            attachedFile.EmployeeTaskId = Entity.Id;
                            attachedFile.Name           = fileInfo.Name;
                            attachedFile.Content        = new byte[(int)stream.Length];
                            stream.Read(attachedFile.Content, 0, (int)stream.Length);
                            hasFilesOperations = true;
                        }
                    } catch (Exception) {
                        MessageBoxService.ShowMessage("Error attaching file!", "Error");
                        return(false);
                    }
                }
            }
            if (hasFilesOperations)
            {
                UnitOfWork.SaveChanges();
            }
            return(true);
        }
Esempio n. 15
0
 /// <summary>
 /// Changing syntax theme
 /// </summary>
 private void CbSyntaxSelectedIndexChanged(object sender, EventArgs eventArgs)
 {
     Style.Current = Style.GetThemesList[cbSyntax.SelectedIndex];
     Config.Instance.SyntaxHighlightThemeId = cbSyntax.SelectedIndex;
     if (Plug.IsCurrentFileProgress)
     {
         Style.SetSyntaxStyles();
         Plug.ApplyOptionsForScintilla();
         FilesInfo.UpdateFileStatus();
     }
 }
        public ErrorsFilesInfo Transform(FilesInfo files)
        {// метод для преобразования полей объекта FilesInfo в ErrorsFilesInfo
            List <string> str  = new List <string>();
            int           iter = 0;

            foreach (ErrorsInfo errors in files.errors)
            {
                str.Add(errors.error);
                iter++;
            }
            return(new ErrorsFilesInfo(files.filename, str));
        }
Esempio n. 17
0
File: Plug.cs Progetto: devjerome/3P
 /// <summary>
 /// When the user click on the margin
 /// </summary>
 public static void OnSciMarginClick(SCNotification nc)
 {
     // click on the error margin
     if (nc.margin == FilesInfo.ErrorMarginNumber)
     {
         // if it's an error symbol that has been clicked, the error on the line will be cleared
         if (!FilesInfo.ClearLineErrors(Npp.LineFromPosition(nc.position)))
         {
             // if nothing has been cleared, we go to the next error position
             FilesInfo.GoToNextError(Npp.LineFromPosition(nc.position));
         }
     }
 }
Esempio n. 18
0
        public async Task <bool> QuickScan(IProgress <ScanAndRepairProgress> progress = null)
        {
            {
                if (IsScanRunning)
                {
                    throw new Exception("Scan already running!");
                }

                var retVal = true;
                IsScanRunning = true;
                try
                {
                    _cts.Cancel();
                    _cts = new CancellationTokenSource();
                    IsCancellationRequested = false;

                    var totalCount   = FilesInfo.Count();
                    var currentIndex = 0;
                    Parallel.ForEach(FilesInfo, (fileInfo, state) =>
                    {
                        var index = Interlocked.Increment(ref currentIndex);

                        _cts.Token.ThrowIfCancellationRequested();

                        progress?.Report(new ScanAndRepairProgress(totalCount, index,
                                                                   new ExLog(LogLevel.Info, $"{fileInfo.FileName}")));

                        RunFileQuickCheck(Path.Combine(FilesRootPath, fileInfo.FileName), fileInfo.Size);

                        if (RunFileQuickCheck(Path.Combine(FilesRootPath, fileInfo.FileName), fileInfo.Size))
                        {
                            return;
                        }

                        retVal = false;
                        state.Break();
                    });

                    await Task.Delay(25, _cts.Token).ConfigureAwait(false);
                }
                finally
                {
                    IsScanRunning = false;
                }

                return(retVal);
            }
        }
        public ActionResult Add(string name, string path, string format, short type)
        {
            var       mem    = PaityMemberService.GetEntity(u => u.UserInfoID == LoginUser.ID).FirstOrDefault();
            FilesInfo entity = new FilesInfo();

            entity.RegTime       = DateTime.Now;
            entity.ModfiedTime   = DateTime.Now;
            entity.Type          = type;
            entity.FileName      = name;
            entity.FilePath      = path;
            entity.FileSize      = format;
            entity.Remark        = name;
            entity.Status        = 1;
            entity.PaityMemberID = mem.ID;
            entity.DelFlag       = true;
            FilesInfoService.Add(entity);
            return(Json(new { status = 1, errorMsg = "操作成功!!" }));
        }
Esempio n. 20
0
        //GAL start
        private void InitializeDashboard()
        {
            receiverUI1 = new ReceiverUI();
            receiverUI2 = new ReceiverUI();
            receiverUI3 = new ReceiverUI();
            receiverUI4 = new ReceiverUI();

            ARFCN1 = new UnitView();
            ARFCN2 = new UnitView();
            ARFCN3 = new UnitView();
            ARFCN4 = new UnitView();

            SetReceiverUI(receiverUI1, 1);
            SetReceiverUI(receiverUI2, 2);
            SetReceiverUI(receiverUI3, 3);
            SetReceiverUI(receiverUI4, 4);

            BrushConverter conv = new BrushConverter();

            dashboardButtonFiles = new DashboardButton();
            FilesInfo filesButton = new FilesInfo();

            SetDashboardButton("#ffea6c41", filesButton.ItemName, filesButton.Count, PackIconMaterialKind.File, dashboardButtonFiles);

            dashboardButtonRecordFiles = new DashboardButton();
            RecordsInfo recordsButton = new RecordsInfo();

            SetDashboardButton("#ffe69a2a", recordsButton.ItemName, recordsButton.Count, PackIconMaterialKind.RecordRec, dashboardButtonRecordFiles);

            dashboardButtonPhoneCalls = new DashboardButton();
            CallsInfo callButton = new CallsInfo();

            SetDashboardButton("#FF469408", callButton.ItemName, callButton.Count, PackIconMaterialKind.PhoneLog, dashboardButtonPhoneCalls);

            dashboardButtonSmsMessages = new DashboardButton();
            SmsInfo smsButton = new SmsInfo();

            SetDashboardButton("#FF177EC1", smsButton.ItemName, smsButton.Count, PackIconMaterialKind.EmailOpen, dashboardButtonSmsMessages);


            Units     = TransferDB.Units;
            computers = TransferDB.Computers;
        }
Esempio n. 21
0
        /// <summary>
        /// create SyncInfo
        /// </summary>
        /// <param name="link">link data (will be copied not referenced)</param>
        public SyncInfo(SyncLink link)
        {
            Link = link;
            Time = new TimeMeasurement(this);
            Files = new FilesInfo(this);
            Dirs = new DirsInfo(this);

            Paused = false;
            SyncDirExecutionInfos = new List<SyncDirExecutionInfo>();
            SyncFileExecutionInfos = new List<SyncFileExecutionInfo>();
            ConflictInfos = new List<ElementConflictInfo>();
            LogStack = new Stack<LogMessage>();

            MyDirInfo rootDir = new MyDirInfo("\\", "");
            SyncDirInfo sdi = new SyncDirInfo(this, rootDir, false);
            DirTree = new DirTree(rootDir, null, null);

            Status = SyncStatus.DetectingChanges;
        }
Esempio n. 22
0
        private void AddFiles(int id)
        {
            FilesInfo entity = new FilesInfo();

            entity.DelFlag       = true;
            entity.FileName      = "入党申请书";
            entity.ModfiedTime   = DateTime.Now;
            entity.RegTime       = DateTime.Now;
            entity.Type          = 1;
            entity.Status        = 1;
            entity.PaityMemberID = id;
            FilesInfoService.Add(entity);
            entity.FileName = "团员入党推荐表";
            FilesInfoService.Add(entity);
            entity.FileName = "党校结业鉴定表";
            FilesInfoService.Add(entity);
            entity.FileName = "政审材料";
            FilesInfoService.Add(entity);
        }
Esempio n. 23
0
        /// <summary>
        /// create SyncInfo
        /// </summary>
        /// <param name="link">link data (will be copied not referenced)</param>
        public SyncInfo(SyncLink link)
        {
            Link  = link;
            Time  = new TimeMeasurement(this);
            Files = new FilesInfo(this);
            Dirs  = new DirsInfo(this);

            Paused = false;
            SyncDirExecutionInfos  = new List <SyncDirExecutionInfo>();
            SyncFileExecutionInfos = new List <SyncFileExecutionInfo>();
            ConflictInfos          = new List <ElementConflictInfo>();
            LogStack = new Stack <LogMessage>();

            MyDirInfo   rootDir = new MyDirInfo("\\", "");
            SyncDirInfo sdi     = new SyncDirInfo(this, rootDir, false);

            DirTree = new DirTree(rootDir, null, null);

            Status = SyncStatus.DetectingChanges;
        }
Esempio n. 24
0
        public object DeleteBibloImage(FilesInfo item)
        {
            var updateImage = cugDB.BibloUploads.Where(mf => mf.Id.Equals(item.FileId)).FirstOrDefault();

            if (updateImage == null)
            {
                return(new Response
                {
                    Status = "Success", Message = "Image Deleted Saved."
                });
            }
            // updateImage.IsDeleted = false;

            cugDB.Entry(updateImage).State = System.Data.Entity.EntityState.Deleted;
            cugDB.SaveChanges();

            return(new Response
            {
                Status = "Success", Message = "Reference Deleted Saved."
            });
        }
Esempio n. 25
0
        /// <summary>
        /// 查找满足条件的Prefab并进行输出.
        /// </summary>
        public void FindPrefabWithText()
        {
            FilesInfo fiObject = new FilesInfo();

            // 写出Json记录文件.
            // 找出所有带有Text控件的Prefab.
            // m_outputPath = @"D:\saveText_cjp.json";
            // string strCheckFilesPath = @"C:\svnWorks\android142_cjp_pack\Assets";
            // string strUnityDataPath = @"C:\svnWorks\android142_cjp_pack\Assets";
            // string[] checkFiles = Directory.GetFiles(strCheckFilesPath, "*.prefab", SearchOption.AllDirectories);
            List <string> totalLst = m_findFilesPath;

            string strSetFileName = string.Empty;

            foreach (var eachFile in totalLst)
            {
                bool bIsContainText = CheckIfContainText(eachFile);

                // 转换eachFile里的文件格式.
                // GetAssetNameFromPath
                if (bIsContainText)
                {
                    strSetFileName = CommonUtils.GetAssetNameFromPath(eachFile, m_unityDataPath);
                    //
                    // Console.WriteLine();
                    fiObject.lstFiles.Add(strSetFileName);
                }
            }



            string strResult = JsonConvert.SerializeObject(fiObject, Formatting.Indented);

            CommonUtils.WriteFile(m_outputPath, strResult);


            // Console.ReadKey();
        }
        void AttachedFilesCore(string[] names)
        {
            bool     fileLengthExceed = false;
            FileInfo info;

            foreach (string name in names)
            {
                info = new FileInfo(name);
                if (info.Length > FilesHelper.MaxAttachedFileSize * 1050578)
                {
                    fileLengthExceed = true;
                }
                else
                {
                    FilesInfo.Add(FilesHelper.GetAttachedFileInfo(info.Name, info.DirectoryName));
                }
            }
            if (fileLengthExceed)
            {
                MessageBoxService.ShowMessage(string.Format("The size of one of the files exceeds {0} MB.", FilesHelper.MaxAttachedFileSize), "Error attaching files");
            }
            SetCollectionChange();
            Update();
        }
Esempio n. 27
0
 private void dgvView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex == -1)
     {
         return;
     }
     if (e.ColumnIndex == 0)
     {
         int           num   = 1;
         List <string> files = new List <string>();
         foreach (DataGridViewRow row in dgvView.Rows)
         {
             DataGridViewCheckBoxCell cell = row.Cells[0] as DataGridViewCheckBoxCell;
             if (Convert.ToBoolean(cell.EditingCellFormattedValue) == true)
             {
                 files.Add(row.Cells["FileColumn"].Value.ToString());
                 int n = Convert.ToInt32(row.Cells[2].Value);
                 if (n == 1)
                 {
                     row.Cells[4].Value = num.ToString("00000000");
                 }
                 else
                 {
                     row.Cells[4].Value = num.ToString("00000000") + "-" + (num + n - 1).ToString("00000000");
                 }
                 num += n;
             }
             else
             {
                 row.Cells[4].Value = "";
             }
         }
         string info = FilesInfo.GetFilesInfo(files.ToArray());
         lblInfo.Text = info;
     }
 }
Esempio n. 28
0
 private void BtNextErrorOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     FilesInfo.GoToNextError(Sci.Line.CurrentLine + 1);
 }
Esempio n. 29
0
 private void BtPrevErrorOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     FilesInfo.GoToPrevError(Npp.Line.CurrentLine - 1);
 }
Esempio n. 30
0
 private void BtClearAllErrorsOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     FilesInfo.ClearAllErrors(Plug.CurrentFilePath);
     Npp.GrabFocus();
 }
 public ActionResult Edit(FilesInfo entity)
 {
     entity.ModfiedTime = DateTime.Now;
     FilesInfoService.Update(entity);
     return(Json(new { status = 1, errorMsg = "操作成功!!" }));
 }