예제 #1
0
        public static SaveAccountData ParseFromString(string input)
        {
            string[] strArray = input.Split(SaveAccountData.Delimiter, StringSplitOptions.None);
            string   str      = "";

            if (!string.IsNullOrEmpty(strArray[1]))
            {
                try
                {
                    str = FileEncrypter.DecryptString(strArray[1], "")[2];
                }
                catch (FormatException ex)
                {
                    Console.WriteLine("ACCOUNT AUTHENTICATION DETAILS CORRUPT : " + strArray[0]);
                    str = "";
                }
                catch (NullReferenceException ex)
                {
                    Console.WriteLine("ACCOUNT AUTHENTICATION DETAILS REMOVED OR DELETED : " + strArray[0]);
                    str = "";
                }
            }
            if (strArray.Length <= 3)
            {
                return new SaveAccountData()
                       {
                           Username = strArray[0], Password = str, FileUsername = strArray[2]
                       }
            }
            ;
            return(new SaveAccountData()
            {
                Username = strArray[0], Password = str, LastWriteTime = Utils.SafeParseDateTime(strArray[2]), FileUsername = strArray[3]
            });
        }
예제 #2
0
        public FileUploadMission(string path, string filename, string computerWithFileIP, string computerToUploadToIP,
                                 string destToUploadToPath, OS _os, bool needsDecrypt = false, string decryptPass = "")
        {
            target = filename;
            os     = _os;
            var computer1 = Programs.getComputer(os, computerWithFileIP);

            targetComp = computer1;
            container  = computer1.getFolderFromPath(path, false);
            for (var index = 0; index < container.files.Count; ++index)
            {
                if (container.files[index].name.Equals(target))
                {
                    targetData = container.files[index].data;
                    if (needsDecrypt)
                    {
                        targetData = FileEncrypter.DecryptString(targetData, decryptPass)[2];
                    }
                }
            }
            var computer2 = Programs.getComputer(os, computerToUploadToIP);

            uploadTargetComp  = computer2;
            destinationFolder = computer2.getFolderFromPath(destToUploadToPath, false);
        }
예제 #3
0
        public FileUploadMission(string path, string filename, string computerWithFileIP, string computerToUploadToIP, string destToUploadToPath, OS _os, bool needsDecrypt = false, string decryptPass = "")
        {
            this.target = filename;
            this.os     = _os;
            Computer computer1 = Programs.getComputer(this.os, computerWithFileIP);

            if (computer1 == null)
            {
                throw new FormatException("Error parsing File Upload Mission - Source comp " + computerWithFileIP + " not found!");
            }
            this.targetComp = computer1;
            this.container  = computer1.getFolderFromPath(path, false);
            for (int index = 0; index < this.container.files.Count; ++index)
            {
                if (this.container.files[index].name.Equals(this.target))
                {
                    this.targetData = this.container.files[index].data;
                    if (needsDecrypt)
                    {
                        this.targetData = FileEncrypter.DecryptString(this.targetData, decryptPass)[2];
                    }
                }
            }
            Computer computer2 = Programs.getComputer(this.os, computerToUploadToIP);

            if (computer2 == null)
            {
                throw new FormatException("Error parsing File Upload Mission - Dest comp " + computerWithFileIP + " not found!");
            }
            this.uploadTargetComp  = computer2;
            this.destinationFolder = computer2.getFolderFromPath(destToUploadToPath, false);
        }
예제 #4
0
        public static SaveAccountData ParseFromString(string input)
        {
            var strArray = input.Split(Delimiter, StringSplitOptions.RemoveEmptyEntries);

            if (strArray.Length <= 3)
            {
                return new SaveAccountData
                       {
                           Username     = strArray[0],
                           Password     = FileEncrypter.DecryptString(strArray[1], "")[2],
                           FileUsername = strArray[2]
                       }
            }
            ;
            return(new SaveAccountData
            {
                Username = strArray[0],
                Password = FileEncrypter.DecryptString(strArray[1], "")[2],
                LastWriteTime = DateTime.Parse(strArray[2], CultureInfo.InvariantCulture),
                FileUsername = strArray[3]
            });
        }