Пример #1
0
        public bool testComponent()
        {
            TestUtilities.title("Testing FileNameEditor", '=');
            TestUtilities.putLine();

            TestUtilities.title("Testing extension edits");
            FileName fileName  = "SomeFile.cs.2";
            FileName test1Name = addXmlExt(fileName);
            bool     t1        = test1Name.Contains(".xml");

            showResult(t1, test1Name, "addXmlExt");

            FileName test2Name = removeXmlExt(test1Name);
            bool     t2        = test2Name == fileName;

            showResult(t2, test2Name, "removeXmlExt");

            FileName test3Name = removeXmlExt(test2Name);
            bool     t3        = test3Name == fileName;

            showResult(t3, test3Name, "removeXmlExt");
            TestUtilities.putLine();

            TestUtilities.title("Testing path construction");
            DirName stagingdir  = "Fawcett";
            FullDir stagingpath = stagingPath(stagingdir);
            bool    t4          = (stagingpath.Contains("C:/") || stagingpath.Contains("../")) && stagingpath.Contains(stagingdir);

            showResult(t4, stagingpath, "stagingPath");

            DirName category    = "SomeCategory";
            FullDir storagepath = storagePath(category);
            bool    t5          = (storagepath.Contains("C:/") || storagepath.Contains("../")) && storagepath.Contains(category);

            showResult(t5, storagepath, "storagePath");

            FileName someFileName = "someFileName";
            FileSpec filespec     = fileSpec(storagepath, someFileName);
            bool     t6           = filespec.Contains("/someFileName");

            showResult(t6, filespec, "fileSpec");

            FileRef fileref = storageFolderRef(filespec);
            bool    t7      = fileref.IndexOf('/') == fileref.LastIndexOf('/');

            showResult(t7, fileref, "storageFolderRef");

            DirName cat = extractCategory(fileref);
            bool    t8  = cat == category;

            showResult(t8, cat, "extractCategory");

            FileName file = extractFileName(fileref);
            bool     t9   = file == someFileName;

            showResult(t8, file, "extractFileName");

            return(t1 && t2 && t3 && t4 && t5 && t6 && t7 && t8 && t9);
        }
Пример #2
0
 internal void ReplaceHyphen()
 {
     if (FileName.Contains("–"))
     {
         var renamedFileName = FileName.Replace("–", "-");
         RenameFile(renamedFileName);
     }
 }
Пример #3
0
 internal void ReplaceUnderscores()
 {
     if (!FileName.Contains(" ") && FileName.Contains("_"))
     {
         var renamedFileName = FileName.Replace("_", " ");
         RenameFile(renamedFileName);
     }
 }
Пример #4
0
 public void BuildScriptData()
 {
     if (FileName.Contains("common"))
     {
     }
     else
     {
     }
 }
Пример #5
0
        public static List <string> ListExternalFiles(string PathName)
        {
            List <string> ListFolders = new List <string>();
            List <string> ListFiles   = new List <string>();

            // Get a list of all folders to check for files (no _fpk/_fpkd)
            foreach (string Directory in Directory.GetDirectories(PathName, "*.*", SearchOption.AllDirectories))
            {
                if (IsArchiveFolder(PathName, Directory))
                {
                    continue;
                }

                if (!Directory.Substring(PathName.Length).Contains(ExternalDirName))
                {
                    continue;
                }

                ListFolders.Add(Directory);
            }

            // Check all folders for files
            foreach (string Folder in ListFolders)
            {
                foreach (string FileName in Directory.GetFiles(Folder))
                {
                    bool skipFile = false;
                    foreach (string ignoreFile in Tools.ignoreFileList)
                    {
                        if (FileName.Contains(ignoreFile))
                        {
                            skipFile = true;
                        }
                    }

                    /*
                     * foreach (string ignoreExt in ignoreExtList) {
                     *  if (FileName.Contains(ignoreExt)) {
                     *      skipFile = true;
                     *  }
                     * }
                     */
                    if (skipFile)
                    {
                        continue;
                    }
                    string FilePath = FileName.Substring(Folder.Length);
                    if (!FilePath.Contains("metadata.xml")) // ignore xml metadata
                    {
                        ListFiles.Add(FileName);
                    }
                }
            }

            return(ListFiles);
        }
