예제 #1
0
        /// <summary>
        /// I wrote this when the program crashed after an hour.
        /// Intermediate results can now be saved to avoid losing data.
        /// </summary>
        private static ResultClusterer TryLoadIntermediateResult(Core core, Guid guid, int value, int repetition, ProgressReporter proggy)
        {
            string fileName = UiControls.GetTemporaryFile("." + value + "." + repetition + ".intermediate.dat", guid);

            if (!File.Exists(fileName))
            {
                return(null);
            }

            LookupByGuidSerialiser guidS = core.GetLookups();

            proggy.Enter("Loading saved results");
            ResultClusterer result;

            try
            {
                result = XmlSettings.LoadOrDefault <ResultClusterer>(new FileDescriptor(fileName, SerialisationFormat.MSerialiserFastBinary), null, guidS, proggy);
            }
            catch
            {
                proggy.Leave(); // Result will probably be NULL rather than throwing an exception
                return(null);
            }

            UiControls.Assert(!guidS.HasLookupTableChanged, "Didn't expect the GUID lookup table to change when loading data.");
            proggy.Leave();

            return(result);
        }
예제 #2
0
파일: Core.cs 프로젝트: mjr129/metaboclust
        /// <summary>
        /// Loads all data
        /// </summary>
        public static Core Load(string fileName, ProgressReporter progress)
        {
            Core result = XmlSettings.LoadOrDefault <Core>(fileName, null, null, progress);

            if (result != null)
            {
                result.FileNames.Session = fileName;
                result._cache            = new CachedData(result);
                result.Options.Core      = result;
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// Loads results from file.
        /// </summary>
        public static ClusterEvaluationResults LoadResults(Core core, string fileName, ProgressReporter z)
        {
            LookupByGuidSerialiser   guidS = core.GetLookups();
            ClusterEvaluationResults set;

            set = XmlSettings.LoadOrDefault <ClusterEvaluationResults>(fileName, null, guidS, z);

            if (set != null)
            {
                if (set.CoreGuid != core.CoreGuid)
                {
                    throw new InvalidOperationException("Wrong Session - The result set selected was not created using the current session. In order to view these results you must load the relevant session.\r\n\r\nCurrent session: " + core.CoreGuid + "\r\nResults session: " + set.CoreGuid);
                }
            }

            return(set);
        }