Пример #1
0
        private string SetComboBoxState(string[] configNames, IPropertyStorage storage, ComboBox box, string propertyName, string defaultValue)
        {
            string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;

            box.SelectedItem = result;
            return(result);
        }
Пример #2
0
        public void SaveProperties(string[] configNames, IPropertyStorage storage)
        {
            Contract.Assume(storage != null);

            foreach (var prop in properties)
            {
                Contract.Assume(prop != null);
                prop.Save(configNames, storage);
            }

            if (AssemblyModeDropDown.SelectedItem != null)
            {
                storage.SetProperty(false, "", AssemblyModeName, AssemblyModeDropDown.SelectedIndex.ToString());
            }
            if (RuntimeCheckingLevelDropDown.SelectedItem != null)
            {
                storage.SetProperties(false, configNames, RuntimeCheckingLevelName, RuntimeCheckingLevelDropDown.SelectedItem.ToString());
            }
            if (ContractReferenceAssemblySelection.SelectedItem != null)
            {
                storage.SetProperties(false, configNames, ContractReferenceAssemblyName, ContractReferenceAssemblySelection.SelectedItem.ToString());
            }

            storage.SetProperties(false, configNames, WarningLevelName, WarningLevelTrackBar.Value.ToString());
        }
Пример #3
0
            void IPropertySetStorage.Create(
                ref Guid rfmtid,
                ref Guid pclsid,
                UInt32 grfFlags,
                UInt32 grfMode,
                out IPropertyStorage ppprstg
                )
            {
                UnsafeNativeCompoundFileMethods.UnsafeNativeIPropertyStorage propertyStorage;

                _unsafePropertySetStorage.Create(
                    ref rfmtid,
                    ref pclsid,
                    grfFlags,
                    grfMode,
                    out propertyStorage
                    );

                if (propertyStorage != null)
                {
                    ppprstg = new SafeIPropertyStorageImplementation(propertyStorage);
                }
                else
                {
                    ppprstg = null;
                }
            }
Пример #4
0
            int IPropertySetStorage.Open(
                ref Guid rfmtid,
                UInt32 grfMode,
                out IPropertyStorage ppprstg
                )
            {
                UnsafeNativeCompoundFileMethods.UnsafeNativeIPropertyStorage propertyStorage;

                int hr = _unsafePropertySetStorage.Open(
                    ref rfmtid,
                    grfMode,
                    out propertyStorage
                    );

                if (propertyStorage != null)
                {
                    ppprstg = new SafeIPropertyStorageImplementation(propertyStorage);
                }
                else
                {
                    ppprstg = null;
                }

                return(hr);
            }
Пример #5
0
        private static string GetPropertyName(Guid fmtid, IPropertyStorage propertyStorage, STATPROPSTG stg)
        {
            if (!string.IsNullOrEmpty(stg.lpwstrName))
            {
                return(stg.lpwstrName);
            }

            var propids = new uint[1];

            propids[0] = stg.propid;
            var names = new string[1];

            names[0] = null;
            var hr = propertyStorage.ReadPropertyNames(1, propids, names);

            if (hr == 0)
            {
                return(names[0]);
            }

            foreach (var kp in CompoundProperty.KnownProperties)
            {
                if (kp.FormatId == fmtid && kp.Id == stg.propid)
                {
                    return(kp.Name);
                }
            }
            return(null);
        }
Пример #6
0
 /// <summary>
 /// Save the textbox state to its associated msbuild property
 /// </summary>
 /// <param name="configNames">The set of configurations</param>
 /// <param name="storage">The property storage</param>
 public override void Save(string[] configNames, IPropertyStorage storage)
 {
     if (box.Text != null && box.Modified)
     { // only save on modification
         storage.SetProperties(perUser, configNames, propertyName, box.Text);
     }
 }
Пример #7
0
        internal static STATPROPSETSTG GetStatistics(this IPropertyStorage propertyStorage)
        {
            STATPROPSETSTG statpropsetstg = default(STATPROPSETSTG);

            propertyStorage.Stat(out statpropsetstg);
            return(statpropsetstg);
        }
