ext=newElement;
}
{(iterator=head. Next; iterator!=null; iterator=iterator. Next)
{(iterator. Info == beforeUser)
{= true ;;
}=iterator;
} (find)
{. Next=newElement ;. Next=iterator;
} false;
} true;
}
# endregion
# region Видалення пользователяbool deleteUser (user User)
{iterator, tmp; find;=false;=null; (head. Next!=null)
{(head. Next. Info == User)
{. Next=head. Next. Next;
}
{(iterator=head. Next; iterator!=null; iterator=iterator. Next)
{(iterator. Info == User)
{= true ;;
}=iterator;
} (find)
{(iterator. Next!=null). Next=iterator. Next ;. Next=null;
} false;
} true;
} false;
}
# endregion
# region Збереження в файл 1.
public void saveToFile ()
{tmp;
{
//FileStream outPutFile=new FileStream ( D: users. txt raquo ;, FileMode. OpenOrCreate, FileAccess. Write);
//StreamWriter sw=new StreamWriter (outPutFile) ;. Delete ( D: users. Txt ); (StreamWriter sw=File. AppendText ( D: users. Txt ))
{= this. head. Next; (tmp!=Null)
{
{. WriteLine (tmp. Info. Show (), Encoding. GetEncoding (тисяча двісті п'ятьдесят-одна));=tmp. Next;
} (IOException err)
{. Show (err. Message);
}
}
}
//sw. Close ();
} (IOException err)
{. Show (err. Message);
}
}
# endregion
# region Збереження в файл 2.
public void saveToFile (string fName)
{tmp;
{(File. Exists (fName)). Delete (fName); (StreamWriter sw=File. AppendText (fName))
{= this. head. Next; (tmp!=Null)
{
{. WriteLine (Encrypt (tmp. Info. Show (), Passpord11 raquo ;, Password22 raquo ;, SHA1 raquo ;, 2, 16CHARSLONG12345 raquo ;, 256), Encoding. GetEncoding (одна тисяча двісті п'ятьдесят одна));=tmp. Next;
} (IOException err)
{. Show (err. Message);
}
}
}
} (IOException err)
{. Show (err. Message);
}
}
# endregion
# region Читання з файлу 1.void readFromFile ()
{
{inputFile=File. OpenText ( D: users. Txt ); read=null, userParams, Name, Password, Rights; userN=null, userBefore=null; ((read=inputFile. ReadLine ())!=Null)
{[] split=read. Split (new Char [] { raquo ;, , raquo ;, laquo ;. raquo ;, laquo ;: raquo ;, laquo ;; });=split [0]. Trim ();=split [1]. Trim ();=split [2]. Trim (); (userParams)
{ Гість :=new guest (Name, Rights) ;; Користувач :=split [3]. Trim ();=new defUser (Name, Rights, Password) ;; Адміністратор :=split [3]. Trim ();=new admin (Name, Rights, Password) ;;
}. addUserAfter (userN, userBefore);=userN;
}. Close ();
} (IOException err)
{. Show (err. Message);
}
}
# endregion
# region Читання з файлу 2.void readFromFile (string fName)
{
{inputFile=File. OpenText (fName); read=null, userParams, Name, Password, Rights; userN=null, userBefore=null; ((read=inputFile. ReadLine ())!=Null)
{= Decrypt (read, Passpord11 raquo ;, Password22 raquo ;, SHA1 raquo ;, 2, 16CHARSLONG12345 raquo ;, 256); [] split=read. Split (new Char [] { raquo ;, , raquo ;, laquo ;. raquo ;, laquo ;: raquo ;, laquo ;; });=split [0]. Trim ();=split [1]. Trim ();=split [2]. Trim (); (userParams)