Procházet zdrojové kódy

,,|,, fuck you sena for more hackfixxes needed. and a really dumb bug that fucked up statefile
also a dirty unfucker

Tom Görner před 2 roky
rodič
revize
19476f600a

+ 59 - 21
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/FirmwareAutoDumper.java

@@ -51,6 +51,8 @@ public class FirmwareAutoDumper
                 dummydownloadfake = new PrintStream(new FileOutputStream(new File(outfolder, "dummy.log")));
             }
 
+
+
             Representer representer = new Representer();
             representer.addClassTag(Firmware.class, new Tag("!FW"));
             representer.addClassTag(FirmwareVersion.class, new Tag("!FWV"));
@@ -74,6 +76,23 @@ public class FirmwareAutoDumper
                 state.setFirmwares(new LinkedHashMap<>());
             }
 
+            state.getFirmwares().forEach((k,v)->
+            {
+                v.getVersions().entrySet().removeIf((e)->{
+                    if(
+                            (!e.getValue().isFiller())
+                            && e.getValue().getServerCreationDate().equals(new Date(0)) // suspicious crap versions from a bugged run. nuking them
+                            )
+                    {
+                        l.info("Removed a suspicious version: "+e.getKey());
+                        return true;
+                    };
+
+                    return false;
+                });
+            });
+
+
             File outfolder_tmp = new File(outfolder, "tmp");
 
 
@@ -332,30 +351,41 @@ public class FirmwareAutoDumper
         String suffix = "";
         int major=0,minor=0,patch=0;
         major=Integer.valueOf(vsplit[0]);
-        if(vsplit.length==4)
+        if(vsplit.length==5&&rchackfix)  // another hackfix since sena tries to trololol me..., ,,|,,
         {
             minor = Integer.valueOf(vsplit[1]);
-            patch = Integer.valueOf(vsplit[2].substring(0,1));
-            if(vsplit[2].length()>1)
-            {
-                suffix = vsplit[2].substring(1)+"."+vsplit[3];
-            }
-            else
-            {
-                suffix = "."+vsplit[3];
-            }
+            patch = Integer.valueOf(vsplit[2]);
+            suffix = suffix = hackfixsuffix+vsplit[3]+"."+vsplit[4];
+            rchackfix=false;
         }
         else
         {
-            if(vsplit[1].length()>1)
+            if(vsplit.length==4)
             {
-                minor = Integer.valueOf(vsplit[1].substring(0,1));
-                suffix = vsplit[1].substring(1)+"."+vsplit[2];
+
+                minor = Integer.valueOf(vsplit[1]);
+                patch = Integer.valueOf(vsplit[2].substring(0,1));
+                if(vsplit[2].length()>1)
+                {
+                    suffix = vsplit[2].substring(1)+"."+vsplit[3];
+                }
+                else
+                {
+                    suffix = "."+vsplit[3];
+                }
             }
             else
             {
-                minor = Integer.valueOf(vsplit[1].substring(0,1));
-                suffix = "."+vsplit[2];
+                if(vsplit[1].length()>1)
+                {
+                    minor = Integer.valueOf(vsplit[1].substring(0,1));
+                    suffix = vsplit[1].substring(1)+"."+vsplit[2];
+                }
+                else
+                {
+                    minor = Integer.valueOf(vsplit[1].substring(0,1));
+                    suffix = "."+vsplit[2];
+                }
             }
         }
 
@@ -466,7 +496,7 @@ public class FirmwareAutoDumper
         {
             l.info("Fakerfuck");
             FirmwareVersion f2 =  supprCache.get(fwname);
-            f.setFiller(false);
+            f.setFiller(f2.isFiller());
             f.setServerCreationDate(f2.getServerCreationDate());
             return f;
         }
@@ -498,12 +528,20 @@ public class FirmwareAutoDumper
         File dst = new File(outfolder_base,fwname);
         if(dlf.exists())
         {
-            f.setAlternativeLocation(!originalLocationSuccessful);
-            f.setFiller(false);
-            f.setServerCreationDate(new Date(dlf.lastModified()));
-            if(!dst.exists())
+            if(dlf.lastModified() <100000) // suspicious undefined date
             {
-                Files.copy(dlf.toPath(),dst.toPath());
+                f.setFiller(true);
+                f.setServerCreationDate(new Date(0));
+            }
+            else
+            {
+                f.setAlternativeLocation(!originalLocationSuccessful);
+                f.setFiller(false);
+                f.setServerCreationDate(new Date(dlf.lastModified()));
+                if(!dst.exists())
+                {
+                    Files.copy(dlf.toPath(),dst.toPath());
+                }
             }
         }
         else