Пример #8
0
        internal static int GetPropertyName(this IPropertySetStorage propertySetStorage, Guid fmtid, uint propid, out string name)
        {
            HRESULT hr = (int)HRESULT.E_FAIL;

            name = String.Empty;

            IPropertyStorage propertyStorage = null;
            uint             grfMode         = (uint)(STGM.READ | STGM.SHARE_EXCLUSIVE);

            try
            {
                if (NativeMethods.Succeeded(hr = propertySetStorage.Open(ref fmtid, grfMode, out propertyStorage)))
                {
                    hr = propertyStorage.GetPropertyName(propid, out name);
                }
            }
            catch
            {
            }
            finally
            {
                if (propertyStorage != null)
                {
                    propertyStorage.FinalRelease();
                }
            }

            return(hr);
        }
Пример #9
0
        internal static int GetPropertyName(this IPropertyStorage propertyStorage, uint propid, out string name)
        {
            HRESULT hr = HRESULT.E_FAIL;

            name = String.Empty;

            uint[]   rgpropid     = { propid };
            string[] rglpwstrName = { String.Empty };

            if (NativeMethods.Succeeded(hr = propertyStorage.ReadPropertyNames(1, rgpropid, rglpwstrName)))
            {
                name = rglpwstrName[0];
            }

            if (String.IsNullOrWhiteSpace(name))
            {
                Guid fmtid = propertyStorage.GetFormatId();

                if (fmtid.Equals(FormatId.SummaryInformation))
                {
                    name = propertyStorage.GetPropertyName((PIDSI)propid);
                    hr   = HRESULT.S_OK;
                }
                else if (fmtid.Equals(FormatId.DocSummaryInformation))
                {
                    name = propertyStorage.GetPropertyName((PIDDSI)propid);
                    hr   = HRESULT.S_OK;
                }
            }

            return(hr);
        }
Пример #10
0
 /// <summary>
 /// Save the negated checkbox state to its associated msbuild property
 /// </summary>
 /// <param name="configNames">The set of configurations</param>
 /// <param name="storage">The property storage</param>
 public override void Save(string[] configNames, IPropertyStorage storage)
 {
     if (box.CheckState != CheckState.Indeterminate)
     {
         storage.SetProperties(perUser, configNames, propertyName, !box.Checked);
     }
 }
Пример #11
0
        internal static int GetPropertyValue(this IPropertySetStorage propertySetStorage, Guid fmtid, uint propid, out PROPVARIANT propvar)
        {
            HRESULT hr = (int)HRESULT.E_FAIL;

            propvar = default(PROPVARIANT);

            PROPSPEC[]       propspec        = new PROPSPEC[1];
            PROPVARIANT[]    propvars        = { propvar };
            IPropertyStorage propertyStorage = null;
            uint             grfMode         = (uint)(STGM.READ | STGM.SHARE_EXCLUSIVE);

            try
            {
                if (NativeMethods.Succeeded(hr = propertySetStorage.Open(ref fmtid, grfMode, out propertyStorage)))
                {
                    hr = propertyStorage.GetProperty(propid, out propvar);
                }
            }
            catch
            {
            }
            finally
            {
                if (propertyStorage != null)
                {
                    propertyStorage.FinalRelease();
                }
            }

            return(hr);
        }
Пример #12
0
 public ViewModelBase(IPropertyStorage storage)
 {
     // DO NOT USE the property at this stage
     // We want to avoid triggering the OnStorageChange/InvalidaProperties handlers
     // when the instance is being created
     this.storage = storage;
 }