Пример #6
0
        public bool Identify(System.IO.Stream stream)
        {
            using (var reader = new FileReader(stream, true))
            {
                bool isTexture = reader.CheckSignature(4, "G1TG") || reader.CheckSignature(4, "GT1G");
                bool isModel   = reader.CheckSignature(4, "_M1G") || reader.CheckSignature(4, "G1M_");

                return((FileName.Contains(".bin.gz")) && !isTexture && !isModel);
            }
        }
Пример #7
0
        private void GeneratePokeStrings()
        {
            //Also check file name just in case
            if (FileName.Contains("pm"))
            {
                string baseName = FileName.Substring(0, 12);

                GFPAKHashCache.GeneratePokeStringsFromFile(baseName);
            }
        }
Пример #8
0
 //Open Button
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (!FileName.Contains("App.xaml"))
     {
         Process.Start(Settings.CurrentSettings.TextEditorExePath, Path.Combine(CurrentSolution.SourceDirectory, FileName));
     }
     else
     {
         Process.Start(Settings.CurrentSettings.TextEditorExePath, Path.Combine(CurrentSolution.WorkingDirectoryPath, FileName));
     }
 }
Пример #9
0
 private void AbortParser()
 {
     if (FileName.Contains("xlsx"))
     {
         _xssf.Write(_writer);
     }
     OnLogResult?.Invoke(new LogItem {
         Status = "Warning", Result = "Сканирование прервано!"
     });
     Abort   = true;
     EndPage = 1;
 }
Пример #10
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /* Changed this if statement. Would not save because document has default name thus making file name != null. If statement now checks for null as well as default file name */
            if (FileName == null || FileName.Contains("Untitled"))
            {
                saveAsToolStripMenuItem_Click(sender, e);
            }

            else
            {
                saveDocument();
                Serialize(FileName);
            }
        }
Пример #11
0
        /// <summary>
        /// Translate a <see cref="InputFile"/> instance to a set of command arguments to be passed to SoX to be applied to the input file (invalidates <see cref="object.ToString()"/>).
        /// </summary>
        /// <returns>String containing SoX command arguments.</returns>
        public override string ToString()
        {
            List <string> inputOptions = new List <string>(4);

            string baseStr = base.ToString();

            if (!string.IsNullOrEmpty(baseStr))
            {
                inputOptions.Add(baseStr);
            }

            if (Volume.HasValue)
            {
                inputOptions.Add("--volume " + Volume.Value);
            }

            if (IgnoreLength.HasValue && (IgnoreLength.Value == true))
            {
                inputOptions.Add("--ignore-length");
            }

            if (!string.IsNullOrEmpty(FileName))
            {
                if (FileName.Contains(" "))
                {
                    if ((Environment.OSVersion.Platform == PlatformID.Win32NT) ||
                        (Environment.OSVersion.Platform == PlatformID.Win32Windows) ||
                        (Environment.OSVersion.Platform == PlatformID.Win32S) ||
                        (Environment.OSVersion.Platform == PlatformID.WinCE))
                    {
                        inputOptions.Add("\"" + FileName + "\"");
                    }
                    else
                    {
                        inputOptions.Add("'" + FileName + "'");
                    }
                }
                else
                {
                    inputOptions.Add(FileName);
                }
            }
            else
            {
                inputOptions.Add("--null");
            }

            return(string.Join(" ", inputOptions));
        }
        public override bool Scan()
        {
            if (!FileName.Contains(".nhru"))
            {
                FileName += ".nhru";
            }
            DataCubeStreamReader stream = new DataCubeStreamReader(FileName);

            Variables     = stream.GetVariables();
            FeatureCount  = stream.FeatureCount;
            NumTimeStep   = TimeService.GetIOTimeLength(this.Owner.WorkDirectory);
            _StartLoading = TimeService.Start;
            MaxTimeStep   = NumTimeStep;
            return(true);
        }
