Esempio n. 1
0
        public static HashDevice GetDeviceFromSerializedData(SerializedHashDevice serializedDevice)
        {
            var device = new HashDevice();

            device.DeviceName = serializedDevice.DeviceName;
            device.Condition  = serializedDevice.Condition;
            device.IpAddress  = serializedDevice.IpAddress;

            device.AllPrograms = ProgramUtil.GetAllProgramsFromSerializedData(serializedDevice.Programs);
            device.AllUsers    = SList.Create <HashUser>(serializedDevice.Users.Length);

            for (int i = 0; i < serializedDevice.Users.Length; i++)
            {
                var user = GetUserFromSerializedData(serializedDevice.Users[i]);
                SList.Add(device.AllUsers, user);
            }

            var defaultUser = new HashUser();

            defaultUser.Username = DEFAULT_USER_NAME;
            defaultUser.Password = DEFAULT_PASSWORD;

            SList.Add(device.AllUsers, defaultUser);

            device.FileSystem = FileSystem.GetFileSystemFromSerializedData(serializedDevice.FileSystem);

            return(device);
        }