예제 #1
0
 private LSTArgs ReadLstArgs()
 {
     _curLstArgs = null;
     if (File.Exists(ArgsFileProvider.OrbitFilePath))
     {
         string[] contexts = File.ReadAllLines(ArgsFileProvider.OrbitFilePath, Encoding.Default);
         if (contexts == null || contexts.Length == 0)
         {
             return(_curLstArgs);
         }
         _curLstArgs           = new LSTArgs();
         _curLstArgs.OrbitPath = new Dictionary <string, string>();
         string[] split = null;
         foreach (string item in contexts)
         {
             split = item.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
             if (split == null || split.Length < 2)
             {
                 continue;
             }
             _curLstArgs.OrbitPath.Add(split[0], split[1]);
         }
         if (!string.IsNullOrEmpty(_algorithmName) && _curLstArgs != null && _curLstArgs.OrbitPath != null && _curLstArgs.OrbitPath.Count != 0 && _curLstArgs.OrbitPath.ContainsKey(_algorithmName))
         {
             ucObritDateDir.SetTextBoxInfo(_curLstArgs.OrbitPath[_algorithmName]);
         }
         return(_curLstArgs);
     }
     return(null);
 }
예제 #2
0
        private void WriteLstArgs(string dir)
        {
            if (string.IsNullOrEmpty(dir))
            {
                return;
            }
            if (_curLstArgs == null)
            {
                _curLstArgs = new LSTArgs();
            }
            if (_curLstArgs.OrbitPath == null)
            {
                _curLstArgs.OrbitPath = new Dictionary <string, string>();
            }
            if (_curLstArgs.OrbitPath.ContainsKey(_algorithmName))
            {
                _curLstArgs.OrbitPath[_algorithmName] = dir;
            }
            else
            {
                _curLstArgs.OrbitPath.Add(_algorithmName, dir);
            }
            string argFileDir = Path.GetDirectoryName(ArgsFileProvider.OrbitFilePath);

            if (!Directory.Exists(argFileDir))
            {
                Directory.CreateDirectory(argFileDir);
            }
            File.WriteAllLines(ArgsFileProvider.OrbitFilePath, GetStringArrayByDic(_curLstArgs), Encoding.Default);
        }
예제 #3
0
        private string[] GetStringArrayByDic(LSTArgs _curLstArgs)
        {
            List <string> argsStr = new List <string>();

            foreach (string key in _curLstArgs.OrbitPath.Keys)
            {
                argsStr.Add(key + "=" + _curLstArgs.OrbitPath[key]);
            }
            return(argsStr.Count == 0 ? null : argsStr.ToArray());
        }