Пример #13
0
        public static void LoadAccounts()
        {
            CheckForDataDirectory();
            CheckForAccountsDirectory();


            foreach (string FileName in Directory.GetFiles("Data/Accounts"))
            {
                if (FileName.Contains(".json"))
                {
                    MinecraftAccount Account = JsonConvert.DeserializeObject <MinecraftAccount>(FileName);
                    LoadedAccounts.Add(Account);
                }
            }
        }
Пример #14
0
        //****************************************************
        // Determins if the filename is a quote starting with
        // "Y" and the length of the filename and then moves
        // the file to its correct folder.
        //****************************************************

        public static void YQQuotes()
        {
            foreach (string file in files)
            {
                filearray = file;
                FileName  = Path.GetFileName(file);

                if (FileName == null)
                {
                    Console.WriteLine("NULL");
                }

                else if (FileName.Contains("Y"))
                {
                    string FileNameReduced = FileName.Remove(0, 1);
                    int    Datum           = FileNameReduced.IndexOf("-");
                    QuoteFolderLink2 = @"\" + FileNameReduced.Remove(Datum, FileName.Length - (Datum + 1));

                    if (Datum == 6)
                    {
                        QuoteFolderLink1  = FileNameReduced.Remove(3, FileNameReduced.Length - 3) + "XXX";
                        DestinationFolder = QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2 + @"\" + FileName;
                        File.Move(file, DestinationFolder);
                        Process.Start(QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2);
                        count = 1;
                    }
                    else if (Datum == 7)
                    {
                        QuoteFolderLink1  = @"\" + FileNameReduced.Remove(4, FileNameReduced.Length - 4) + "XXX";
                        DestinationFolder = QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2 + @"\" + FileName;
                        if (File.Exists(DestinationFolder))
                        {
                            ArchiveFile();
                        }
                        else
                        {
                            File.Move(file, DestinationFolder);
                            Process.Start(QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2);
                            count = 1;
                        }
                    }
                    else
                    {
                        count = 0;
                    }
                }
            }
        }
Пример #15
0
        public override string ToString()
        {
            var fileName = "";

            if (FileName.Contains("\\"))
            {
                var fileParts = FileName.Split('\\');
                fileName = fileParts[fileParts.Length - 1];
            }
            else
            {
                fileName = FileName;
            }

            return(string.Format("({1} in {2}) - {0}", Message, MessageType.ToString(), fileName));
        }
Пример #16
0
        private void openFileToolStripMenuItem_Open_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "csv Files (*.csv)|*.csv|All Files (*.*)|*.*";
            if (FileName == string.Empty || FileName == null)
            {
                if (openFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    FileName = openFileDialog.FileName;
                }
                else
                {
                    return;
                }
            }

            FileInfo fi = new FileInfo(FileName);

            this.SetAppState(AppStates.ParsingLog, fi.Name);
            this.StatusBox.Text = "File Loaded: " + FileName;
            if (FileName.Contains(".csv"))
            {
                this.StatusBox.Text = FileName;
                try
                {
                    if (Properties.Settings.Default.MAF_CL)
                    {
                        this.worker                            = new BackgroundWorker();
                        this.worker.DoWork                    += this.loadworker_Start;
                        this.worker.RunWorkerCompleted        += this.loadworker_ParseLogCompleted;
                        this.worker.WorkerReportsProgress      = true;
                        this.worker.WorkerSupportsCancellation = true;
                        this.worker.ProgressChanged           += this.loadworker_ProgressChanged;
                        this.worker.RunWorkerAsync(FileName);
                    }
                }
                catch
                {
                    this.SetAppState(AppStates.Idle, null);
                    Console.WriteLine(" ERROR! ");
                }

                this.closeFileToolStripMenuItem.Enabled = true;
            }
        }
