Example #1
0
        private void processLine(PropertyLine line)
        {
            if (line.IsAmountCalculated)
            {
                line.Amount = 0.00M;
                foreach (var subLine in line.Sublines)
                {
                    processLine(subLine);
                    switch (subLine.AmountOperand)
                    {
                    case PropertyLine.AmountOperation.Plus:
                        line.Amount += subLine.Amount;
                        break;

                    case PropertyLine.AmountOperation.Subtract:
                        line.Amount -= subLine.Amount;
                        break;

                    case PropertyLine.AmountOperation.None:
                        break;

                    default:
                        break;
                    }
                }
            }
            else
            {
            }
            line.Message = "";
        }
Example #2
0
 private void ClearMessageLine(PropertyLine line)
 {
     line.Message = "";
     foreach (var subL in line.Sublines)
     {
         ClearMessageLine(subL);
     }
 }
        private void handleValidationResult()
        {
            PropertyEntry propertyEntry = new PropertyEntry();
            PropertyLine  propLine      = ValidationPropertyUtil.readPropertyLine("");

            if (propLine != null)
            {
                propertyEntry.MessageLine = propLine;
                if (propLine.Type == "message")
                {
                    PropertyLine pathPropLine = ValidationPropertyUtil.readPropertyLine("");
                    propertyEntry.PathLine = pathPropLine;
                }
            }
        }
Example #4
0
        public static PropertyLine readPropertyLine(String line)
        {
            String[] split = line.Split('=');
            String[] type  = split[0].Split('.');

            if (type.Length > 1)
            {
                PropertyLine propLine = new PropertyLine();
                propLine.Type  = type[1].Trim();
                propLine.Value = split[1].Trim();
                propLine.Count = ExtractIntFromString(type[0]);
                return(propLine);
            }
            return(null);
        }
        public async Task ReadFile(StreamReader reader)
        {
            string        line;
            IGedcomReader objectReader = new Discarder();

            while ((line = reader.ReadLine()) != null)
            {
                PropertyLine pline = new PropertyLine(line);

                if (pline.Level == 0)
                {
                    // save previous object
                    await objectReader.Store(this.treeService).ConfigureAwait(false);

                    switch (pline.Value)
                    {
                    case "INDI":
                        objectReader = new IndividualReader(pline);
                        break;

                    case "FAM":
                        objectReader = new FamilyReader(pline);
                        break;

                    default:
                        // HEAD, TRLR, SOUR, NOTE, ...
                        objectReader = new Discarder();
                        break;
                    }
                }
                else
                {
                    objectReader.ProcessNextLine(pline);
                }
            }

            // and store the last object (although that would be an ignored TRLR in a real file)
            await objectReader.Store(this.treeService).ConfigureAwait(false);
        }
Example #6
0
        public IList <PropertyLine> GetInitialData(IConfigurationSection arrayOfLines)
        {
            var lines = new List <PropertyLine>();

            foreach (IConfigurationSection section in arrayOfLines.GetChildren())
            {
                var id                 = section.GetSection("Id").Value;
                var header             = section.GetSection("Header").Value;
                var footer             = section.GetSection("Footer").Value;
                var amount             = decimal.Parse(section.GetSection("Amount").Value);
                var isAmountCalculated = bool.Parse(section.GetSection("IsAmountCalculated").Value);
                var amountPos          = (PropertyLine.AmountLocation)Int32.Parse(section.GetSection("AmountPos").Value);
                var amountOperSection  = section.GetSection("AmountOperand").Value;
                var amountOperand      = amountOperSection != null ? (PropertyLine.AmountOperation)Int32.Parse(amountOperSection) : PropertyLine.AmountOperation.Plus;
                var subLines           = GetInitialData(section.GetSection("Sublines"));
                var aLine              = new PropertyLine()
                {
                    Id = id, Header = header, Footer = footer, Amount = amount, IsAmountCalculated = isAmountCalculated, AmountPos = amountPos, Sublines = subLines, AmountOperand = amountOperand
                };
                lines.Add(aLine);
            }
            return(lines);
        }
        private void Stream( ArrayList data, PropertyLine propLine )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( PropertyLine ) ) );

              // No data at this level yet!
        }
