Пример #1
0
        public static DeployParam LoadDeployParam(string fileName)
        {
            byte[]      rdd = DataUtils.ReadBinary(fileName);
            DeployParam rrs = DataUtils.BytesToObject <DeployParam>(rdd, 0, rdd.Length);

            return(rrs);
        }
Пример #2
0
 public static bool SaveDeployParam(string Type, LocationModeEnum Location_Mode, TimesMode Times_Mode, int MinZ, int MaxZ)
 {
     try
     {
         DeployParam deployParam = new DeployParam(Type, Location_Mode, Times_Mode, MinZ, MaxZ);
         byte[]      data        = DataUtils.ObjectToBytes(deployParam);
         string      filePath    = MatchIniFile(AppDomain.CurrentDomain.BaseDirectory, Type);
         DataUtils.SafeSaveBinary(filePath, data);
         return(true);
     }
     catch (Exception err)
     {
         Trace.TraceError(err.ToString());
         return(false);
     }
 }
Пример #3
0
        public Dictionary <string, DeployParam> LoadDeployParamDictionary()
        {
            Dictionary <string, DeployParam> dictionary = new Dictionary <string, DeployParam>();

            DirectoryInfo rootDir = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "library-model-match"));

            DirectoryInfo[] subdirs = rootDir.GetDirectories();
            foreach (DirectoryInfo dir in subdirs)
            {
                string filename = Path.Combine(dir.FullName, dir.Name + ".ini");
                if (File.Exists(filename))
                {
                    DeployParam deployParam = DataUtils.LoadDeployParam(filename);
                    dictionary.Add(dir.Name, deployParam);
                }
            }

            return(dictionary);
        }