Exemplo n.º 1
0
        private void InternalLoadPackageBody()
        {
            string xmlFilePath = _content.GetBody();

            _context.Log.AddLogInformation("XML-конфигурация ожидается в '" + xmlFilePath + "'");
            _body = GinSerializer.Deserialize <PackageBody>(xmlFilePath);
            _context.Log.AddLogInformation("XML-конфигурация загружена");
        }
Exemplo n.º 2
0
 private void LoadTransactions()
 {
     _context.Log.AddLogInformation("Загружаем транзакции");
     _transactions = new List <Transaction>();
     if (String.IsNullOrEmpty(TransactionsPath) || !Directory.Exists(TransactionsPath))
     {
         _context.Log.AddLogInformation("Транзакции отсутствуют");
         return;
     }
     string[] transactionNames = Directory.GetDirectories(TransactionsPath);
     _context.Log.AddLogInformation("Найдено " + transactionNames.Length + " транзакций");
     foreach (string name in transactionNames)
     {
         string      transactionPath = Path.Combine(TransactionsPath, name);
         string      dataFilePath    = Path.Combine(transactionPath, TRANSACTIONS_DATA_FILENAME);
         Transaction transaction     = GinSerializer.Deserialize <Transaction>(dataFilePath);
         _transactions.Add(transaction);
     }
     _context.Log.AddLogInformation("Все транзакции загружены");
 }
Exemplo n.º 3
0
 private void LoadPackageData()
 {
     if (File.Exists(SoftwareDataFile))
     {
         _softwareData = GinSerializer.Deserialize <SoftwareData>(SoftwareDataFile);
         foreach (var item in _softwareData.InstallationParameters)
         {
             _context.SaveResult(item.Name, item.Value, true);
         }
         _context.Log.AddLogInformation("Загружен SoftwareData");
     }
     if (String.IsNullOrEmpty(PackageDataFile) || !File.Exists(PackageDataFile))
     {
         return;
     }
     _context.Log.AddLogInformation("PackageData ожидается в '" + PackageDataFile + "'");
     _packageData     = GinSerializer.Deserialize <PackageData>(PackageDataFile);
     _alreadyExecuted = true;
     _context.Log.AddLogInformation("Загружен PackageData");
 }
Exemplo n.º 4
0
        public bool Save(string path, bool isFileName)
        {
            CheckPackageVisitor visitor = new CheckPackageVisitor(_body);

            _body.Command.Visit(visitor);
            visitor.CollectInfo();
            if (!visitor.IsCorrect)
            {
                Errors = visitor.Errors;
                return(false);
            }
            ProcessIncludedFiles(_body.Command);
            string xmlFilePath = Path.GetTempFileName();

            GinSerializer.Serialize(_body, xmlFilePath);
            _content.AddBody(xmlFilePath);
            string packageFilePath = isFileName ? path : Path.Combine(path, PACKAGE_DEFAULT_FILENAME);

            _content.Save(packageFilePath, _body.IncludedPath);
            OnSavedHandler();
            return(true);
        }
Exemplo n.º 5
0
        private void SaveCurrentPackageData()
        {
            string userName = "******";

            if (WindowsIdentity.GetCurrent() != null)
            {
                userName = WindowsIdentity.GetCurrent().Name;
            }
            var         instParameters = _context.GetInstallationParameters();
            PackageData data           = new PackageData()
            {
                InstallationDate       = DateTime.Now,
                InstallationUserName   = userName,
                InstallationParameters = instParameters
            };

            GinSerializer.Serialize(data, PackageDataFile);
            SoftwareData dataSoftware = new SoftwareData()
            {
                InstallationParameters = instParameters
            };

            GinSerializer.Serialize(dataSoftware, SoftwareDataFile);
        }