Пример #13
0
        public static void SetProperty(string filename, string msg, SummaryPropId summaryType)
        {
            IPropertySetStorage propSetStorage      = null;
            Guid             IID_PropertySetStorage = new Guid("0000013A-0000-0000-C000-000000000046");
            uint             hresult = ole32.StgOpenStorageEx(filename, (int)(STGM.SHARE_EXCLUSIVE | STGM.READWRITE), (int)STGFMT.FILE, 0, (IntPtr)0, (IntPtr)0, ref IID_PropertySetStorage, ref propSetStorage);
            Guid             fmtid_SummaryProperties = new Guid("F29F85E0-4FF9-1068-AB91-08002B27B3D9");
            IPropertyStorage propStorage             = null;

            hresult = propSetStorage.Create(ref fmtid_SummaryProperties, (IntPtr)0, (int)PROPSETFLAG.DEFAULT, (int)(STGM.CREATE | STGM.READWRITE | STGM.SHARE_EXCLUSIVE), ref propStorage);

            PropSpec propertySpecification = new PropSpec();

            propertySpecification.ulKind     = 1;
            propertySpecification.Name_Or_ID = new IntPtr((int)summaryType);

            PropVariant propertyValue = new PropVariant();

            propertyValue.FromObject(msg);

            propStorage.WriteMultiple(1, ref propertySpecification, ref propertyValue, 2);
            hresult = propStorage.Commit((int)STGC.DEFAULT);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(propSetStorage);
            propSetStorage = null;
            GC.Collect();
        }
Пример #14
0
 public void SaveProperties(string[] configNames, IPropertyStorage storage)
 {
     foreach (var prop in this.properties)
     {
         prop.Save(configNames, storage);
     }
 }
Пример #15
0
 public void LoadProperties(string[] configNames, IPropertyStorage storage)
 {
     foreach (var prop in this.properties)
     {
         prop.Load(configNames, storage);
     }
     EnableDisableUI();
 }
Пример #16
0
 public void Close()
 {
     if (this.m_IPropStgObj != null)
     {
         Marshal.ReleaseComObject(this.m_IPropStgObj);
         this.m_IPropStgObj = null;
         GC.SuppressFinalize(this);
     }
 }
Пример #17
0
 public ChampAgent(IPropertyStorage propertyStorage) : base(propertyStorage)
 {
     MovementSpeed = 65;
     Strength      = 100;
     Health        = 40;
     Eyesight      = 30;
     Endurance     = 15;
     Dodge         = 0;
 }
Пример #18
0
        //state attributes - these may only be modified by framework
        //public AIVector Position { get; set; }
        //public float Hunger { get; set; }
        //public float Hitpoints { get; set; }
        //public bool Defending { get; set; }
        //public float ProcreationCountdown { get; set; }


        //public int MovementSpeed { get; set; }
        //public int Strength { get; set; }
        //public int Health { get; set; }
        //public int Eyesight { get; set; }
        //public int Endurance { get; set; }
        //public int Dodge { get; set; }


        public FishAgent(IPropertyStorage propertyStorage)
            : base(propertyStorage)
        {
            MovementSpeed = 110;
            Strength      = 0;
            Health        = 50;
            Eyesight      = 70;
            Endurance     = 20;
            Dodge         = 0;
        }
Пример #19
0
 public GoalBasedAgent(IPropertyStorage propertyStorage)
     : base(propertyStorage)
 {
     MovementSpeed = 50;
     Strength      = 35;
     Health        = 40;
     Eyesight      = 35;
     Endurance     = 35;
     Dodge         = 55;
     currentGoal   = new ThinkGoal(this);
 }
Пример #20
0
 // Save the UI settings to the property storage
 public void SaveProperties(string[] configNames, IPropertyStorage storage)
 {
     storage.SetProperties(true, configNames, "UseContracts", this.useContractsCheck.Checked);
     storage.SetProperties(true, configNames, "ProduceContractAssembly", this.produceContractAssemblyCheck.Checked);
     storage.SetProperties(true, configNames, "Verify", this.useVerifier.Checked);
     storage.SetProperties(true, configNames, "ReferenceTypesAreNonNullByDefault", this.nonNullByDefault.Checked);
     storage.SetProperties(true, configNames, "ProgramVerifierCommandLineOptions", this.verifyopts.Text);
     storage.SetProperties(true, configNames, "DisabledContractFeatures", this.GetDisabledList());
     storage.SetProperties(true, configNames, "CheckContractAdmissibility", this.checkContracts.Checked);
     storage.SetProperties(true, configNames, "CheckPurity", this.checkPurity.Checked);
 }