Пример #17
0
        private void GeneratePokeStrings(string hashStr)
        {
            //Also check file name just in case
            if (FileName.Contains("pm"))
            {
                string baseName    = FileName.Substring(0, 12);
                string pokeStrFile = hashStr.Replace("pm0000_00", baseName);

                ulong hash = FNV64A1.Calculate(pokeStrFile);
                if (!hashList.ContainsKey(hash))
                {
                    hashList.Add(hash, pokeStrFile);
                }
            }

            for (int i = 0; i < 1000; i++)
            {
                string pokeStr = string.Empty;
                if (hashStr.Contains("pm0000"))
                {
                    pokeStr = hashStr.Replace("pm0000", $"pm{i.ToString("D4")}");
                }
                else if (hashStr.Contains("poke_XXXX"))
                {
                    pokeStr = hashStr.Replace("poke_XXXX", $"poke_{i.ToString("D4")}");
                }
                else if (hashStr.Contains("poke_ball_0000"))
                {
                    pokeStr = hashStr.Replace("poke_ball_0000", $"poke_ball_{i.ToString("D4")}");
                }
                else if (hashStr.Contains("poke_face_0000"))
                {
                    pokeStr = hashStr.Replace("poke_face_0000", $"poke_face_{i.ToString("D4")}");
                }
                else if (hashStr.Contains("poke_motion_0000"))
                {
                    pokeStr = hashStr.Replace("poke_motion_0000", $"poke_motion_{i.ToString("D4")}");
                }

                ulong hash = FNV64A1.Calculate(pokeStr);
                if (!hashList.ContainsKey(hash))
                {
                    hashList.Add(hash, pokeStr);
                }
            }
        }
Пример #18
0
        public ResultFileEntry([NotNull] string name, [NotNull] FileInfo fileInfo, bool displayEntry, CalcOption enablingOption)
        {
            Name               = name;
            FileName           = fileInfo.Name;
            FullFileName       = fileInfo.FullName;
            DisplayEntry       = displayEntry;
            EnablingCalcOption = enablingOption;

            if (FileName == FullFileName)
            {
                throw new LPGException("Full filename was same as filename");
            }

            if (FileName.Contains(":"))
            {
                throw new LPGException("Somehow the full path ended up in the Filename");
            }
        }
 protected override PokerFormat ParsePokerFormat(string[] handLines)
 {
     if (handLines[3].StartsWith("Tournament"))
     {
         if (!string.IsNullOrEmpty(FileName) && FileName.Contains("Sit & Go"))
         {
             return(PokerFormat.SitAndGo);
         }
         else
         {
             return(PokerFormat.MultiTableTournament);
         }
     }
     else
     {
         return(PokerFormat.CashGame);
     }
 }
        public override bool Load(int var_index, ICancelProgressHandler progress)
        {
            if (!FileName.Contains(".nhru"))
            {
                FileName += ".nhru";
            }
            _ProgressHandler = progress;
            NumTimeStep      = TimeService.GetIOTimeLength(this.Owner.WorkDirectory);
            string filename = this.FileName;

            if (UseSpecifiedFile)
            {
                filename = SpecifiedFileName;
            }
            int nstep = StepsToLoad;

            if (DataCube == null)
            {
                DataCube      = new DataCube <float>(Variables.Length, nstep, FeatureCount, true);
                DataCube.Name = "sw_out";
            }
            else
            {
                if (DataCube.Size[1] != nstep)
                {
                    DataCube = new DataCube <float>(Variables.Length, nstep, FeatureCount, true);
                }
            }
            DataCube.Variables = this.Variables;
            DataCube.Topology  = (Owner.Grid as RegularGrid).Topology;
            DataCube.DateTimes = this.TimeService.IOTimeline.Take(StepsToLoad).ToArray();
            DataCubeStreamReader stream = new DataCubeStreamReader(filename);

            stream.Scale           = (float)this.ScaleFactor;
            stream.DataCube        = this.DataCube;
            stream.MaxTimeStep     = this.StepsToLoad;
            stream.NumTimeStep     = this.NumTimeStep;
            stream.Loading        += stream_LoadingProgressChanged;
            stream.DataCubeLoaded += stream_DataCubeLoaded;
            stream.LoadFailed     += this.stream_LoadFailed;
            stream.LoadDataCube(var_index);
            return(true);
        }
