Exemplo n.º 1
0
        public KomHeader ReadFromStream(BinaryReader reader)
        {
            KomHeader header = new KomHeader();

            header.FileVersion        = new String(reader.ReadChars(52));
            header.FileCount          = reader.ReadInt32();
            header.Key                = reader.ReadInt32();
            header.FileTime           = reader.ReadInt32();
            header.FileStructChecksum = reader.ReadInt32();
            header.FileStructLength   = reader.ReadInt32();
            return(header);
        }
Exemplo n.º 2
0
        public void TestPlugin(String path)
        {
            Console.WriteLine($"{nameof(TestPlugin)} Begin:");
            try
            {
                if (puppets == null)
                {
                    Console.WriteLine("Can not load Plugins");

                    return;
                }

                Int32 i = (puppets.Count());
                Console.WriteLine($"Plugin Count: {i}");
                if (i == 0)
                {
                    return;
                }


                KomHeader header = new KomHeader();

                using (BinaryReader reader = new BinaryReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
                {
                    String fileVersion = new String(reader.ReadChars(52)).TrimEnd('\0');
                    header.FileVersion = fileVersion;

                    Console.WriteLine(header.FileVersion);
                    var query = from a in puppets
                                where fileVersion.StartsWith(a.Metadata.FileVersion)
                                orderby a.Metadata.FileVersion descending
                                orderby a.Metadata.Major, a.Metadata.Minor, a.Metadata.Build, a.Metadata.Revision
                    select a.Value;
                    IKomPlugin puppet = query.FirstOrDefault();
                    if (puppet == null)
                    {
                        Console.WriteLine($"Without Plugin to analyse this file:{path}");

                        return;
                    }
                    puppet.ReadKomHeaderDataAfterVersion(header, reader);
                }
            }
            finally
            {
                Console.WriteLine($"{nameof(TestPlugin)} End.\r\n");
            }
        }
Exemplo n.º 3
0
        public KomHeader ReadFromDirectory(String path)
        {
            DirectoryInfo di = new DirectoryInfo(path);

            String[] files = Directory.GetFiles(path);
            //FileVersion = new String(reader.ReadChars(52));
            KomHeader header = new KomHeader();

            foreach (FileInfo item in di.GetFiles())
            {
                header.Items.Add(new KomChildEntity()
                {
                    FullName = item.FullName, Name = item.Name, Size = item.Length
                });
            }


            return(header);
        }
Exemplo n.º 4
0
 public void Unpack(KomHeader header, String saveDir)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Pack and Write the Data into <paramref name="outStream"/>
 /// </summary>
 /// <param name="header"></param>
 /// <param name="baseDir"></param>
 /// <param name="outStream"></param>
 public void Pack(KomHeader header, String baseDir, Stream outStream)
 {
 }