示例#1
0
        public bool Export(string workingDir)
        {
            bool ret = true;
            try
            {
                workingPackPath = workingDir;
                PackInfo = BuildPackInfo();
                PackInfo.TerminalCode = Terminal.Instance.Code;
                PackInfo.WorkingDirectory = Path.Combine(workingPackPath, Guid.NewGuid().ToString());
                if (!Directory.Exists(PackInfo.WorkingDirectory))
                    Directory.CreateDirectory(PackInfo.WorkingDirectory);

                InternalExport();
            }
            catch (Exception ex)
            {
                ret = false;
                var e = new ErrorEventArgs(ex);
                OnError(e);
            }
            finally
            {
                Clean();
            }

            return ret;
        }
示例#2
0
        private void DeserializePackInfo(string dir)
        {
            string[] files = Directory.GetFiles(dir, _infoFileName + "*.*");
            if (files.Length > 0)
            {
                Type infoType = Type.GetType(Path.GetFileName(files[0]).Remove(0, _infoFileName.Length));
                var reader = new XmlSerializer(infoType);
                using (XmlReader xmlreader = XmlReader.Create(files[0]))
                {
                    PackInfo = (PackInfoBase)reader.Deserialize(xmlreader);
                    xmlreader.Close();
                }

            }
            else
            {
                if (PackInfo == null)
                    PackInfo = new PackInfoBase { TerminalCode = -1, ModuleCode = GetModule(workingPackPath), Stamp = DateTime.Now };

            }

            PackInfo.WorkingDirectory = dir;
        }