示例#1
0
        public void CheckSerilizingAndDeserializeingOfVersionObject()
        {
            var versionObject = VersionObject.GetVersionObject();

            versionObject.Clear();
            versionObject.VersionData.VersionName        = "aaa";
            versionObject.VersionData.VersionDescription = "bbb";
            versionObject.VersionData.VersionChanges.Add("c1");
            versionObject.VersionData.VersionChanges.Add("c2");
            var file = File.Create("aa.txt");

            file.Close();
            versionObject.ListOfFiles.Add(new FileInformation("aa.txt"));

            Update.MoveWithReplaceInNaroCad("Version.XML", "Version1.XML");

            Program.SerializeToXml(versionObject);
            versionObject.Clear();

            versionObject = UpdateLogic.DeserializeFromXml("Version.XML");
            Assert.IsTrue(versionObject.VersionData.VersionName == "aaa", "Version name not correct.");
            Assert.IsTrue(versionObject.VersionData.VersionDescription == "bbb", "Version description not correct.");
            Assert.IsTrue(versionObject.VersionData.VersionChanges[0] == "c1", "Version Change 1 not correct.");
            Assert.IsTrue(versionObject.VersionData.VersionChanges[1] == "c2", "Version Change 2 not correct.");
            Assert.IsTrue(versionObject.ListOfFiles[0].SourcePath == "aa.txt", "Source path not correct.");

            Update.MoveWithReplaceInNaroCad("Version1.XML", "Version.XML");
            File.Delete("aa.txt");
        }
示例#2
0
        public FormMain()
        {
            InitializeComponent();
            path    = new PathLogic();
            updater = new UpdateLogic();
            remote  = new RemoteLogic();

            skinManager = MaterialSkinManager.Instance;
            skinManager.AddFormToManage(this);
            skinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            skinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);

            // Show tooltips
            listViewMods.ShowItemToolTips = true;

            // Upgrade settings from previous version
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }

            var modList = Properties.Settings.Default.ModsList.Split(',');

            foreach (var mod in modList)
            {
                if (!defaultMods.Contains(mod))
                {
                    defaultMods.Add(mod.ToLower());
                }
            }
        }
示例#3
0
 public FormMain()
 {
     InitializeComponent();
     path    = new PathLogic();
     updater = new UpdateLogic();
     remote  = new RemoteLogic();
 }
示例#4
0
    protected virtual void Awake()
    {
        //SetStates
        _logic = LOGIC.Default;
        _group = GROUP.None;
        _state = STATE.Generalize;

        //Load Resources
        _prefabGroup = Resources.Load("Prefabs/Group") as GameObject;

        //init objects
        _listCollidedSWindows = new List <SWindow>();
        _ray         = new Ray();
        _rayPosition = Vector3.zero;
        _parent      = transform.parent;

        //Position &  Looker Init
        _updateLogic  = null;
        _updateLogic += UpdateDefaultLogic;

        _updateGrouping = UpdateCheckingGrouping;

        _currentScale    = _targetScale = transform.localScale;
        _currentPosition = _targetPosition = transform.position;
        _currentLooker   = _targetLooker = transform.position + transform.forward;

        //added components
        InitComponent <Rigidbody>(InitRigidBody);
        InitComponent <BoxCollider>(InitBoxCollider);
    }
示例#5
0
    public virtual void OnClicked(Vector3 pos, Vector3 forward)
    {
        //Set Status
        _logic = LOGIC.Clicked;

        if (_state != STATE.Generalize)
        {
            return;
        }

        //Set Grouping Status
        if (_group != GROUP.Done)
        {
            _group = GROUP.Ready;
        }

        _currentPosition = transform.position;
        _targetPosition  = pos;

        _currentLooker = transform.position + transform.forward;
        _targetLooker  = pos + forward;

        _updateLogic  = null;
        _updateLogic += UpdateGrapedLogic;

        _boxCollider.size      = _boxColliderSizeDraged;
        _boxCollider.center    = _boxColliderCenterDraged;
        _boxCollider.isTrigger = true;
    }
        private void SetState(StateID newStateID)
        {
            State newState = this.states[(int)newStateID];

            this.stateID                 = newStateID;
            this.updateLogic             = newState.updateLogic;
            pressed[GameInput.Inventory] = () => this.SetNextState(newState.nextStateID);
        }