Пример #21
0
 public override void Load(string[] configNames, IPropertyStorage storage)
 {
   object result = storage.GetProperties(false, configNames, propertyName, defaultValue);
   if (result != null)
   {
     box.CheckState = CheckStateOfBool((bool)result);
   }
   else
   {
     box.CheckState = CheckState.Indeterminate;
   }
 }
Пример #22
0
        internal static string GetPropertyName(this IPropertyStorage propertyStorage, PIDDSI propid)
        {
            switch (propid)
            {
            case PIDDSI.BYTECOUNT:
                return("Bytes");

            case PIDDSI.CATEGORY:
                return("Category");

            case PIDDSI.COMPANY:
                return("Company");

            case PIDDSI.DOCPARTS:
                return("Titles of Parts");

            case PIDDSI.HEADINGPAIR:
                return("Heading Pairs");

            case PIDDSI.HIDDENCOUNT:
                return("Hidden Slides");

            case PIDDSI.LINECOUNT:
                return("Lines");

            case PIDDSI.LINKSDIRTY:
                return("Links Up To Date");

            case PIDDSI.MANAGER:
                return("Manager");

            case PIDDSI.MMCLIPCOUNT:
                return("MMClips");

            case PIDDSI.NOTECOUNT:
                return("Notes");

            case PIDDSI.PARCOUNT:
                return("Paragraphs");

            case PIDDSI.PRESFORMAT:
                return("Presentation Target");

            case PIDDSI.SCALE:
                return("Scale Crop");

            case PIDDSI.SLIDECOUNT:
                return("Slides");

            default:
                return(String.Empty);
            }
        }
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            object result = storage.GetProperties(false, configNames, propertyName, defaultValue);

            if (result != null)
            {
                box.CheckState = CheckStateOfBool((bool)result);
            }
            else
            {
                box.CheckState = CheckState.Indeterminate;
            }
        }
Пример #24
0
        public ModelBasedAgent(IPropertyStorage propertyStorage)
            : base(propertyStorage)
        {
            MovementSpeed = 50;
            Strength      = 65;
            Health        = 10;
            Eyesight      = 35;
            Endurance     = 35;
            Dodge         = 55;

            fsm = new FSM <ModelBasedAgent>(this);
            fsm.ChangeState(Born.Instance);
        }
Пример #25
0
        public WhoIsYourFatherAndWhatDoesHeDo(IPropertyStorage propertyStorage)
            : base(propertyStorage)
        {
            MovementSpeed = 80;
            Strength      = 50;
            Health        = 10;
            Eyesight      = 50;
            Endurance     = 59;
            Dodge         = 1;



            string ddd = this.GetType().FullName;
        }
Пример #26
0
        public Agent0047(IPropertyStorage propertyStorage) : base(propertyStorage)
        {
            rnd           = new Random();
            MovementSpeed = 50;
            Strength      = 80;
            Health        = 60;
            Eyesight      = 60;
            Endurance     = 0;
            Dodge         = 0;

            maxHealth = Health;
            moveX     = rnd.Next(-1, 2);
            moveY     = rnd.Next(-1, 2);
        }
Пример #27
0
 /// <summary>
 /// procreation change stats?
 /// </summary>
 /// <param name="parent1"></param>
 /// <param name="parent2"></param>
 /// <param name="propertyStorage"></param>
 /// <returns></returns>
 public override Agent CreateAgent(Agent parent1, Agent parent2, IPropertyStorage propertyStorage)
 {
     lastId++;
     if (cowardsMade * 0.3 >= noncowards)
     {
         noncowards++;
         cowardsMade++;
         return(new Speedy(propertyStorage, lastId, cowardType.nonCoward));
     }
     else
     {
         cowardsMade++;
         return(new Speedy(propertyStorage, lastId, cowardType.coward));
     }
 }
Пример #28
0
        private string SetGlobalComboBoxState(IPropertyStorage storage, ComboBox box, string propertyName, string defaultValue)
        {
            string result = storage.GetProperty(false, "", propertyName, defaultValue) as string;
            int    index  = 0;

            if (result != null)
            {
                if (!Int32.TryParse(result, out index))
                {
                    index = 0;
                }
            }
            box.SelectedIndex = index;
            return(result);
        }