Пример #21
0
        /// <summary>
        /// 保存按钮执行的动作
        /// </summary>
        private void SaveClick()
        {
            List <string> files = null;

            Controller.Convertor.ErrorType errors = Controller.Convertor.ErrorType.NoErros;
            IsInProgress = true;

            if (!System.IO.Directory.Exists(FilePath))
            {
                swApp.SendMsgToUser("当前路径不存在:" + FilePath);
                return;
            }
            if (FilePath.Contains("-") || FileName.Contains("-"))
            {
                swApp.SendMsgToUser("-为非法字符,路径或者文件民包含-字符,请修改路径或者文件名后重新保存");
                return;
            }
            try
            {
                //会堵塞UI;TODO:异步方式实现转换
                var model = Controller.Convertor.DuConvertor.ConvertToglTFModel(swModel, out errors);
                if (model != null)
                {
                    files = Controller.Convertor.DuConvertor.SaveAs(model, FilePath, FileName);
                }
                swApp.SendMsgToUser("保存完成");
                if (files != null && IsOpenFile && files.Count >= 3)
                {
                    System.Diagnostics.Process.Start(files[2]);
                }
                if (IsOpenFolder)
                {
                    System.Diagnostics.Process.Start("explorer.exe", FilePath);
                }
                IsInProgress = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            // System.Diagnostics.Process.Start("ExpLore", "C:\\window");
        }
Пример #22
0
        private void BtnLoadFile(object sender, EventArgs e)
        {
            label1.Visible       = false;
            tabControl1.Visible  = false;
            richTextBox1.Visible = false;

            var fd = new OpenFileDialog {
                Filter = "XML|*.xml"
            };

            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            FileName = fd.FileName;

            DataSet.ReadXml(FileName);

            if (FileName.Contains("CIF"))
            {
                RemoveEmptyTables(new[] { "SubjectData", "Contract", "ContractData", "Link" });
                ShowAndPopulateTab();
            }

            else if (FileName.Contains("CMF"))
            {
                RemoveEmptyTables(new[] { "Delete", "Subject" });
                ShowAndPopulateTab();
            }
            else if (FileName.Contains("IMF"))
            {
                RemoveEmptyTables(new[] { "SubjectData", "Immediate", "ImmediateData", "Link" });
                ShowAndPopulateTab();
            }
            else
            {
                MessageBox.Show("Error! wrong xml file selected");
            }

            AddTextToLabel();
        }
Пример #23
0
            public string TryGetHash(List <string> names, string folder)
            {
                //Name is not hashed so return
                if (!FileName.Contains(HashName))
                {
                    return(FileName);
                }

                for (int i = 0; i < names?.Count; i++)
                {
                    uint hash = StringHashToUint(hashName);
                    Console.WriteLine($"{FileName} {hash} {names[i]} {NameHash(names[i])}");
                    if (hash == NameHash($"{folder}/{names[i]}"))
                    {
                        return(names[i]);
                    }
                }

                return(FileName);
            }
        public async void Download(string path, DownloadProgressChangedEventHandler progress, bool async)
        {
            if (FileName == "")
            {
                return;
            }
            if (Uri.ToString().StartsWith("local:"))
            {
                CopyLocal(Uri.ToString().Replace("local:", ""), path);
                return;
            }

            if (FileName.Contains("VSCode") || FileName.Contains("WPILib"))
            {
                await DownloadHTTP(path);
            }
            else
            {
                using (WebClient client = new WebClient())
                {
                    client.DownloadProgressChanged += progress;

                    client.DownloadFileCompleted += (sender, eventargs) =>
                    {
                        Console.Out.WriteLine("Download finished for: " + Name);
                    };
                    if (async)
                    {
                        client.DownloadFileAsync(Uri, path + @"\" + FileName);
                    }
                    else
                    {
                        client.DownloadFile(Uri, path + @"\" + FileName);
                        Console.Out.WriteLine("Download finished for: " + Name);
                        Thread.Sleep(1000);
                        IsValid(path);
                    }
                }
            }
        }
Пример #25
0
        private void AddTextToLabel()
        {
            label1.Text    = "Presented File Type Is : ";
            label1.Visible = true;

            if (FileName.Contains("CIF"))
            {
                label1.Text += "CIF";
            }
            else if (FileName.Contains("CMF"))
            {
                label1.Text += "CMF";
            }
            else if (FileName.Contains("IMF"))
            {
                label1.Text += "IMF";
            }
            else
            {
                label1.Text += "Unsupported File";
            }
        }
Пример #26
0
 public void ExecuteArqBat(string numChamado)
 {
     if (FileName.Contains(numChamado))
     {
         NumChamado = numChamado;
         ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd.exe");
         processStartInfo.RedirectStandardInput  = true;
         processStartInfo.RedirectStandardOutput = true;
         processStartInfo.UseShellExecute        = false;
         Process process = Process.Start(processStartInfo);
         process.StandardInput.WriteLine(@"cd " + Diretorio);
         process.StandardInput.WriteLine(@"chamado.bat " + numChamado);
         process.StandardInput.WriteLine(@"exit");
         process.WaitForExit();
         process.Dispose();
         process.Close();
     }
     else
     {
         throw new Exception("O nome do arquivo deve conter o número do chamado!");
     }
 }
Пример #27
0
        //****************************************************
        // Determins if the filename is a quote starting with
        // "Q" and the length of the filename and then moves
        // the file to its correct folder.
        //****************************************************

        public static void QQuotes()
        {
            foreach (string file in files)
            {
                FileName = Path.GetFileName(file);

                if (FileName == null)
                {
                    Console.WriteLine("NULL");
                }

                else if (!FileName.Contains("Y") && FileName.Contains("Q"))
                {
                    Console.WriteLine("Q");
                    int Datum = FileName.IndexOf("-");
                    QuoteFolderLink2 = @"\" + FileName.Remove(Datum, FileName.Length - (Datum));
                    if (Datum == 6)
                    {
                        QuoteFolderLink1  = @"\" + FileName.Remove(3, FileName.Length - 3) + "XXX";
                        DestinationFolder = QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2 + @"\" + FileName;
                        File.Move(file, DestinationFolder);
                        Process.Start(QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2);
                        count = 1;
                    }
                    else if (Datum == 7)
                    {
                        QuoteFolderLink1  = @"\" + FileName.Remove(4, FileName.Length - 4) + "XXX";
                        DestinationFolder = QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2 + @"\" + FileName;
                        File.Move(file, DestinationFolder);
                        Process.Start(QuoteFolder + QuoteFolderLink1 + QuoteFolderLink2);
                        count = 1;
                    }
                    else
                    {
                        count = 0;
                    }
                }
            }
        }
Пример #28
0
#pragma warning restore CA1036 // Override methods on comparable types
        public ResultFileEntry([NotNull] string name,
                               [NotNull] FileInfo fileInfo,
                               bool displayEntry,
                               [CanBeNull] StreamWriter streamWriter,
                               [CanBeNull] BinaryWriter binaryWriter,
                               [NotNull] Stream stream,
                               ResultFileID rfid,
                               [NotNull] string householdName,
                               [NotNull] string householdKey,
                               [NotNull] LoadTypeInformation lti,
                               [NotNull] PersonInformation pi,
                               [NotNull] string additionalFileIndex,
                               TimeSpan timeResolution, CalcOption enablingOption)
        {
            EnablingCalcOption = enablingOption;
            TimeResolution     = timeResolution;
            Name                = name;
            FileName            = fileInfo.Name;
            FullFileName        = fileInfo.FullName;
            Stream              = stream;
            DisplayEntry        = displayEntry;
            StreamWriter        = streamWriter;
            BinaryWriter        = binaryWriter;
            ResultFileID        = rfid;
            HouseholdName       = householdName;
            LoadTypeInformation = lti;
            HouseholdKey        = householdKey;
            PersonInformation   = pi;
            AdditionalFileIndex = additionalFileIndex;
            if (FileName == FullFileName)
            {
                throw new LPGException("Full filename was same as filename");
            }

            if (FileName.Contains(":"))
            {
                throw new LPGException("Somehow the full path ended up in the Filename");
            }
        }
Пример #29
0
        /// <inheritdoc/>
        public override string ModelSummary()
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                if (FileName == null || FileName == "")
                {
                    htmlWriter.Write("Using <span class=\"errorlink\">FILE NOT SET</span>");
                }
                else if (!this.FileExists)
                {
                    htmlWriter.Write("The file <span class=\"errorlink\">" + FullFileName + "</span> could not be found");
                }
                else
                {
                    htmlWriter.Write("Using <span class=\"filelink\">" + FileName + "</span>");
                }

                if (FileName != null && FileName.Contains(".xls"))
                {
                    if (ExcelWorkSheetName == null || ExcelWorkSheetName == "")
                    {
                        htmlWriter.Write(" with <span class=\"errorlink\">WORKSHEET NOT SET</span>");
                    }
                    else
                    {
                        htmlWriter.Write(" with worksheet <span class=\"filelink\">" + ExcelWorkSheetName + "</span>");
                    }
                }

                htmlWriter.Write("\r\n</div>");

                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                htmlWriter.Write("\r\n<div class=\"activityentry\" style=\"Margin-left:15px;\">");
                htmlWriter.Write("\r\n<div class=\"activityentry\">Column name for <span class=\"filelink\">Land id</span> is ");
                if (SoilTypeColumnName is null || SoilTypeColumnName == "")
                {
                    htmlWriter.Write("<span class=\"errorlink\">NOT SET</span></div>");
                }
Пример #30
0
 private void WrieteResult(ref string itemName, ref string itemAvailability,
                           ref string itemPrice, ref string itemCode, ref string itemPhone)
 {
     if (itemPhone != null)
     {
         var matches = _regexPhone.Matches(itemPhone);
         if (matches.Count > 0)
         {
             itemPhone = "";
             foreach (Match match in matches)
             {
                 itemPhone += match.Value + ' ';
             }
         }
     }
     if (!FileName.Contains("xlsx"))
     {
         var outputText = itemName + '\t' + itemAvailability + '\t' + itemPrice + '\t' +
                          itemCode + '\t' + itemPhone + '\n';
         var info = new UTF8Encoding(true).GetBytes(outputText);
         _writer?.Write(info, 0, info.Length);
     }
     else
     {
         _indexRow++;
         var row = _sheet.CreateRow(_indexRow);
         row.CreateCell(0).SetCellValue(itemName);
         row.CreateCell(1).SetCellValue(itemAvailability);
         row.CreateCell(2).SetCellValue(itemPrice);
         row.CreateCell(3).SetCellValue(itemCode);
         row.CreateCell(4).SetCellValue(itemPhone);
         _sheet.AutoSizeColumn(0);
         _sheet.AutoSizeColumn(1);
         _sheet.AutoSizeColumn(2);
         _sheet.AutoSizeColumn(3);
         _sheet.AutoSizeColumn(4);
     }
 }