示例#7
0
        public void CheckDeleteFileMethod()
        {
            var file = File.Create("aaa.txt");

            file.Close();
            UpdateLogic.DeleteFile("aaa.txt");
            Assert.IsTrue(!File.Exists("aaa.txt"), "File still exists on disk.");
        }
示例#8
0
        private void SetState(StateID newStateID)
        {
            State newState = states[(int)newStateID];

            this.stateID     = newStateID;
            this.updateLogic = newState.updateLogic;
            onOpen           = () => SetNextState(newState.onOpenStateID);
            onClose          = () => SetNextState(newState.onCloseStateID);
        }
示例#9
0
        public static int Compress(string sourcePath, string destinationPath)
        {
            var filedata       = MeshTopoShapeInterpreter.FileToData(sourcePath);
            var compressedData = MeshTopoShapeInterpreter.Pack(filedata);
            var str            = Convert.ToBase64String(compressedData);

            UpdateLogic.MakeSureThatDestinationDirectoriesExist(destinationPath, UpdateLogic.CurrentPath);
            File.WriteAllBytes(destinationPath, compressedData);
            return(str.GetHashCode());
        }
示例#10
0
    public void UpdateCheckingGrouping()
    {
        if (_group == GROUP.Done)
        {
            return;
        }

        _ray.origin    = transform.position + _rayPosition;
        _ray.direction = -transform.forward;

        //Search Object For Grouping
        if (_group == GROUP.Ready &&
            Physics.Raycast(_ray, out _hit, 1.0f) &&
            _hit.transform != null &&
            _hit.transform.GetComponent <SWindow>()._group != GROUP.Done)
        {
            SWindow coord = _hit.transform.GetComponent <SWindow>();
            if (coord != null && coord == _groupingCoord)
            {
                _groupingTimer += Time.deltaTime;

                if (_groupingTimer > 1.0f)
                {
                    if (_groupingCoord is SWindowGroup)
                    {
                        _swTmp = _groupingCoord as SWindowGroup;
                    }
                    else
                    {
                        Vector3    targetPosition = (transform.position + _groupingCoord.transform.position) * 0.5f;
                        Quaternion targetRotation = Quaternion.Lerp(transform.rotation, _groupingCoord.transform.rotation, 0.5f);

                        Transform  parent = GameObject.Find("_Windows").transform;
                        GameObject go     = Instantiate(_prefabGroup, targetPosition, targetRotation, parent);

                        _swTmp = go.GetComponent <SWindowGroup>();
                        go.SetActive(true);
                    }
                    _groupingTimer  = 0.0f;
                    _updateGrouping = UpdateCreatingGrouping;
                }
            }
            else
            {
                _groupingCoord = coord;
                _groupingTimer = 0.0f;
            }
        }
        else
        {
            _groupingCoord = null;
        }
    }
示例#11
0
    public virtual void DoGrouping(Transform parent)
    {
        _parent = parent;

        _group = GROUP.Done;

        _targetPosition = parent.position;
        _targetLooker   = parent.forward;

        _updateLogic  = null;
        _updateLogic += UpdateGroupingLogic;
    }
示例#12
0
        public void CheckCreateListOfFilesToBeDeletedMethod()
        {
            var oldList = new List <string> {
                "aaa", "bbb", "ccc"
            };
            var newList = new List <string> {
                "aaa", "bbb", "ddd"
            };
            var list = UpdateLogic.CreateListOfFilesToBeDeleted(oldList, newList);

            Assert.IsTrue(list[0] == Directory.GetCurrentDirectory() + "\\" + "ccc",
                          "List of files to be deleted is generated incorectly.");
        }
示例#13
0
    public virtual void UnGrouping()
    {
        _parent = null;

        _group = GROUP.None;

        _updateLogic = null;
        if (_logic == LOGIC.Grabed)
        {
            _updateLogic += UpdateGrapedLogic;
        }
        else
        {
            _updateLogic += UpdateDefaultLogic;
        }
    }
