Esempio n. 1
0
        //Create a task to process import data
        Task ProcessImport(List <string> data, IProgress <ProgressReport> progress)
        {
            int index          = 1;
            int totalProgress  = data.Count;
            var progressReport = new ProgressReport();

            miss = 0; dismatch = 0; match = 0;

            //Create a new thread
            return(Task.Run(() =>
            {
                baseObj.szFailFiles.Clear();

                SetupIniIP.IniWriteValue("Diff", null, null, CommonBase.szIniLogFileName);
                SetupIniIP.IniWriteValue("Miss", null, null, CommonBase.szIniLogFileName);

                for (int i = 0; i < totalProgress; i++)
                {
                    for (int j = 0; j < local_idx; j++)
                    {
                        if (baseObj.szLocalFiles[j] == baseObj.szTargetFiles[i])
                        {
                            if (baseObj.szLocalChecksum[j] != baseObj.szTargetChecksum[i])
                            {
                                baseObj.szFailFiles.Add("(diff) " + baseObj.szTargetFiles[i]);
                                SetupIniIP.IniWriteValue("Diff", dismatch.ToString(), baseObj.szTargetFiles[i], CommonBase.szIniLogFileName);
                                dismatch++;
                            }
                            else
                            {
                                baseObj.szFailFiles.Add("(match) " + baseObj.szTargetFiles[i]);
                                //SetupIniIP.IniWriteValue("Match", match.ToString(), baseObj.szTargetFiles[i], CommonBase.szIniLogFileName);
                                match++;
                            }
                            break;
                        }
                        else if (j == (local_idx - 1))
                        {
                            baseObj.szFailFiles.Add("(miss)  " + baseObj.szTargetFiles[i]);
                            SetupIniIP.IniWriteValue("Miss", miss.ToString(), baseObj.szTargetFiles[i], CommonBase.szIniLogFileName);
                            miss++;
                        }
                    }
                    progressReport.PercentComplete = index++ *100 / totalProgress;
                    progress.Report(progressReport);
                    Thread.Sleep(10);
                }
            }));
        }
Esempio n. 2
0
        private void metroButtonExport_Click(object sender, EventArgs e)
        {
            string fileName = "Export_TemplateName_01";

            if (ExportDialog.InputBox("", "Please enter a valid file name: (.ini)", ref fileName) == DialogResult.OK)
            {
                fileName = fileName + ".ini";

                waitForm.Show(this);
                for (int i = 0; i < local_idx; i++)
                {
                    SetupIniIP.IniWriteValue("Node", baseObj.szLocalFiles[i], baseObj.szLocalChecksum[i], fileName);
                }
                waitForm.Close();
            }
        }