예제 #1
0
        public override bool Execute()
        {
            TaskLoggingHelper loggingHelper = new TaskLoggingHelper(this);

            try
            {
                loggingHelper.LogMessageFromText("*** Start View Model generation from Proto Reflection", MessageImportance.High);
                if (SourceFiles.Count() != DestinationFiles.Count())
                {
                    loggingHelper.LogError("Expected SourceFiles.Count == DestinationFiles.Count");
                    return(false);
                }
                int count = SourceFiles.Count();
                if (count == 0)
                {
                    loggingHelper.LogError("Expected SourceFiles.Count > 0");
                    return(false);
                }
                for (int i = 0; i < count; i++)
                {
                    Generate(SourceFiles[i], DestinationFiles[i], loggingHelper);
                }
            }
            catch (Exception ex)
            {
                loggingHelper.LogErrorFromException(ex);
                return(false);
            }
            return(true);
        }
예제 #2
0
        public void GivenIPlaceAKilobyteFileWithDifferencesIntoTheDestinationFolder(int p0, int p1)
        {
            var  bytes = new List <byte>();
            byte b     = 0;

            for (var i = 0; i < p0 * 1000; i++)
            {
                if (p1 == 0 || i % 10 != 0)
                {
                    bytes.Add(b);
                }
                else
                {
                    bytes.Add((byte)((b + 3) % 256));
                    p1--;
                }
                b = (byte)((b + 1) % 256);
            }

            if (!DestinationFiles.ContainsKey(p0))
            {
                DestinationFiles[p0] = DestinationFolder.FullName + @"\" + p0 + "kilobytes.dll";
            }
            File.WriteAllBytes(DestinationFiles[p0], bytes.ToArray());
        }