private void ParseOutput(string output, string subtitle, string propertyNameToBeSet) { string[] initialSplit = output.Split(new string[] { subtitle, "\n", "\r", " ", "=" }, StringSplitOptions.RemoveEmptyEntries); SCCompiled scCompiled; //Reverse iteration in pairs for (int i = initialSplit.Length - 1; i >= 0; i = i - 2) { if (initialSplit[i].Contains(BaseFilePath)) { i = i + 1; //It is a interface, so with empty BIN, go to the next skipping only one } else { string name = initialSplit[i - 1].Split(':').Last(); scCompiled = CompiledData.Where(c => c.Name == name).FirstOrDefault(); bool newSC = scCompiled == null; if (newSC) { scCompiled = new SCCompiled(); scCompiled.Name = name; } scCompiled.GetType().GetProperty(propertyNameToBeSet, BindingFlags.Public | BindingFlags.Instance).SetValue(scCompiled, initialSplit[i]); if (newSC) { CompiledData.Add(scCompiled); } } } }
protected override void OnResultCompile() { if (Result == null) { var compiledData = new CompiledData(this); Result = compiledData; } }
///////////////////////////////////////// protected override void OnResultCompile() { if (Result == null) { CompiledData result = null; //PixelFormat createFormatV = CreateFormat; //if( createFormatV != PixelFormat.Unknown ) //{ // //create // string error2; // result = new GpuTexture( type, size, depth, mipmaps, createFormatV, gpuUsage, fsaa, out error2 ); // if( !string.IsNullOrEmpty( error2 ) ) // { // result.Dispose(); // result = null; // //!!!!! // Log.Fatal( "impl" ); // } //} //else { //load //threading //каждый раз проверять будет если нет файла. где еще так? //var v = LoadFile.Value; //var resourceName = v != null ? v.ResourceName : ""; //if( VirtualFile.Exists( resourceName ) ) //{ result = new CompiledData(this); //} } Result = result; } }
public List <CompiledData> Extract(string pathFiles) { Console.WriteLine("Extracting Data "); char[] separator = { ' ' }; string separatorDomainCode = "."; string separatorFileName = "-"; int viewCount = 0; int responseSize = 0; int found = 0; var compiledList = new List <CompiledData>(); try { DirectoryInfo directorySelected = new DirectoryInfo(pathFiles); foreach (FileInfo fileToRead in directorySelected.GetFiles("*.*")) { Console.WriteLine($"Working on File: {fileToRead.Name}"); var period = fileToRead.FullName.Split(separatorFileName); var allLines = File.ReadAllLines(fileToRead.FullName); foreach (var currentLine in allLines) { var periodHour = period[2].Substring(0, 2); string[] splitCurrentLine = currentLine.Split(separator); var domainCode = splitCurrentLine[0]; var pageTitle = splitCurrentLine[1]; viewCount = Convert.ToInt32(splitCurrentLine[2]); responseSize = Convert.ToInt32(splitCurrentLine[3]); string language = null; string domain = null; found = domainCode.IndexOf(separatorDomainCode); if (found < 0) { language = splitCurrentLine[0];; domain = "Wikipedia"; } else { string[] splitDomainCode = domainCode.Split(separatorDomainCode); language = splitDomainCode.First(); var smallDomain = splitDomainCode.Last(); domain = Domains.Get().Where(x => x.GetCode() == smallDomain).FirstOrDefault().GetName(); } var compiledData = new CompiledData(domainCode, language, domain, pageTitle, viewCount, responseSize, periodHour, currentLine); compiledList.Add(compiledData); } ; } } catch (Exception Ex) { Console.WriteLine(Ex); } return(compiledList); }