Пример #29
0
        /// <summary>
        /// Load the negated checkbox state from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool anyFound;
            bool indeterminate;
            bool result = storage.GetProperties <bool>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.CheckState = CheckBoxProperty.CheckStateFromBool(!result);
            }
            else
            {
                box.CheckState = CheckState.Indeterminate;
            }
        }
Пример #30
0
        /// <summary>
        /// Load the textbox string from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool   anyFound;
            bool   indeterminate;
            string text = storage.GetProperties <string>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.Text = (text == null ? "" : text);
            }
            else
            {
                box.Text = TextIndeterminate;
            }
        }
Пример #31
0
        public StateBasedAgent(IPropertyStorage propertyStorage)
            : base(propertyStorage)

        {
            MovementSpeed = 70;
            Strength      = 25;
            Health        = 10;
            Eyesight      = 35;
            Endurance     = 55;
            Dodge         = 55;


            //Start state created
            fsm = new FSM <StateBasedAgent>(this);
            fsm.ChangeState(Born.Instance);
        }
Пример #32
0
    public override void Save(string[] configNames, IPropertyStorage storage)
    {
      if (box.CheckState != CheckState.Indeterminate)
      {
        storage.SetProperties(false, configNames, propertyName, box.Checked);
        // TODO: avoid saving default values, once removing works
#if false
        if (box.Checked != defaultValue)
        {
          storage.SetProperties(false, configNames, propertyName, box.Checked);
        }
        else
        {
          // don't clutter csproj file
          foreach (var config in configNames)
          {
            storage.RemoveProperty(false, config, propertyName);
          }
        }
#endif
      }
    }
Пример #33
0
 private string SetGlobalComboBoxState(IPropertyStorage storage, ComboBox box, string propertyName, string defaultValue)
 {
     string result = storage.GetProperty(false, "", propertyName, defaultValue) as string;
     int index = 0;
     if (result != null)
     {
         if (!Int32.TryParse(result, out index))
         {
             index = 0;
         }
     }
     box.SelectedIndex = index;
     return result;
 }
Пример #34
0
 private string SetComboBoxState(string[] configNames, IPropertyStorage storage, ComboBox box, string propertyName, string defaultValue)
 {
     string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;
     box.SelectedItem = result;
     return result;
 }
Пример #35
0
        public void SaveProperties(string[] configNames, IPropertyStorage storage)
        {
            Contract.Assume(storage != null);

            foreach (var prop in properties)
            {
                Contract.Assume(prop != null);
                prop.Save(configNames, storage);
            }

            if (AssemblyModeDropDown.SelectedItem != null)
            {
                storage.SetProperty(false, "", AssemblyModeName, AssemblyModeDropDown.SelectedIndex.ToString());
            }
            if (RuntimeCheckingLevelDropDown.SelectedItem != null)
            {
                storage.SetProperties(false, configNames, RuntimeCheckingLevelName, RuntimeCheckingLevelDropDown.SelectedItem.ToString());
            }
            if (ContractReferenceAssemblySelection.SelectedItem != null)
            {
                storage.SetProperties(false, configNames, ContractReferenceAssemblyName, ContractReferenceAssemblySelection.SelectedItem.ToString());
            }

            storage.SetProperties(false, configNames, WarningLevelName, WarningLevelTrackBar.Value.ToString());
        }
Пример #36
0
 public override void Load(string[] configNames, IPropertyStorage storage)
 {
   string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;
   box.Text = result;
 }
