Beispiel #1
0
        public static void Main()
        {
            PageCollection finalPageCollection = null;

            foreach (var filename in Directory.GetFiles(@"\SD"))
            {
                var extension = Path.GetExtension(filename);
                var basename  = Path.GetFileNameWithoutExtension(filename);
                int address   = Constants.UserStartAddress;

                switch (basename.ToLower())
                {
                case "bootloader":
                    address = Constants.BootloaderStartAddress;
                    break;

                case "bootlader":
                    address = Constants.BootloaderStartAddress;
                    break;

                default:
                    address = Constants.UserStartAddress;
                    break;
                }

                switch (extension.ToLower())
                {
                case ".bit":
                    finalPageCollection = new BitFilePageCollection(
                        new FileStream(
                            filename,
                            FileMode.Open
                            ),
                        address
                        );
                    break;

                case ".bin":
                    finalPageCollection = new BinFilePageCollection(
                        new FileStream(
                            filename,
                            FileMode.Open
                            ),
                        address
                        );
                    break;
                }

                if (finalPageCollection != null)
                {
                    break;
                }
            }

            Uploader.Upload(finalPageCollection);
        }
Beispiel #2
0
        public static void Main()
        {
            PageCollection finalPageCollection = null;

            foreach (var filename in Directory.GetFiles(@"\SD"))
            {
                var extension = Path.GetExtension(filename);
                var basename = Path.GetFileNameWithoutExtension(filename);
                int address = Constants.UserStartAddress;

                switch (basename.ToLower())
                {
                    case "bootloader":
                        address = Constants.BootloaderStartAddress;
                        break;

                    case "bootlader":
                        address = Constants.BootloaderStartAddress;
                        break;

                    default:
                        address = Constants.UserStartAddress;
                        break;
                }

                switch (extension.ToLower())
                {
                    case ".bit":
                        finalPageCollection = new BitFilePageCollection(
                            new FileStream(
                                filename,
                                FileMode.Open
                                ),
                            address
                            );
                        break;

                    case ".bin":
                        finalPageCollection = new BinFilePageCollection(
                            new FileStream(
                                filename,
                                FileMode.Open
                                ),
                            address
                            );
                        break;
                }

                if (finalPageCollection != null)
                {
                    break;
                }
            }

            Uploader.Upload(finalPageCollection);
        }
Beispiel #3
0
        public static void Main()
        {
            PageCollection finalPageCollection = null;
            var            persistentStorage   = new PersistentStorage("SD");

            persistentStorage.MountFileSystem();

            foreach (var volumeInfo in VolumeInfo.GetVolumes())
            {
                foreach (var filename in Directory.GetFiles(volumeInfo.RootDirectory))
                {
                    var extension = Path.GetExtension(filename);
                    var basename  = Path.GetFileNameWithoutExtension(filename);
                    int address   = Constants.UserStartAddress;

                    switch (basename.ToLower())
                    {
                    case "bootloader":
                        address = Constants.BootloaderStartAddress;
                        break;

                    case "bootlader":
                        address = Constants.BootloaderStartAddress;
                        break;

                    default:
                        address = Constants.UserStartAddress;
                        break;
                    }

                    switch (extension.ToLower())
                    {
                    case ".bit":
                        finalPageCollection = new BitFilePageCollection(
                            new FixedBufferReadStream(
                                new FileStream(
                                    filename,
                                    FileMode.Open
                                    ),
                                256
                                ),
                            address
                            );
                        Debug.Print(((BitFilePageCollection)finalPageCollection).Header.FileName);
                        break;

                    case ".bin":
                        finalPageCollection = new BinFilePageCollection(
                            new FixedBufferReadStream(
                                new FileStream(
                                    filename,
                                    FileMode.Open
                                    ),
                                256
                                ),
                            address
                            );
                        break;
                    }

                    if (finalPageCollection != null)
                    {
                        break;
                    }
                }
                if (finalPageCollection != null)
                {
                    break;
                }
            }

            Uploader.Upload(finalPageCollection);
        }
Beispiel #4
0
        public static void Main()
        {
            PageCollection finalPageCollection = null;
            var persistentStorage = new PersistentStorage("SD");
            persistentStorage.MountFileSystem();

            foreach (var volumeInfo in VolumeInfo.GetVolumes())
            {
                foreach (var filename in Directory.GetFiles(volumeInfo.RootDirectory))
                {
                    var extension = Path.GetExtension(filename);
                    var basename = Path.GetFileNameWithoutExtension(filename);
                    int address = Constants.UserStartAddress;

                    switch (basename.ToLower())
                    {
                        case "bootloader":
                            address = Constants.BootloaderStartAddress;
                            break;

                        case "bootlader":
                            address = Constants.BootloaderStartAddress;
                            break;

                        default:
                            address = Constants.UserStartAddress;
                            break;
                    }

                    switch (extension.ToLower())
                    {
                        case ".bit":
                            finalPageCollection = new BitFilePageCollection(
                                new FixedBufferReadStream(
                                    new FileStream(
                                        filename,
                                        FileMode.Open
                                        ),
                                    256
                                    ),
                                address
                                );
                            Debug.Print(((BitFilePageCollection)finalPageCollection).Header.FileName);
                            break;

                        case ".bin":
                            finalPageCollection = new BinFilePageCollection(
                                new FixedBufferReadStream(
                                    new FileStream(
                                        filename,
                                        FileMode.Open
                                        ),
                                    256
                                    ),
                                address
                                );
                            break;
                    }

                    if (finalPageCollection != null)
                    {
                        break;
                    }
                }
                if (finalPageCollection != null)
                {
                    break;
                }
            }

            Uploader.Upload(finalPageCollection);
        }