示例#14
0
        private void Save_OnClick(object sender, RoutedEventArgs e)
        {
            BaseLogic            baselogic    = new BaseLogic();
            UpdateLogic          updatelogic  = new UpdateLogic();
            TableUpdateViewModel data         = new TableUpdateViewModel();
            InsertLogic          Insert_Logic = new InsertLogic();

            if (_generic.PHDAssignmentViewModel.EndDate == null)
            {
                MessageBox.Show("Моля въведете Крайна Дата");
                return;
            }
            if (_generic.PHDAssignmentViewModel.StartDate == null)
            {
                MessageBox.Show("Моля въведете Начална Дата");
                return;
            }
            if (_generic.PHDAssignmentViewModel.id_department == null)
            {
                MessageBox.Show("Моля въведете Катедра на Обучение");
                return;
            }
            if (_generic.PersonsViewModel.FirstName == null)
            {
                MessageBox.Show("Моля въведете Първо Име");
                return;
            }
            if (_generic.PersonsViewModel.LastName == null)
            {
                MessageBox.Show("Моля въведете Фамилия");
                return;
            }
            if (_generic.PersonsViewModel.id_gender == null)
            {
                MessageBox.Show("Моля въведете ПОЛ");
                return;
            }
            if (EditData == null)
            {
                Insert_Logic.Insert_Entry(_generic);
            }
            else
            {
                updatelogic.Update_Entry(_generic, EditData.id);
            }
            Close();
        }
        private void UpdaterSetup()
        {
            var optionsSetup   = ActionsGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>();
            var optionsSection = optionsSetup.UpdateSectionNode(OptionSectionNames.Updater);

            var haveToUpdate  = false; // optionsSection.GetBoolValue(0);
            var updateNightly = false; // optionsSection.GetBoolValue(1);

            var RibbonPanel = ActionsGraph[InputNames.FastToolbarInput].Get <StackPanel>();

            var uppdateLogic = new UpdateLogic(ActionsGraph, haveToUpdate, updateNightly, RibbonPanel);

            var updaterThread = new Thread(UpdateLogic.Main);

            updaterThread.SetApartmentState(ApartmentState.STA);
            updaterThread.Start(uppdateLogic);
        }
示例#16
0
 private static void CreateCompressedFiles()
 {
     UpdateLogic.DeleteDirectory(UpdateLogic.CompressedFilesDirectory);
     UpdateLogic.CreateDirectory(UpdateLogic.CompressedFilesDirectory);
     foreach (var file in FileList.GetFileList().ListOfFiles)
     {
         if (file.Hash ==
             Compress(file.SourcePath,
                      UpdateLogic.CompressedFilesDirectory + file.DestinationPath +
                      UpdateLogic.CompressedFilesExtension).ToString())
         {
             //File.Delete(compressedFilesDirectoryPath + file.DestinationPath + compressedFilesExtension);
         }
     }
     Compress(UpdateLogic.VersionFileName,
              UpdateLogic.CompressedFilesDirectory + UpdateLogic.VersionFileName +
              UpdateLogic.CompressedFilesExtension);
 }
示例#17
0
    public void UpdateCreatingGrouping()
    {
        _ray.origin    = transform.position + _rayPosition;
        _ray.direction = -transform.forward;

        //Search Object For Grouping
        if (_group == GROUP.Ready)
        {
            if (
                Physics.Raycast(_ray, out _hit, 1.0f) &&
                _hit.transform != null &&
                (_hit.transform.GetComponent <SWindow>() == _groupingCoord || _hit.transform.GetComponent <SWindow>() == _swTmp))
            {
                return;
            }
            else
            {
                if (_groupingCoord != _swTmp)
                {
                    _swTmp.Remove();
                    _swTmp = null;
                }
                _groupingCoord  = null;
                _updateGrouping = UpdateCheckingGrouping;
                return;
            }
        }
        else
        {
            if (_groupingCoord != _swTmp)
            {
                _swTmp.AddSWindow(_groupingCoord);
            }
            _swTmp.AddSWindow(this);
            _swTmp.Setup();

            //Fix &
            _swTmp          = null;
            _groupingCoord  = null;
            _updateGrouping = UpdateCheckingGrouping;
            return;
        }
    }
示例#18
0
        public FormMain()
        {
            InitializeComponent();
            path    = new PathLogic();
            updater = new UpdateLogic();
            remote  = new RemoteLogic();
            listViewMods.ShowItemToolTips = true;
            // Show tooltips

            var modList = Properties.Settings.Default.ModsList.Split(',');

            foreach (var mod in modList)
            {
                if (!defaultMods.Contains(mod))
                {
                    defaultMods.Add(mod.ToLower());
                }
            }
        }