Пример #37
0
        /// <summary>
        /// Load project file properties and represent them in the UI.
        /// IMPORTANT:
        ///   The defaults must match what the build script expect as defaults!!! This way, not representing a
        ///   property in the project file is equivalent to it having the default.
        /// </summary>
        /// <param name="configNames"></param>
        /// <param name="storage"></param>
        public void LoadProperties(string[] configNames, IPropertyStorage storage)
        {
            bool propertiesChangedOnLoad = false;

            SetGlobalComboBoxState(storage, AssemblyModeDropDown, AssemblyModeName, "0");

            foreach (var prop in properties)
            {
                Contract.Assume(prop != null);

                prop.Load(configNames, storage);
            }

            EnableDisableRuntimeDependentUI();

            var runtimeCheckingLevel = SetComboBoxState(configNames, storage, RuntimeCheckingLevelDropDown, RuntimeCheckingLevelName, "Full");
            if (runtimeCheckingLevel == "RequiresAlways")
            {
                // fixup backwards compatible string
                RuntimeCheckingLevelDropDown.SelectedItem = "ReleaseRequires";
                propertiesChangedOnLoad = true;
            }


            EnableDisableStaticDependentUI();

            EnableDisableBaseLineUI();

            EnableDisableBackgroundDependentUI();

            EnableDisableCacheDependendUI();

            bool anyFound, indeterminate;
            string contractReferenceAssemblySelection = storage.GetProperties(false, configNames, ContractReferenceAssemblyName, "(none)", out anyFound, out indeterminate);

            if (!indeterminate)
            {
                if (!anyFound)
                {
                    bool anyFound2, indeterminate2;

                    // check for legacy
                    var legacyBuildContractReferenceAssembly = storage.GetProperties(false, configNames, BuildContractReferenceAssemblyName, false, out anyFound2, out indeterminate2);
                    if (anyFound2 && !indeterminate2)
                    {
                        if (legacyBuildContractReferenceAssembly)
                        {
                            // TODO remove property
                            contractReferenceAssemblySelection = "Build";
                            // make sure properties are changed!!!
                            propertiesChangedOnLoad = true;
                        }
                        else
                        {
                            contractReferenceAssemblySelection = "DoNotBuild";
                            propertiesChangedOnLoad = true;
                        }
                    }
                }
                ContractReferenceAssemblySelection.SelectedItem = contractReferenceAssemblySelection;
            }
            else
            {
                ContractReferenceAssemblySelection.SelectedItem = null;
            }

            // Load the track bar properties
            LoadTrackBarProperties(WarningLevelTrackBar, WarningLevelName, configNames, storage);

            EnableDisableContractReferenceDependentUI();


            if (propertiesChangedOnLoad)
            {
                this.PropertiesChanged();
                SaveProperties(configNames, storage);
            }
        }
Пример #38
0
        /// <summary>
        /// Load the negated checkbox state from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>		
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool anyFound;
            bool indeterminate;
            bool result = storage.GetProperties<bool>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.CheckState = CheckBoxProperty.CheckStateFromBool(!result);
            }
            else
            {
                box.CheckState = CheckState.Indeterminate;
            }
        }
Пример #39
0
 /// <summary>
 /// Save the textbox state to its associated msbuild property
 /// </summary>
 /// <param name="configNames">The set of configurations</param>
 /// <param name="storage">The property storage</param>
 public override void Save(string[] configNames, IPropertyStorage storage)
 {
     if (box.Text != null && box.Modified)
     { // only save on modification
         storage.SetProperties(perUser, configNames, propertyName, box.Text);
     }
 }
        OpenPropertyStorage(
            ref Guid fmtid,
            out IPropertyStorage ips
            )
        {
            int hr = _pss.Open(ref fmtid, (uint)_grfMode, out ips);

            //
            // A COM "not found" error is acceptable; it just means that the
            // file doesn't have the requested property set. Any other COM error code 
            // is an error.
            //
            if (hr == SafeNativeCompoundFileConstants.STG_E_FILENOTFOUND)
            {
                ips = null; // Just for safety; the failed call to Open should have set it to null.
            }
            else
            {
                // Throw if we failed.
                SecurityHelper.ThrowExceptionForHR(hr);
            }
        }
Пример #41
0
 public abstract void Load(string[] configNames, IPropertyStorage storage);
Пример #42
0
 public void LoadProperties(string[] configNames, IPropertyStorage storage)
 {
     foreach (var prop in properties)
     {
         prop.Load(configNames, storage);
     }
     EnableDisableUI();
 }