Example #8
0
        public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            // we want gcc toolchain 4.9, but fall back to 4.8 or 4.6 for now if it doesn't exist
            string NDKPath = Environment.GetEnvironmentVariable("NDKROOT");

            NDKPath = NDKPath.Replace("\"", "");

            AndroidToolChain ToolChain = new AndroidToolChain(Target.ProjectFile, false, Target.AndroidPlatform.Architectures, Target.AndroidPlatform.GPUArchitectures);

            // figure out the NDK version
            string NDKToolchainVersion = "unknown";
            string NDKDefine           = "100500";      // assume r10e
            string SourcePropFilename  = Path.Combine(NDKPath, "source.properties");

            if (File.Exists(SourcePropFilename))
            {
                string   RevisionString   = "";
                string[] PropertyContents = File.ReadAllLines(SourcePropFilename);
                foreach (string PropertyLine in PropertyContents)
                {
                    if (PropertyLine.StartsWith("Pkg.Revision"))
                    {
                        RevisionString = PropertyLine;
                        break;
                    }
                }

                int EqualsIndex = RevisionString.IndexOf('=');
                if (EqualsIndex > 0)
                {
                    string[] RevisionParts  = RevisionString.Substring(EqualsIndex + 1).Trim().Split('.');
                    int      RevisionMinor  = int.Parse(RevisionParts.Length > 1 ? RevisionParts[1] : "0");
                    char     RevisionLetter = Convert.ToChar('a' + RevisionMinor);
                    int      RevisionBeta   = 0;               // @TODO
                    NDKToolchainVersion = "r" + RevisionParts[0] + (RevisionMinor > 0 ? Char.ToString(RevisionLetter) : "");
                    NDKDefine           = RevisionParts[0] + string.Format("{0:00}", RevisionMinor + 1) + string.Format("{0:00}", RevisionBeta);
                }
            }
            else
            {
                string ReleaseFilename = Path.Combine(NDKPath, "RELEASE.TXT");
                if (File.Exists(ReleaseFilename))
                {
                    string[] PropertyContents = File.ReadAllLines(SourcePropFilename);
                    NDKToolchainVersion = PropertyContents[0];
                }
            }

            // PLATFORM_ANDROID_NDK_VERSION is in the form 150100, where 15 is major version, 01 is the letter (1 is 'a'), 00 indicates beta revision if letter is 00
            Log.TraceInformation("PLATFORM_ANDROID_NDK_VERSION = {0}", NDKDefine);
            CompileEnvironment.Definitions.Add("PLATFORM_ANDROID_NDK_VERSION=" + NDKDefine);

            string GccVersion    = "4.6";
            int    NDKVersionInt = ToolChain.GetNdkApiLevelInt();

            if (Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.9")))
            {
                GccVersion = "4.9";
            }
            else
            if (Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.8")))
            {
                GccVersion = "4.8";
            }

            Log.TraceInformation("NDK toolchain: {0}, NDK version: {1}, GccVersion: {2}, ClangVersion: {3}", NDKToolchainVersion, NDKVersionInt.ToString(), GccVersion, ToolChain.GetClangVersionString());

            CompileEnvironment.Definitions.Add("PLATFORM_DESKTOP=0");
            CompileEnvironment.Definitions.Add("PLATFORM_CAN_SUPPORT_EDITORONLY_DATA=0");

            CompileEnvironment.Definitions.Add("WITH_OGGVORBIS=1");

            CompileEnvironment.Definitions.Add("UNICODE");
            CompileEnvironment.Definitions.Add("_UNICODE");

            CompileEnvironment.Definitions.Add("PLATFORM_ANDROID=1");
            CompileEnvironment.Definitions.Add("ANDROID=1");

            CompileEnvironment.Definitions.Add("WITH_DATABASE_SUPPORT=0");
            CompileEnvironment.Definitions.Add("WITH_EDITOR=0");
            CompileEnvironment.Definitions.Add("USE_NULL_RHI=0");
            CompileEnvironment.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS");

            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/include");

            // the toolchain will actually filter these out
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a/include");
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/arm64-v8a/include");
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86/include");
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86_64/include");

            LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a");
            LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/arm64-v8a");
            LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86");
            LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86_64");

            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/android/native_app_glue");
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/android/cpufeatures");

            //@TODO: Tegra Gfx Debugger - standardize locations - for now, change the hardcoded paths and force this to return true to test
            if (UseTegraGraphicsDebugger(Target))
            {
                //LinkEnvironment.LibraryPaths.Add("ThirdParty/NVIDIA/TegraGfxDebugger");
                //LinkEnvironment.LibraryPaths.Add("F:/NVPACK/android-kk-egl-t124-a32/stub");
                //LinkEnvironment.AdditionalLibraries.Add("Nvidia_gfx_debugger_stub");
            }

            SetupGraphicsDebugger(Target, CompileEnvironment, LinkEnvironment);

            LinkEnvironment.AdditionalLibraries.Add("gnustl_shared");
            LinkEnvironment.AdditionalLibraries.Add("gcc");
            LinkEnvironment.AdditionalLibraries.Add("z");
            LinkEnvironment.AdditionalLibraries.Add("c");
            LinkEnvironment.AdditionalLibraries.Add("m");
            LinkEnvironment.AdditionalLibraries.Add("log");
            LinkEnvironment.AdditionalLibraries.Add("dl");
            if (!UseTegraGraphicsDebugger(Target))
            {
                LinkEnvironment.AdditionalLibraries.Add("GLESv2");
                LinkEnvironment.AdditionalLibraries.Add("EGL");
            }
            LinkEnvironment.AdditionalLibraries.Add("OpenSLES");
            LinkEnvironment.AdditionalLibraries.Add("android");
        }
 public PropertyLine(PropertyLine original)
     : this(original.Name, original.Value)
 {
 }
Example #10
0
 public PropertyLine(PropertyLine original)
     : this(original.Name, original.Value)
 {
 }
        public override void dataReveiced(List <string> receivedLines)
        {
            for (int i = 0; i < receivedLines.Count; i++)
            {
                String line = receivedLines[i];

                if (line == "SETUP_VALIDATION_SESSION")
                {
                    setIsActive(true);
                }

                else if (line == "TEARDOWN_VALIDATION_SESSION")
                {
                    setIsActive(false);

                    foreach (PropertyEntry entry in errorCountToPropertyLine.Values)
                    {
                        Main.consistencyModule.RuleControl.handleRuleResult(Consistency.ConsistencyModule.propertyEntryToRuleResult(entry), sqlRep);
                    }
                    Main.consistencyModule.refreshOutputs(sqlRep);
                }

                else if (isActive())
                {
                    PropertyLine  propLine      = ValidationPropertyUtil.readPropertyLine(receivedLines[i]);
                    PropertyEntry propertyEntry = null;

                    if (!errorCountToPropertyLine.ContainsKey(propLine.Count))
                    {
                        propertyEntry = new PropertyEntry();
                        errorCountToPropertyLine.Add(propLine.Count, propertyEntry);
                    }
                    else
                    {
                        propertyEntry = errorCountToPropertyLine[propLine.Count];
                    }
                    if (propLine.Type == "message")
                    {
                        propertyEntry.MessageLine = propLine;
                    }
                    else
                    {
                        propertyEntry.PathLine = propLine;
                        if (propertyEntry.PathLine.Value != "")
                        {
                            try
                            {
                                propertyEntry.MoflonObject = ValidationPropertyUtil.computeObjectFromPath(sqlRep, propertyEntry.PathLine.Value);
                            }
                            catch (NullReferenceException)
                            {
                                //something went wrong while computing the path
                                errorCountToPropertyLine.Remove(propLine.Count);
                                Main.tcpServerFunctions.addStatusMessage("An error occured while parsing the validation results from Eclipse: " + propertyEntry.PathLine.Value);
                            }
                        }
                    }
                }
            }
            stream.WriteByte((byte)10);
        }
Example #12
0
        private static IEnumerable <AssemblyLine> ParseInputFile(string inputFile)
        {
            var currentLineCount = 0;
            var typeLines        = new List <TypeLine>();
            var assemblyLines    = new List <AssemblyLine>();

            using (var reader = new StreamReader(inputFile))
            {
                while (!reader.EndOfStream)
                {
                    currentLineCount++;
                    var currentLine = reader.ReadLine();

                    if (string.IsNullOrEmpty(currentLine))
                    {
                        continue;
                    }
                    if (currentLine.Trim() == "")
                    {
                        continue;
                    }
                    if (currentLine.ToLower().Trim().Equals("break;"))
                    {
                        break;
                    }
                    if (currentLine.ToLower().Trim().Equals("return;"))
                    {
                        return(assemblyLines);
                    }
                    if (!currentLine.ToLower().Trim().StartsWith("//"))
                    {
                        if (AssemblyLine.IsAssembly(currentLine))
                        {
                            var assemblyLine = new AssemblyLine(currentLineCount, currentLine);
                            assemblyLines.Add(assemblyLine);
                        }
                        else if (TypeLine.IsType(currentLine))
                        {
                            if (assemblyLines.Count == 0)
                            {
                                "CryoAOP -> Error:{0}! Could not find matching assembly tag for type ... ".Error(
                                    currentLineCount.ToString());
                                "CryoAOP -> '{0}'".Error(currentLine.Trim());
                                WriteUsage();
                                return(assemblyLines);
                            }

                            var typeLine = new TypeLine(currentLineCount, currentLine);
                            assemblyLines.Last().Types.Add(typeLine);
                            typeLines.Add(typeLine);
                        }
                        else if (MethodLine.IsMethod(currentLine))
                        {
                            if (assemblyLines.Count == 0 && typeLines.Count == 0)
                            {
                                "CryoAOP -> Error:{0}! Could not find matching type tag for method ... ".Error(
                                    currentLineCount.ToString());
                                "CryoAOP -> '{0}'".Error(currentLine.Trim());
                                WriteUsage();
                                return(assemblyLines);
                            }

                            var methodLine = new MethodLine(currentLineCount, currentLine);
                            typeLines.Last().Methods.Add(methodLine);
                        }
                        else if (PropertyLine.IsProperty(currentLine))
                        {
                            if (assemblyLines.Count == 0 && typeLines.Count == 0)
                            {
                                "CryoAOP -> Error:{0}! Could not find matching type tag for property ... ".Error(
                                    currentLineCount.ToString());
                                "CryoAOP -> '{0}'".Error(currentLine.Trim());
                                WriteUsage();
                                return(assemblyLines);
                            }

                            var propertyLine = new PropertyLine(currentLineCount, currentLine);
                            typeLines.Last().Properties.Add(propertyLine);
                        }
                        else
                        {
                            "CryoAOP -> Warning:{0}! Ignoring line because entry appears to be invalid ... ".Warn(
                                currentLineCount);
                            "CryoAOP -> '{0}'".Warn(currentLine.Trim());
                        }
                    }
                }
            }
            return(assemblyLines);
        }