示例#19
0
    public virtual void OnReleased(Vector3 pos, Vector3 forward)
    {
        //Set Status
        _logic = LOGIC.Released;

        if (_state != STATE.Generalize)
        {
            return;
        }

        //Set Grouping Status
        if (_group != GROUP.Done)
        {
            _group = GROUP.None;
        }

        //Set Transform
        _targetPosition = pos;
        _targetLooker   = transform.position + transform.forward;

        //Clear CollidedWindows List
        _listCollidedSWindows.Clear();


        if (_group == GROUP.Done)
        {
            _updateLogic  = null;
            _updateLogic += UpdateGroupingLogic;
        }
        else
        {
            _updateLogic  = null;
            _updateLogic += UpdateDefaultLogic;
        }

        _boxCollider.size      = _boxColliderSizeReleased;
        _boxCollider.center    = _boxColliderCenterReleased;
        _boxCollider.isTrigger = false;
    }
示例#20
0
    public void Setup()
    {
        _boxCollider.enabled = true;

        _update = () =>
        {
            _childrenList.ForEach((sw) =>
            {
                if ((sw.TargetPosition - transform.position).sqrMagnitude > 1.4f)
                {
                    sw.UnGrouping();
                    _childrenList.Remove(sw);
                    Refresh();

                    if (_childrenList.Count < 2)
                    {
                        Remove();
                    }
                }
            });
        };
    }
示例#21
0
    public bool Init(ILogic logic, object obj)
    {
        //Screen.sleepTimeout = SleepTimeout.NeverSleep;
        m_bBeginDown = false;
        m_Logic      = (UpdateLogic)logic;
        SceneObjMgr.Instance.LoadInnerUpdateBackMat();

        Object     go     = Resources.Load("InnerRes/UI/Progress_bar");
        Object     eft    = Resources.Load("InnerRes/Effect/Progressbar_Effect");
        GameObject eftObj = GameObject.Instantiate(eft) as GameObject;

        m_Progressbar = GameObject.Instantiate(go) as GameObject;
        m_Progressbar.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);
        eftObj.transform.SetParent(m_Progressbar.transform.GetChild(2), false);
        m_ProgressEffect = eftObj.transform.GetChild(0).gameObject;
        m_ProgressEffect.SetActive(false);
        GlobalEffectMgr.SetEffectOnUI(eftObj);
        m_ProgressSlider = m_Progressbar.transform.GetComponent <UISlider>();
        m_ProgressLabel  = m_Progressbar.transform.GetChild(1).GetComponent <UILabel>();
        m_str            = StringTable.GetString("check_wait");
        return(true);
    }
 private void BindState(StateID stateID, UpdateLogic stateUpdateLogic, StateID nextStateID)
 {
     this.states[(int)stateID] = new State(stateUpdateLogic, nextStateID);
 }
示例#23
0
 public void CheckDeleteFileMethodWhenFileDoesNotExist()
 {
     UpdateLogic.DeleteFile("aaa.txt");
     Assert.IsTrue(!File.Exists("aaa.txt"), "File exists on disk.");
 }
示例#24
0
 public State(UpdateLogic updateLogic, StateID onOpenStateID, StateID onCloseStateID)
 {
     this.updateLogic    = updateLogic;
     this.onOpenStateID  = onOpenStateID;
     this.onCloseStateID = onCloseStateID;
 }
示例#25
0
 private void BindState(StateID stateID, UpdateLogic stateUpdateLogic, StateID onOpenStateID, StateID onCloseStateID)
 {
     states[(int)stateID] = new State(stateUpdateLogic, onOpenStateID, onCloseStateID);
 }
示例#26
0
 public static void ClassInitialize(TestContext testContext)
 {
     _updateLogic = UpdateLogic.GetInstance(TestEnvironment.Package);
     Assert.IsNotNull(_updateLogic);
 }
示例#27
0
 protected virtual void OnUpdateLogic(float lastFrameTimeInSecond)
 {
     UpdateLogic?.Invoke(this, lastFrameTimeInSecond);
 }
 public State(UpdateLogic updateLogic, StateID nextStateID)
 {
     this.updateLogic = updateLogic;
     this.nextStateID = nextStateID;
 }