Пример #43
0
        /// <summary>
        /// Load the textbox string from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool anyFound;
            bool indeterminate;
            string text = storage.GetProperties<string>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.Text = (text == null ? "" : text);
            }
            else
            {
                box.Text = TextIndeterminate;
            }
        }
Пример #44
0
 public void SaveProperties(string[] configNames, IPropertyStorage storage)
 {
     foreach (var prop in properties)
     {
         prop.Save(configNames, storage);
     }
 }
Пример #45
0
 // Save the UI settings to the property storage
 public void SaveProperties(string[] configNames, IPropertyStorage storage)
 {
   storage.SetProperties(true, configNames, "UseContracts", this.useContractsCheck.Checked);
   storage.SetProperties(true, configNames, "ProduceContractAssembly", this.produceContractAssemblyCheck.Checked);
   storage.SetProperties(true, configNames, "Verify", this.useVerifier.Checked);
   storage.SetProperties(true, configNames, "ReferenceTypesAreNonNullByDefault", this.nonNullByDefault.Checked);
   storage.SetProperties(true, configNames, "ProgramVerifierCommandLineOptions", this.verifyopts.Text);
   storage.SetProperties(true, configNames, "DisabledContractFeatures", this.GetDisabledList());
   storage.SetProperties(true, configNames, "CheckContractAdmissibility", this.checkContracts.Checked);
   storage.SetProperties(true, configNames, "CheckPurity", this.checkPurity.Checked);
 }
Пример #46
0
        static private void LoadTrackBarProperties(TrackBar trackBar, string name, string[] configNames, IPropertyStorage storage)
        {
            bool anyFound, indeterminate;
            var selection = storage.GetProperties(false, configNames, name, "out", out anyFound, out indeterminate);
            int value;

            if (!indeterminate && Int32.TryParse(selection, out value)
              && value >= trackBar.Minimum && value <= trackBar.Maximum)
            {
                trackBar.Value = value;
            }
            else
            {
                trackBar.Value = 0; // default: low
            }
        }
Пример #47
0
 /// <summary>
 /// Save the negated checkbox state to its associated msbuild property
 /// </summary>
 /// <param name="configNames">The set of configurations</param>
 /// <param name="storage">The property storage</param>
 public override void Save(string[] configNames, IPropertyStorage storage)
 {
     if (box.CheckState != CheckState.Indeterminate)
     {
         storage.SetProperties(perUser, configNames, propertyName, !box.Checked);
     }
 }
Пример #48
0
            void IPropertySetStorage.Create(
                    ref Guid rfmtid,
                    ref Guid pclsid,
                    UInt32 grfFlags,
                    UInt32 grfMode,
                    out IPropertyStorage ppprstg
                    )
            {
                SecurityHelper.DemandCompoundFileIOPermission();

                UnsafeNativeCompoundFileMethods.UnsafeNativeIPropertyStorage propertyStorage;

                _unsafePropertySetStorage.Create(
                    ref rfmtid,
                    ref pclsid,
                    grfFlags,
                    grfMode,
                    out propertyStorage
                    );

                if (propertyStorage != null)
                    ppprstg = new SafeIPropertyStorageImplementation(propertyStorage);
                else
                    ppprstg = null;
            }
Пример #49
0
    public override void Save(string[] configNames, IPropertyStorage storage)
    {
      if (box.Text != null)
      {
        storage.SetProperties(false, configNames, propertyName, box.Text);
#if false
        if (box.Text != defaultValue)
        {
          storage.SetProperties(false, configNames, propertyName, box.Text);
        }
        else
        {
          // don't clutter csproj file
          foreach (var config in configNames)
          {
            storage.RemoveProperty(false, config, propertyName);
          }
        }
#endif
      }
    }
Пример #50
0
            int IPropertySetStorage.Open(
                    ref Guid rfmtid,
                    UInt32 grfMode,
                    out IPropertyStorage ppprstg
                    )
            {
                SecurityHelper.DemandCompoundFileIOPermission();
                
                UnsafeNativeCompoundFileMethods.UnsafeNativeIPropertyStorage propertyStorage;

                int hr = _unsafePropertySetStorage.Open(
                    ref rfmtid,
                    grfMode,
                    out propertyStorage
                    );

                if (propertyStorage != null)
                    ppprstg = new SafeIPropertyStorageImplementation(propertyStorage);
                else
                    ppprstg = null;

                return hr;
            }
Пример #51
0
    // Initialize the UI from the property storage
    public void LoadProperties(string[] configNames, IPropertyStorage storage)
    {
      this.useContractsCheck.CheckState = CheckState.Unchecked;
      this.produceContractAssemblyCheck.CheckState = CheckState.Unchecked;
      this.useVerifier.CheckState = CheckState.Unchecked;
      this.publicPreconditions.CheckState = CheckState.Unchecked;
      this.allOtherPreAndPostConditions.CheckState = CheckState.Unchecked;
      this.assumes.CheckState = CheckState.Unchecked;
      this.invariants.CheckState = CheckState.Unchecked;
      this.publicContracts.CheckState = CheckState.Unchecked;
      this.allOtherContracts.CheckState = CheckState.Unchecked;
      this.nonNullByDefault.CheckState = CheckState.Unchecked;
      this.checkContracts.CheckState = CheckState.Unchecked;
      this.checkPurity.CheckState = CheckState.Unchecked;

      // contracts checkbox.
      object propUseContracts = storage.GetProperties(true, configNames, "UseContracts", false);
      if (propUseContracts != null){
        this.useContractsCheck.Checked = (bool)propUseContracts;
        this.publicPreconditions.Checked = true;
        this.allOtherPreAndPostConditions.Checked = true;
        this.assumes.Checked = true;
        this.invariants.Checked = true;
        this.publicContracts.Checked = true;
        this.allOtherContracts.Checked = true;
        this.checkContracts.Checked = true;
      }

      // produce contract assembly checkbox
      object produceContractAssembly = storage.GetProperties(true, configNames, "ProduceContractAssembly", false);
      if (produceContractAssembly != null)
        this.produceContractAssemblyCheck.Checked = (bool)produceContractAssembly;

      // verifier checkbox.
      object propUseVerifier = storage.GetProperties(true, configNames, "Verify", false);
      if (propUseVerifier != null)
        this.useVerifier.Checked = (bool)propUseVerifier;

      // verifier options
      object propVerifierOptions = storage.GetProperties(true, configNames, "ProgramVerifierCommandLineOptions", "");
      if (propVerifierOptions != null)
        this.verifyopts.Text = (string)propVerifierOptions;

      //non null default checkbox
      object referenceTypesAreNonNullByDefault = storage.GetProperties(true, configNames, "ReferenceTypesAreNonNullByDefault", false);
      if (referenceTypesAreNonNullByDefault != null)
        this.nonNullByDefault.Checked = (bool)referenceTypesAreNonNullByDefault;

      //contract admissibility checkbox
      object checkAdmissibility = storage.GetProperties(true, configNames, "CheckContractAdmissibility", true);
      if (checkAdmissibility != null)
        this.checkContracts.Checked = (bool)checkAdmissibility;

      //method purity checkbox
      object checkPurity = storage.GetProperties(true, configNames, "CheckPurity", false);
      if (checkPurity != null)
        this.checkPurity.Checked = (bool)checkPurity;

      // other checkboxes
      string disableString = storage.GetProperties(true, configNames, "DisabledContractFeatures", "") as string;
      if (disableString != null){
        string[] disableList = disableString.Split(';');
        foreach (string ds in disableList){
          switch (ds){
            case "ac":
            case "assumechecks":
              this.assumes.Checked = false;
              break;
            case "dc":
            case "defensivechecks":
              this.publicPreconditions.Checked = false;
              break;
            case "gcc":
            case "guardedclasseschecks":
              this.invariants.Checked = false;
              break;
            case "ic":
            case "internalchecks":
              this.allOtherPreAndPostConditions.Checked = false;
              break;
            case "icm":
            case "internalcontractsmetadata":
              this.allOtherContracts.Checked = false;
              break;
            case "pcm":
            case "publiccontractsmetadata":
              this.publicContracts.Checked = false;
              break;
          }
        }
      }
    }